diff --git a/.github/workflows/reusable-cookie.yml b/.github/workflows/reusable-cookie.yml index d6c7a118..7d648a4c 100644 --- a/.github/workflows/reusable-cookie.yml +++ b/.github/workflows/reusable-cookie.yml @@ -4,6 +4,8 @@ on: workflow_call: env: + # Many color libraries just need this to be set to any value, but at least + # one distinguishes color depth, where "3" -> "256-bit color". FORCE_COLOR: 3 jobs: @@ -37,8 +39,13 @@ jobs: python-version: ${{ matrix.python-version }} allow-prereleases: true + - name: Setup uv + uses: yezz123/setup-uv@v4 + with: + uv-venv: ".venv" + - name: Install nox - run: pip install nox + run: uv pip install nox - name: Test setuptools run: nox -s 'tests(setuptools, novcs)' -s 'tests(setuptools, vcs)' @@ -97,55 +104,68 @@ jobs: steps: - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + allow-prereleases: true + + - name: Setup uv + uses: yezz123/setup-uv@v4 + with: + uv-venv: ".venv" + + - name: Install nox + run: uv pip install nox + - name: Test setuptools run: | - pipx run nox -s 'nox(setuptools, vcs)' - pipx run nox -s 'nox(setuptools, vcs)' -- docs + nox -s 'nox(setuptools, vcs)' + nox -s 'nox(setuptools, vcs)' -- docs - name: Test pybind11 run: | - pipx run nox -s 'nox(pybind11, vcs)' - pipx run nox -s 'nox(pybind11, vcs)' -- docs + nox -s 'nox(pybind11, vcs)' + nox -s 'nox(pybind11, vcs)' -- docs - name: Test scikit-build run: | - pipx run nox -s 'nox(skbuild, vcs)' - pipx run nox -s 'nox(skbuild, vcs)' -- docs + nox -s 'nox(skbuild, vcs)' + nox -s 'nox(skbuild, vcs)' -- docs - name: Test poetry run: | - pipx run nox -s 'nox(poetry, novcs)' - pipx run nox -s 'nox(poetry, novcs)' -- docs + nox -s 'nox(poetry, novcs)' + nox -s 'nox(poetry, novcs)' -- docs - name: Test flit run: | - pipx run nox -s 'nox(flit, novcs)' - pipx run nox -s 'nox(flit, novcs)' -- docs + nox -s 'nox(flit, novcs)' + nox -s 'nox(flit, novcs)' -- docs - name: Test pdm run: | - pipx run nox -s 'nox(pdm, vcs)' - pipx run nox -s 'nox(pdm, vcs)' -- docs + nox -s 'nox(pdm, vcs)' + nox -s 'nox(pdm, vcs)' -- docs - name: Test whey run: | - pipx run nox -s 'nox(whey, novcs)' - pipx run nox -s 'nox(whey, novcs)' -- docs + nox -s 'nox(whey, novcs)' + nox -s 'nox(whey, novcs)' -- docs - name: Test maturin run: | - pipx run nox -s 'nox(maturin, novcs)' - pipx run nox -s 'nox(maturin, novcs)' -- docs + nox -s 'nox(maturin, novcs)' + nox -s 'nox(maturin, novcs)' -- docs - name: Test hatch run: | - pipx run nox -s 'nox(hatch, vcs)' - pipx run nox -s 'nox(hatch, vcs)' -- docs + nox -s 'nox(hatch, vcs)' + nox -s 'nox(hatch, vcs)' -- docs - name: Test setuptools PEP 621 run: | - pipx run nox -s 'nox(setuptools621, vcs)' - pipx run nox -s 'nox(setuptools621, vcs)' -- docs + nox -s 'nox(setuptools621, vcs)' + nox -s 'nox(setuptools621, vcs)' -- docs - name: Activate MSVC for Meson if: runner.os == 'Windows' @@ -153,8 +173,8 @@ jobs: - name: Test meson-python run: | - pipx run nox -s 'nox(mesonpy, novcs)' - pipx run nox -s 'nox(mesonpy, novcs)' -- docs + nox -s 'nox(mesonpy, novcs)' + nox -s 'nox(mesonpy, novcs)' -- docs dist: name: Distribution build diff --git a/.github/workflows/reusable-rr-tests.yml b/.github/workflows/reusable-rr-tests.yml index 1153ffbb..39348039 100644 --- a/.github/workflows/reusable-rr-tests.yml +++ b/.github/workflows/reusable-rr-tests.yml @@ -4,6 +4,8 @@ on: workflow_call: env: + # Many color libraries just need this to be set to any value, but at least + # one distinguishes color depth, where "3" -> "256-bit color". FORCE_COLOR: 3 jobs: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 133e0aee..0dd8d474 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -7,7 +7,7 @@ exclude: "^({{cookiecutter\\.project_name}}|hooks/pre_gen_project.py$)" repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: "v4.5.0" + rev: "v4.6.0" hooks: - id: check-added-large-files - id: check-case-conflict @@ -29,7 +29,7 @@ repos: additional_dependencies: [black==24.*] - repo: https://github.com/astral-sh/ruff-pre-commit - rev: "v0.3.0" + rev: "v0.4.1" hooks: - id: ruff args: ["--fix", "--show-fixes"] @@ -43,7 +43,7 @@ repos: - id: rst-inline-touching-normal - repo: https://github.com/pre-commit/mirrors-mypy - rev: "v1.8.0" + rev: "v1.9.0" hooks: - id: mypy files: "(src|tests)" @@ -52,7 +52,7 @@ repos: - click - markdown-it-py - pytest - - repo-review + - repo-review>=0.10.6 - rich - tomli - types-PyYAML diff --git a/docs/_includes/interactive_repo_review.html b/docs/_includes/interactive_repo_review.html index 041bf60e..f0ced0ba 100644 --- a/docs/_includes/interactive_repo_review.html +++ b/docs/_includes/interactive_repo_review.html @@ -22,7 +22,7 @@ deps={[ "repo-review~=0.10.0", "sp-repo-review==2024.03.10", - "validate-pyproject-schema-store==2024.03.11", + "validate-pyproject-schema-store==2024.04.20", "validate-pyproject[all]~=0.16.0", ]} />, diff --git a/docs/pages/guides/coverage.md b/docs/pages/guides/coverage.md index 21fc93e5..4c87d547 100644 --- a/docs/pages/guides/coverage.md +++ b/docs/pages/guides/coverage.md @@ -91,7 +91,7 @@ enough for a simple testing suite, can be written as follows: ```yaml - name: Upload coverage report - uses: codecov/codecov-action@v4.1.0 + uses: codecov/codecov-action@v4.3.0 with: token: ${{ secrets.CODECOV_TOKEN }} ``` diff --git a/docs/pages/guides/gha_basic.md b/docs/pages/guides/gha_basic.md index 68b31203..9eb62462 100644 --- a/docs/pages/guides/gha_basic.md +++ b/docs/pages/guides/gha_basic.md @@ -261,12 +261,21 @@ And many other useful ones: built-in caching. - [conda-incubator/setup-miniconda](https://github.com/conda-incubator/setup-miniconda): Setup conda or mamba on GitHub Actions. +- [prefix-dev/setup-pixi](https://github.com/prefix-dev/setup-pixi): Set up pixi + and install your environment(s). Try `cache: false` if saving/loading the + cache is slow. - [ruby/setup-ruby](https://github.com/ruby/setup-ruby): Setup Ruby if you need it for something. - [peter-evans/create-pull-request](https://github.com/peter-evans/create-pull-request): Make a new PR with the current changes (more options than just using `gh`). You can even auto-merge PRs with `run: gh pr merge --merge --auto "1"` afterwards. +- [yezz123/setup-uv](https://github.com/yezz123/setup-uv): Set up `uv`. Has a + handy `uv-venv` option that will also set up and activate a virtual + environment for you. +- [gautamkrishnar/keepalive-workflow](https://github.com/gautamkrishnar/keepalive-workflow): + Keep GitHub actions alive for more than 60 days. Not usually needed if you've + set up the other suggestions here, like dependabot and pre-commit. A couple more from Python developers; note these do not provide `vX` moving tags like the official actions and most other actions, but instead have `release/vX` @@ -276,6 +285,8 @@ branches that you can use. Publish Python packages to PyPI. Supports trusted publisher deployment. - [re-actors/alls-green](https://github.com/re-actors/alls-green): Tooling to check to see if all jobs passed (supports allowed failures, too). +- [sigstore/gh-action-sigstore-python](https://github.com/sigstore/gh-action-sigstore-python): + Signing files in GitHub Actions with sigstore. There are also a few useful tools installed which can really simplify your workflow or adding custom actions. This includes system package managers (like @@ -645,7 +656,7 @@ configure Pages. ```yaml - name: Setup Pages id: pages - uses: actions/configure-pages@v4 + uses: actions/configure-pages@v5 ``` {% raw %} diff --git a/docs/pages/guides/gha_wheels.md b/docs/pages/guides/gha_wheels.md index ecf95c65..52409e6d 100644 --- a/docs/pages/guides/gha_wheels.md +++ b/docs/pages/guides/gha_wheels.md @@ -110,7 +110,7 @@ build_wheels: fetch-depth: 0 submodules: true - - uses: pypa/cibuildwheel@v2.16 + - uses: pypa/cibuildwheel@v2.17 - name: Upload wheels uses: actions/upload-artifact@v4 diff --git a/docs/pages/guides/packaging_compiled.md b/docs/pages/guides/packaging_compiled.md index fdb93876..3d76df57 100644 --- a/docs/pages/guides/packaging_compiled.md +++ b/docs/pages/guides/packaging_compiled.md @@ -225,8 +225,7 @@ PYBIND11_MODULE(_core, m) { Some other explanation about the add function. )pbdoc"); - m.def( - "subtract", [](int i, int j) { return i - j; }, R"pbdoc( + m.def("subtract", [](int i, int j) { return i - j; }, R"pbdoc( Subtract two numbers Some other explanation about the subtract function. )pbdoc"); @@ -267,8 +266,7 @@ PYBIND11_MODULE(_core, m) { Some other explanation about the add function. )pbdoc"); - m.def( - "subtract", [](int i, int j) { return i - j; }, R"pbdoc( + m.def("subtract", [](int i, int j) { return i - j; }, R"pbdoc( Subtract two numbers Some other explanation about the subtract function. )pbdoc"); diff --git a/docs/pages/guides/style.md b/docs/pages/guides/style.md index 46756bbc..72110fbd 100644 --- a/docs/pages/guides/style.md +++ b/docs/pages/guides/style.md @@ -31,7 +31,7 @@ options: ```yaml repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: "v4.5.0" + rev: "v4.6.0" hooks: - id: check-added-large-files - id: check-case-conflict @@ -111,7 +111,7 @@ Here is the snippet to add the formatter to your `.pre-commit-config.yml` ```yaml - repo: https://github.com/astral-sh/ruff-pre-commit - rev: "v0.3.0" + rev: "v0.4.1" hooks: # id: ruff would go here if using both - id: ruff-format @@ -141,7 +141,7 @@ Here is the snippet to add Black to your `.pre-commit-config.yml`: ```yaml - repo: https://github.com/psf/black-pre-commit-mirror - rev: "24.2.0" + rev: "24.4.0" hooks: - id: black ``` @@ -201,7 +201,7 @@ pre-commit hook. ```yaml - repo: https://github.com/astral-sh/ruff-pre-commit - rev: "v0.3.0" + rev: "v0.4.1" hooks: - id: ruff args: ["--fix", "--show-fixes"] @@ -490,7 +490,7 @@ when clearly better (please always use them, they are faster) if you set ```yaml - repo: https://github.com/asottile/pyupgrade - rev: "v3.15.1" + rev: "v3.15.2" hooks: - id: pyupgrade args: ["--py38-plus"] @@ -535,7 +535,7 @@ The MyPy addition for pre-commit: ```yaml - repo: https://github.com/pre-commit/mirrors-mypy - rev: "v1.8.0" + rev: "v1.9.0" hooks: - id: mypy files: src @@ -582,7 +582,7 @@ command line. `strict = true` is now allowed in config files, too The extra strict options shown above, like `warn_unreachable` {% rr MY103 %}, and `ignore-without-code` {% rr MY104 %}, `redundant-expr` {% rr MY105 %}, and `truthy-bool` {% rr MY106 %} can trigger too often (like on `sys.platform` -checks) and have to be ignored occasionally, but can find some signifiant logic +checks) and have to be ignored occasionally, but can find some significant logic errors in your typing. [mypy page]: {% link pages/guides/mypy.md %} @@ -747,7 +747,7 @@ following pre-commit config: ```yaml - repo: https://github.com/pre-commit/mirrors-clang-format - rev: "v17.0.6" + rev: "v18.1.4" hooks: - id: clang-format types_or: [c++, c, cuda] @@ -764,7 +764,7 @@ If you have shell scripts, you can protect against common mistakes using ```yaml - repo: https://github.com/shellcheck-py/shellcheck-py - rev: "v0.9.0.6" + rev: "v0.10.0.1" hooks: - id: shellcheck ``` @@ -824,7 +824,7 @@ schemas, and you can load them via URL. It work on JSON, YAML, and TOML. ```yaml - repo: https://github.com/python-jsonschema/check-jsonschema - rev: "0.28.0" + rev: "0.28.2" hooks: - id: check-dependabot - id: check-github-workflows diff --git a/docs/pages/guides/tasks.md b/docs/pages/guides/tasks.md index d6f43a4b..8c2c8d90 100644 --- a/docs/pages/guides/tasks.md +++ b/docs/pages/guides/tasks.md @@ -75,16 +75,16 @@ On GitHub Actions or Azure, pipx is available by default, so you should use action: ```yaml -- uses: wntrblm/nox@2024.03.02 +- uses: wntrblm/nox@2024.04.15 ``` You can now access all current versions of Python from nox. At least in GitHub Actions, you should add `--forcecolor` to your nox runs to get color output in -your logs, or set `env: FORCE_COLOR: 3`. If you'd like to customise the versions -of Python prepared for you, then use input like this: +your logs, or set `env: FORCE_COLOR: 3`[^force_color]. If you'd like to +customize the versions of Python prepared for you, then use input like this: ```yaml -- uses: wntrblm/nox@2024.03.02 +- uses: wntrblm/nox@2024.04.15 with: python-versions: "3.8, 3.9, 3.10, 3.11, 3.12, pypy-3.9, pypy-3.10" ``` @@ -314,6 +314,36 @@ def build(session: nox.Session) -> None: +(Removing the build directory is helpful for setuptools) + +### Faster with uv + +The [uv](https://github.com/astral-sh/uv) project is a Rust reimplementation of +pip, pip-tools, and venv that is very, very fast. You can tell nox to use `uv` +if it is on your system by adding the following to your `noxfile.py`: + +```python +nox.needs_version = ">=2024.3.2" +nox.options.default_venv_backend = "uv|virtualenv" +``` + +You can install `uv` with `pipx`, `brew`, etc. If you want to use uv in GitHub +Actions, one way is to use this: + +```yaml +- name: Setup uv + uses: yezz123/setup-uv@v4 +``` + +You do not need to set `with: uv-venv: ".venv"` for `nox` to be able to use +`uv`. + +Check your jobs with `uv`; most things do not need to change. The main +difference is `uv` doesn't install `pip` unless you ask it to. If you want to +interact with uv, nox might be getting uv from it's environment instead of the +system environment, so you can install `uv` if `shutil.which("uv")` returns +`None`. + ### Examples A standard @@ -341,3 +371,9 @@ using nox include [pip](https://github.com/pypa/pip/blob/main/noxfile.py), [manylinux](https://github.com/pypa/manylinux/blob/main/noxfile.py), [packaging](https://github.com/pypa/packaging/blob/main/noxfile.py), and [packaging.python.org](https://github.com/pypa/packaging.python.org/blob/main/noxfile.py). + +[^force_color]: + Many color libraries just need `FORCE_COLOR` to be set to any value, but at + least [one](https://pypi.org/project/plumbum/) distinguishes color depth, + where "3" -> "256-bit color". For many use cases, using `FORCE_COLOR: 1` is + fine. diff --git a/docs/pages/tutorials/dev-environment.md b/docs/pages/tutorials/dev-environment.md index 905eb501..2265a387 100644 --- a/docs/pages/tutorials/dev-environment.md +++ b/docs/pages/tutorials/dev-environment.md @@ -87,6 +87,16 @@ leave the environment (or just close your shell). > If you like a different shell, like fish, there are several `activate` > scripts; the default one expects a bash-like shell. +{: .note-title } + +> Fast alternative +> +> You can also consider the [uv][] package, which is much, much faster version +> of pip and venv implemented in Rust. Just put `uv` in front of the commands +> you'd normally use; as long as you use venvs, it should be nearly the same. + +[uv]: https://github.com/astral-sh/uv + ### Option 2: Using conda You can also develop in conda. This is an especially good option if: @@ -113,6 +123,16 @@ conda activate env_name To deactivate, use `conda deactivate`, or leave your shell. +> Modern faster alternative +> +> You can also consider the [pixi][] package, which is much, much faster version +> of conda implemented in Rust. It has been completely redesigned to work around +> projects with a `pixi.toml` file instead of global environments. It's a new +> way to work (more similar to pdm/hatch/poetry from Python), but very powerful +> if you learn it. + +[pixi]: https://pixi.sh + ## Choosing an Editor Any plain text editor will serve our purposes for this guide. Bare bones editors diff --git a/noxfile.py b/noxfile.py index 7232fcfb..be943dde 100644 --- a/noxfile.py +++ b/noxfile.py @@ -24,8 +24,9 @@ import nox -nox.needs_version = ">=2022.1.7" +nox.needs_version = ">=2024.3.2" nox.options.sessions = ["rr_lint", "rr_tests", "rr_pylint", "readme"] +nox.options.default_venv_backend = "uv|virtualenv" DIR = Path(__file__).parent.resolve() with DIR.joinpath("cookiecutter.json").open() as f: diff --git a/pyproject.toml b/pyproject.toml index 27ac7fe9..0c34dc01 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -32,6 +32,7 @@ dynamic = ["version", "readme"] dependencies = [ "pyyaml", "repo-review", + "tomli; python_version<'3.11'", ] [project.optional-dependencies] @@ -40,6 +41,7 @@ cli = [ ] test = [ "pytest >=7", + "repo-review >=0.10.6", ] dev = [ "pytest >=7", diff --git a/src/sp_repo_review/checks/pyproject.py b/src/sp_repo_review/checks/pyproject.py index 2dc68d4b..607ebec5 100644 --- a/src/sp_repo_review/checks/pyproject.py +++ b/src/sp_repo_review/checks/pyproject.py @@ -89,7 +89,10 @@ def check(pyproject: dict[str, Any]) -> bool: ``` """ options = pyproject["tool"]["pytest"]["ini_options"] - return "minversion" in options and int(options["minversion"].split(".")[0]) >= 6 + return ( + "minversion" in options + and int(str(options["minversion"]).split(".")[0]) >= 6 + ) class PP303(PyProject): @@ -189,7 +192,7 @@ def check(pyproject: dict[str, Any]) -> bool: ```toml [tool.pytest.ini_options] - addops = ["-ra", "--strict-config", "--strict-markers"] + addopts = ["-ra", "--strict-config", "--strict-markers"] ``` """ options = pyproject["tool"]["pytest"]["ini_options"] @@ -210,7 +213,7 @@ def check(pyproject: dict[str, Any]) -> bool: ```toml [tool.pytest.ini_options] - addops = ["-ra", "--strict-config", "--strict-markers"] + addopts = ["-ra", "--strict-config", "--strict-markers"] ``` """ options = pyproject["tool"]["pytest"]["ini_options"] diff --git a/src/sp_repo_review/checks/ruff.py b/src/sp_repo_review/checks/ruff.py index b7ae9945..2ec2d216 100644 --- a/src/sp_repo_review/checks/ruff.py +++ b/src/sp_repo_review/checks/ruff.py @@ -73,9 +73,12 @@ def check(pyproject: dict[str, Any], ruff: dict[str, Any]) -> bool | str: """ match pyproject: + case { + "project": {"requires-python": str()}, + "tool": {"ruff": {"target-version": object()}}, + }: + return "You have both Ruff's `target-version` and `project.requires-python`. You only need the latter." case {"project": {"requires-python": str()}}: - if "target-version" in ruff: - return "You have both Ruff's `target-version` and `project.requires-python`. You only need the later." return True case _: return "target-version" in ruff diff --git a/tests/test_pyproject.py b/tests/test_pyproject.py new file mode 100644 index 00000000..342e8e17 --- /dev/null +++ b/tests/test_pyproject.py @@ -0,0 +1,94 @@ +from repo_review.testing import compute_check, toml_loads + + +def test_PP002_okay(): + toml = toml_loads(""" + [build-system] + requires = ["setuptools"] + build-backend = "setuptools.build_meta" + """) + assert compute_check("PP002", pyproject=toml).result + + +def test_PP002_not_list(): + toml = toml_loads(""" + [build-system] + requires = "setuptools" + build-backend = "setuptools.build_meta" + """) + assert not compute_check("PP002", pyproject=toml).result + + +def test_PP002_missing(): + toml = toml_loads(""" + [project] + name = "hi" + version = "1.0.0" + """) + assert not compute_check("PP002", pyproject=toml).result + + +def test_PP003_no_wheel(): + toml = toml_loads(""" + [build-system] + requires = ["setuptools"] + build-backend = "setuptools.build_meta" + """) + assert compute_check("PP003", pyproject=toml).result + + +def test_PP003_has_wheel(): + toml = toml_loads(""" + [build-system] + requires = ["setuptools", "wheel"] + build-backend = "setuptools.build_meta" + """) + assert not compute_check("PP003", pyproject=toml).result + + +def test_PP302_okay_intstr(): + toml = toml_loads(""" + [tool.pytest.ini_options] + minversion = "7" + """) + assert compute_check("PP302", pyproject=toml).result + + +def test_PP302_okay_verstr(): + toml = toml_loads(""" + [tool.pytest.ini_options] + minversion = "7.0.2" + """) + assert compute_check("PP302", pyproject=toml).result + + +def test_PP302_okay_rawint(): + toml = toml_loads(""" + [tool.pytest.ini_options] + minversion = 7 + """) + assert compute_check("PP302", pyproject=toml).result + + +def test_PP302_okay_rawfloat(): + toml = toml_loads(""" + [tool.pytest.ini_options] + minversion = 7.0 + """) + assert compute_check("PP302", pyproject=toml).result + + +def test_PP302_missing(): + toml = toml_loads(""" + [tool.pytest] + ini_options = {} + """) + assert not compute_check("PP302", pyproject=toml).result + + +def test_PP302_too_low(): + toml = toml_loads(""" + [tool.pytest.ini_options] + minversion = "5" + """) + assert not compute_check("PP302", pyproject=toml).result diff --git a/tests/test_ruff.py b/tests/test_ruff.py new file mode 100644 index 00000000..ccd39c8b --- /dev/null +++ b/tests/test_ruff.py @@ -0,0 +1,35 @@ +from repo_review.testing import compute_check, toml_loads + + +def test_rf003_with_rp(): + toml = toml_loads(""" + project.requires-python = ">=3.12" + tool.ruff.anything = "1" + """) + assert compute_check("RF002", pyproject=toml, ruff=toml["tool"]["ruff"]).result + + +def test_rf003_no_rp(): + toml = toml_loads(""" + project.name = "hi" + tool.ruff.target-version = "3.12" + """) + assert compute_check("RF002", pyproject=toml, ruff=toml["tool"]["ruff"]).result + + +def test_rf003_both(): + toml = toml_loads(""" + project.requires-python = ">=3.12" + tool.ruff.target-version = "3.12" + """) + check_result = compute_check("RF002", pyproject=toml, ruff=toml["tool"]["ruff"]) + assert check_result.result is False + + +def test_rf003_split_ok(): + toml = toml_loads(""" + project.requires-python = ">=3.12" + """) + assert compute_check( + "RF002", pyproject=toml, ruff={"target-version": "3.12"} + ).result diff --git a/{{cookiecutter.project_name}}/.github/workflows/ci.yml b/{{cookiecutter.project_name}}/.github/workflows/ci.yml index 344cc11c..6423c6eb 100644 --- a/{{cookiecutter.project_name}}/.github/workflows/ci.yml +++ b/{{cookiecutter.project_name}}/.github/workflows/ci.yml @@ -12,6 +12,8 @@ concurrency: cancel-in-progress: true env: + # Many color libraries just need this to be set to any value, but at least + # one distinguishes color depth, where "3" -> "256-bit color". FORCE_COLOR: 3 jobs: @@ -74,6 +76,6 @@ jobs: --durations=20 - name: Upload coverage report - uses: codecov/codecov-action@v4.1.0 + uses: codecov/codecov-action@v4.3.0 with: token: {% raw %}${{ secrets.CODECOV_TOKEN }}{% endraw %} diff --git a/{{cookiecutter.project_name}}/.github/workflows/{% if cookiecutter.__type!='compiled' %}cd.yml{% endif %} b/{{cookiecutter.project_name}}/.github/workflows/{% if cookiecutter.__type!='compiled' %}cd.yml{% endif %} index 98d8d8b2..4538a63e 100644 --- a/{{cookiecutter.project_name}}/.github/workflows/{% if cookiecutter.__type!='compiled' %}cd.yml{% endif %} +++ b/{{cookiecutter.project_name}}/.github/workflows/{% if cookiecutter.__type!='compiled' %}cd.yml{% endif %} @@ -15,6 +15,8 @@ concurrency: cancel-in-progress: true env: + # Many color libraries just need this to be set to any value, but at least + # one distinguishes color depth, where "3" -> "256-bit color". FORCE_COLOR: 3 jobs: diff --git a/{{cookiecutter.project_name}}/.github/workflows/{% if cookiecutter.__type=='compiled' %}cd.yml{% endif %} b/{{cookiecutter.project_name}}/.github/workflows/{% if cookiecutter.__type=='compiled' %}cd.yml{% endif %} index 5124675e..1cf94c06 100644 --- a/{{cookiecutter.project_name}}/.github/workflows/{% if cookiecutter.__type=='compiled' %}cd.yml{% endif %} +++ b/{{cookiecutter.project_name}}/.github/workflows/{% if cookiecutter.__type=='compiled' %}cd.yml{% endif %} @@ -11,6 +11,8 @@ concurrency: cancel-in-progress: true env: + # Many color libraries just need this to be set to any value, but at least + # one distinguishes color depth, where "3" -> "256-bit color". FORCE_COLOR: 3 jobs: @@ -43,7 +45,7 @@ jobs: with: fetch-depth: 0 - - uses: pypa/cibuildwheel@v2.16 + - uses: pypa/cibuildwheel@v2.17 - name: Upload wheels uses: actions/upload-artifact@v4 diff --git a/{{cookiecutter.project_name}}/.pre-commit-config.yaml b/{{cookiecutter.project_name}}/.pre-commit-config.yaml index 4a4ea473..40bf3030 100644 --- a/{{cookiecutter.project_name}}/.pre-commit-config.yaml +++ b/{{cookiecutter.project_name}}/.pre-commit-config.yaml @@ -10,7 +10,7 @@ repos: additional_dependencies: [black==24.*] - repo: https://github.com/pre-commit/pre-commit-hooks - rev: "v4.5.0" + rev: "v4.6.0" hooks: - id: check-added-large-files - id: check-case-conflict @@ -40,7 +40,7 @@ repos: args: [--prose-wrap=always] - repo: https://github.com/astral-sh/ruff-pre-commit - rev: "v0.3.0" + rev: "v0.4.1" hooks: - id: ruff args: ["--fix", "--show-fixes"] @@ -59,7 +59,7 @@ repos: {%- if cookiecutter.backend in ["pybind11", "skbuild", "mesonpy"] %} - repo: https://github.com/pre-commit/mirrors-clang-format - rev: "v17.0.6" + rev: "v18.1.4" hooks: - id: clang-format types_or: [c++, c, cuda] @@ -67,7 +67,7 @@ repos: {%- endif %} - repo: https://github.com/pre-commit/mirrors-mypy - rev: "v1.8.0" + rev: "v1.9.0" hooks: - id: mypy files: src|tests @@ -81,7 +81,7 @@ repos: - id: codespell - repo: https://github.com/shellcheck-py/shellcheck-py - rev: "v0.9.0.6" + rev: "v0.10.0.1" hooks: - id: shellcheck @@ -118,7 +118,7 @@ repos: additional_dependencies: ["validate-pyproject-schema-store[all]"] - repo: https://github.com/python-jsonschema/check-jsonschema - rev: "0.28.0" + rev: "0.28.2" hooks: {%- if cookiecutter.__ci == "github" %} - id: check-dependabot diff --git a/{{cookiecutter.project_name}}/noxfile.py b/{{cookiecutter.project_name}}/noxfile.py index 337a63c6..1538cedc 100644 --- a/{{cookiecutter.project_name}}/noxfile.py +++ b/{{cookiecutter.project_name}}/noxfile.py @@ -13,7 +13,9 @@ {% endif -%} +nox.needs_version = ">=2024.3.2" nox.options.sessions = ["lint", "pylint", "tests"] +nox.options.default_venv_backend = "uv|virtualenv" @nox.session diff --git a/{{cookiecutter.project_name}}/src/{% if cookiecutter.backend in ['pybind11','skbuild','mesonpy'] %}main.cpp{% endif %} b/{{cookiecutter.project_name}}/src/{% if cookiecutter.backend in ['pybind11','skbuild','mesonpy'] %}main.cpp{% endif %} index 2b8ed183..d570cd06 100644 --- a/{{cookiecutter.project_name}}/src/{% if cookiecutter.backend in ['pybind11','skbuild','mesonpy'] %}main.cpp{% endif %} +++ b/{{cookiecutter.project_name}}/src/{% if cookiecutter.backend in ['pybind11','skbuild','mesonpy'] %}main.cpp{% endif %} @@ -20,8 +20,7 @@ PYBIND11_MODULE(_core, m) { Some other explanation about the add function. )pbdoc"); - m.def( - "subtract", [](int i, int j) { return i - j; }, R"pbdoc( + m.def("subtract", [](int i, int j) { return i - j; }, R"pbdoc( Subtract two numbers Some other explanation about the subtract function. )pbdoc");