Skip to content

Commit

Permalink
Bump min python to 3.8, bump cython in tests, and various skel update…
Browse files Browse the repository at this point in the history
…s. Also docs theme switch to furo.
  • Loading branch information
ionelmc committed May 1, 2024
1 parent f3ab06b commit b70190e
Show file tree
Hide file tree
Showing 15 changed files with 131 additions and 96 deletions.
4 changes: 4 additions & 0 deletions .bumpversion.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,7 @@ replace = version = release = '{new_version}'
[bumpversion:file:src/hunter/__init__.py]
search = __version__ = '{current_version}'
replace = __version__ = '{new_version}'

[bumpversion:file:.cookiecutterrc]
search = version: {current_version}
replace = version: {new_version}
14 changes: 7 additions & 7 deletions .cookiecutterrc
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
# Generated by cookiepatcher, a small shim around cookiecutter (pip install cookiepatcher)

default_context:
allow_tests_inside_package: 'no'
c_extension_function: '-'
c_extension_module: '-'
c_extension_optional: 'yes'
c_extension_support: cython
codacy: 'no'
Expand All @@ -17,17 +14,19 @@ default_context:
email: [email protected]
formatter_quote_style: single
full_name: Ionel Cristian Mărieș
function_name: compute
github_actions: 'yes'
github_actions_osx: 'yes'
github_actions_windows: 'yes'
license: BSD 2-Clause License
module_name: core
package_name: hunter
pre_commit: 'yes'
project_name: Hunter
project_short_description: Hunter is a flexible code tracing toolkit, not for measuring coverage, but for debugging, logging, inspection and other nefarious purposes. It has a simple Python API and a convenient terminal API (see `Environment variable activation <env-var-activation_>`_).
pypi_badge: 'yes'
pypi_disable_upload: 'no'
release_date: '2022-09-27'
release_date: '2023-04-26'
repo_hosting: github.com
repo_hosting_domain: github.com
repo_main_branch: master
Expand All @@ -38,10 +37,11 @@ default_context:
sphinx_docs: 'yes'
sphinx_docs_hosting: https://python-hunter.readthedocs.io/
sphinx_doctest: 'no'
sphinx_theme: sphinx-py3doc-enhanced-theme
sphinx_theme: furo
test_matrix_separate_coverage: 'yes'
version: 3.5.1
tests_inside_package: 'no'
version: 3.6.1
version_manager: bump2version
website: https://blog.ionelmc.ro
year_from: '2015'
year_to: '2023'
year_to: '2024'
7 changes: 6 additions & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
[paths]
source = src

[run]
branch = true
source = src
source =
src
tests
parallel = true
plugins = Cython.Coverage

Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ repos:
rev: v0.4.2
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix, --show-fixes]
args: [--fix, --exit-non-zero-on-fix, --show-fixes, --unsafe-fixes]
- repo: https://github.com/psf/black
rev: 24.4.2
hooks:
Expand Down
4 changes: 4 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ version: 2
sphinx:
configuration: docs/conf.py
formats: all
build:
os: ubuntu-22.04
tools:
python: "3"
python:
install:
- requirements: docs/requirements.txt
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
BSD 2-Clause License

Copyright (c) 2015-2023, Ionel Cristian Mărieș. All rights reserved.
Copyright (c) 2015-2024, Ionel Cristian Mărieș. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
following conditions are met:
Expand Down
10 changes: 4 additions & 6 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,11 @@ Overview
* - docs
- |docs|
* - tests
- | |github-actions|
| |codecov|
- |github-actions| |codecov|
* - package
- | |version| |wheel| |supported-versions| |supported-implementations|
| |commits-since|
- |version| |wheel| |supported-versions| |supported-implementations| |commits-since|
.. |docs| image:: https://readthedocs.org/projects/python-hunter/badge/?style=flat
:target: https://python-hunter.readthedocs.io/
:target: https://readthedocs.org/projects/python-hunter/
:alt: Documentation Status

.. |github-actions| image:: https://github.com/ionelmc/python-hunter/actions/workflows/github-actions.yml/badge.svg
Expand All @@ -25,7 +23,7 @@ Overview

.. |codecov| image:: https://codecov.io/gh/ionelmc/python-hunter/branch/master/graphs/badge.svg?branch=master
:alt: Coverage Status
:target: https://codecov.io/github/ionelmc/python-hunter
:target: https://app.codecov.io/github/ionelmc/python-hunter

.. |version| image:: https://img.shields.io/pypi/v/hunter.svg
:alt: PyPI Package latest release
Expand Down
2 changes: 1 addition & 1 deletion ci/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def main():
tox_environments = [line for line in tox_environments if line.startswith('py')]
for template in templates_path.rglob('*'):
if template.is_file():
template_path = str(template.relative_to(templates_path))
template_path = template.relative_to(templates_path).as_posix()
destination = base_path / template_path
destination.parent.mkdir(parents=True, exist_ok=True)
destination.write_text(jinja.get_template(template_path).render(tox_environments=tox_environments))
Expand Down
30 changes: 23 additions & 7 deletions ci/templates/.github/workflows/github-actions.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: build
on: [push, pull_request]
on: [push, pull_request, workflow_dispatch]
jobs:
test:
name: {{ '${{ matrix.name }}' }}
Expand All @@ -22,9 +22,9 @@ jobs:
{% for env in tox_environments %}
{% set prefix = env.split('-')[0] -%}
{% if prefix.startswith('pypy') %}
{% set python %}pypy-{{ prefix[4] }}.{{ prefix[5] }}{% endset %}
{% set python %}pypy-{{ prefix[4] }}.{{ prefix[5:] }}{% endset %}
{% set cpython %}pp{{ prefix[4:5] }}{% endset %}
{% set toxpython %}pypy{{ prefix[4] }}.{{ prefix[5] }}{% endset %}
{% set toxpython %}pypy{{ prefix[4] }}.{{ prefix[5:] }}{% endset %}
{% else %}
{% set python %}{{ prefix[2] }}.{{ prefix[3:] }}{% endset %}
{% set cpython %}cp{{ prefix[2:] }}{% endset %}
Expand All @@ -46,7 +46,10 @@ jobs:
python: '{{ python }}'
toxpython: '{{ toxpython }}'
python_arch: '{{ python_arch }}'
tox_env: '{{ env }}{% if 'cover' in env %},codecov{% endif %}'
tox_env: '{{ env }}'
{% if 'cover' in env %}
cover: true
{% endif %}
cibw_arch: '{{ cibw_arch }}'
{% if env.endswith('cython-nocov') and not prefix.startswith('pypy') %}
cibw_build: '{{ cpython }}-{{ wheel_arch }}'
Expand All @@ -58,14 +61,14 @@ jobs:
{% endfor %}
{% endfor %}
steps:
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-qemu-action@v3
if: matrix.cibw_arch == 'aarch64'
with:
platforms: arm64
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: {{ '${{ matrix.python }}' }}
architecture: {{ '${{ matrix.python_arch }}' }}
Expand Down Expand Up @@ -105,6 +108,11 @@ jobs:
!matrix.cibw_build
run: >
tox -e {{ '${{ matrix.tox_env }}' }} -v
- uses: codecov/codecov-action@v3
if: matrix.cover
with:
verbose: true
flags: {{ '${{ matrix.tox_env }}' }}
- name: check wheel
if: matrix.cibw_build
run: twine check wheelhouse/*.whl
Expand All @@ -113,3 +121,11 @@ jobs:
if: matrix.cibw_build
with:
path: wheelhouse/*.whl
finish:
needs: test
if: {{ '${{ always() }}' }}
runs-on: ubuntu-latest
steps:
- uses: codecov/codecov-action@v3
with:
CODECOV_TOKEN: {% raw %}${{ secrets.CODECOV_TOKEN }}{% endraw %}
18 changes: 7 additions & 11 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import os
import traceback

import sphinx_py3doc_enhanced_theme

os.environ['PUREPYTHONHUNTER'] = 'yes'

Expand All @@ -20,35 +17,34 @@
source_suffix = '.rst'
master_doc = 'index'
project = 'Hunter'
year = '2015-2023'
year = '2015-2024'
author = 'Ionel Cristian Mărieș'
copyright = f'{year}, {author}'
try:
from pkg_resources import get_distribution

version = release = get_distribution('hunter').version
except Exception:
import traceback

traceback.print_exc()
version = release = '3.6.1'

pygments_style = 'trac'
templates_path = ['.']
extlinks = {
'issue': ('https://github.com/ionelmc/python-hunter/issues/%s', '#'),
'pr': ('https://github.com/ionelmc/python-hunter/pull/%s', 'PR #'),
'issue': ('https://github.com/ionelmc/python-hunter/issues/%s', '#%s'),
'pr': ('https://github.com/ionelmc/python-hunter/pull/%s', 'PR #%s'),
}
html_theme = 'sphinx_py3doc_enhanced_theme'
html_theme_path = [sphinx_py3doc_enhanced_theme.get_html_theme_path()]

html_theme = 'furo'
html_theme_options = {
'githuburl': 'https://github.com/ionelmc/python-hunter/',
}

html_use_smartypants = True
html_last_updated_fmt = '%b %d, %Y'
html_split_index = False
html_sidebars = {
'**': ['searchbox.html', 'globaltoc.html', 'sourcelink.html'],
}
html_short_title = f'{project}-{version}'

napoleon_use_ivar = True
Expand Down
2 changes: 1 addition & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
sphinx>=1.3
sphinx-py3doc-enhanced-theme>=2.3.2
furo
28 changes: 16 additions & 12 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,25 @@ requires = [
build-backend = "backend"
backend-path = ["build_backend"]

[tool.ruff.per-file-ignores]
[tool.ruff]
extend-exclude = ["static", "ci/templates"]
line-length = 140
src = ["src", "tests"]
target-version = "py38"
[tool.cython-lint]
max-line-length = 140

[tool.ruff.lint.per-file-ignores]
"ci/*" = ["S"]
"tests/*" = ["ALL"]

[tool.ruff]
extend-exclude = ["static", "ci/templates"]
[tool.ruff.lint]
ignore = [
"RUF001", # ruff-specific rules ambiguous-unicode-character-string
"S101", # flake8-bandit assert
"S308", # flake8-bandit suspicious-mark-safe-usage
"E501", # pycodestyle line-too-long
]
line-length = 140
select = [
"B", # flake8-bugbear
"C4", # flake8-comprehensions
Expand All @@ -40,22 +46,20 @@ select = [
"UP", # pyupgrade
"W", # pycodestyle warnings
]
src = ["src", "tests"]
target-version = "py37"

[tool.ruff.flake8-pytest-style]
[tool.ruff.lint.flake8-pytest-style]
fixture-parentheses = false
mark-parentheses = false

[tool.ruff.isort]
[tool.ruff.lint.flake8-quotes]
inline-quotes = "single"

[tool.ruff.lint.isort]
extra-standard-library = ["opcode"]
forced-separate = ["conftest"]
force-single-line = true

[tool.black]
line-length = 140
target-version = ["py37"]
target-version = ["py38"]
skip-string-normalization = true

[tool.ruff.flake8-quotes]
inline-quotes = "single"
Loading

0 comments on commit b70190e

Please sign in to comment.