From e22be80e6fa0a2607c11663472a16986190ec7a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bern=C3=A1t=20G=C3=A1bor?= Date: Sat, 7 Sep 2024 16:40:35 -0700 Subject: [PATCH] Declare 3.13 support (#48) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Declare 3.13 support Signed-off-by: Bernát Gábor * Cache tarpaulin install Signed-off-by: Bernát Gábor --------- Signed-off-by: Bernát Gábor --- .github/SECURITY.md | 2 +- .github/workflows/check.yml | 42 ++++++++++++++++------------------- .github/workflows/release.yml | 12 +++++----- .pre-commit-config.yaml | 19 +++++++++++----- CONTRIBUTING.md | 3 ++- pyproject.toml | 8 +++++-- tox.ini | 27 +++++++++++----------- 7 files changed, 60 insertions(+), 53 deletions(-) diff --git a/.github/SECURITY.md b/.github/SECURITY.md index ca4dfe9..f9506b7 100644 --- a/.github/SECURITY.md +++ b/.github/SECURITY.md @@ -3,7 +3,7 @@ ## Supported Versions | Version | Supported | -|---------|--------------------| +| ------- | ------------------ | | 1.0 + | :white_check_mark: | | < 1.0 | :x: | diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index fee86c9..100334c 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -2,8 +2,8 @@ name: Check on: workflow_dispatch: push: - branches: [ "main" ] - tags: [ "*" ] + branches: ["main"] + tags: ["*"] pull_request: concurrency: group: check-${{ github.ref }} @@ -16,6 +16,7 @@ jobs: fail-fast: false matrix: py: + - "3.13" - "3.12" - "3.11" - "3.10" @@ -32,27 +33,21 @@ jobs: python-version: "3.12" - name: install tox-uv run: python -m pip install tox-uv - - uses: actions/checkout@v4 - - run: rustup toolchain install stable --profile minimal - - uses: Swatinem/rust-cache@v2 - - name: install tarpaulin - run: cargo install cargo-tarpaulin + - uses: moonrepo/setup-rust@v1 + with: + cache-base: main + bins: cargo-tarpaulin + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: setup python for test ${{ matrix.py }} uses: actions/setup-python@v5 with: python-version: ${{ matrix.py }} - - name: Pick environment to run - run: | - import codecs; import os; import sys - env = "TOXENV=py{}{}\n".format(*sys.version_info[0:2]) - print("Picked:\n{}for{}".format(env, sys.version)) - with codecs.open(os.environ["GITHUB_ENV"], "a", "utf-8") as file_handler: - file_handler.write(env) - shell: python + allow-prereleases: true - name: setup test suite - run: tox -vv --notest + run: tox run -vv --notest --skip-missing-interpreters false -e ${{ matrix.py }} - name: run test suite - run: tox --skip-pkg-install + run: tox run --skip-pkg-install -e ${{ matrix.py }} check: name: tox env ${{ matrix.tox_env }} @@ -72,9 +67,10 @@ jobs: python-version: "3.12" - name: install tox-uv run: python -m pip install tox-uv - - run: rustup toolchain install stable --profile minimal - - uses: Swatinem/rust-cache@v2 - - name: run check for ${{ matrix.tox_env }} - run: python -m tox -e ${{ matrix.tox_env }} - env: - UPGRADE_ADVISORY: "yes" + - uses: moonrepo/setup-rust@v1 + with: + cache-base: main + - name: Setup test suite + run: tox -vv --notest --skip-missing-interpreters false -e ${{ matrix.tox_env }} + - name: Run test suite + run: tox --skip-pkg-install -e ${{ matrix.tox_env }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 11d3b1c..fb345dd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,8 +2,8 @@ name: Build on: workflow_dispatch: push: - branches: [ "main" ] - tags: [ "*" ] + branches: ["main"] + tags: ["*"] pull_request: schedule: - cron: "0 8 * * *" @@ -47,7 +47,7 @@ jobs: with: target: ${{ matrix.platform.target }} args: --release --out dist --interpreter ${{ matrix.platform.interpreter || '3.8' }} - sccache: 'true' + sccache: "true" manylinux: ${{ matrix.platform.manylinux || 'auto' }} - name: Upload wheels uses: actions/upload-artifact@v4 @@ -71,7 +71,7 @@ jobs: with: target: ${{ matrix.platform.target }} args: --release --out dist --interpreter ${{ matrix.platform.interpreter || '3.8' }} - sccache: 'true' + sccache: "true" - name: Upload wheels uses: actions/upload-artifact@v4 with: @@ -94,7 +94,7 @@ jobs: with: target: ${{ matrix.platform.target }} args: --release --out dist --interpreter "3.8 pypy3.8 pypy3.9 pypy3.10" - sccache: 'true' + sccache: "true" - name: Upload wheels uses: actions/upload-artifact@v4 with: @@ -125,7 +125,7 @@ jobs: permissions: id-token: write if: "startsWith(github.ref, 'refs/tags/')" - needs: [ linux, windows, macos, sdist ] + needs: [linux, windows, macos, sdist] steps: - uses: actions/download-artifact@v4 - name: Publish to PyPI diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5bd8911..d42a3ab 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -8,27 +8,34 @@ repos: rev: 0.29.2 hooks: - id: check-github-workflows - args: [ "--verbose" ] + args: ["--verbose"] - repo: https://github.com/codespell-project/codespell rev: v2.3.0 hooks: - id: codespell - args: [ "--write-changes" ] + additional_dependencies: ["tomli>=2.0.1"] - repo: https://github.com/tox-dev/tox-ini-fmt - rev: "1.3.1" + rev: "1.3.2" hooks: - id: tox-ini-fmt - args: [ "-p", "fix" ] + args: ["-p", "fix"] - repo: https://github.com/tox-dev/pyproject-fmt rev: "2.2.1" hooks: - id: pyproject-fmt - repo: https://github.com/astral-sh/ruff-pre-commit - rev: "v0.6.3" + rev: "v0.6.4" hooks: - id: ruff-format - id: ruff - args: [ "--fix", "--unsafe-fixes", "--exit-non-zero-on-fix" ] + args: ["--fix", "--unsafe-fixes", "--exit-non-zero-on-fix"] + - repo: https://github.com/rbubley/mirrors-prettier + rev: "v3.3.3" + hooks: + - id: prettier + additional_dependencies: + - prettier@3.3.3 + - "@prettier/plugin-xml@3.4.1" - repo: meta hooks: - id: check-hooks-apply diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d4b49ea..a90eb65 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -17,8 +17,8 @@ To work on the project: cargo test ``` - ## License + By contributing to pyproject-rust-format, you agree that your contributions will be licensed under the [MIT License](LICENSE). @@ -38,5 +38,6 @@ with a different PATH. To fix it, put the following in `.cargo/config.toml`: [env] PYO3_PYTHON = "./.venv/bin/python" ``` + And make sure you have a `.venv` folder with Python in it. This will ensure all runs use the same Python and don't reconfigure. diff --git a/pyproject.toml b/pyproject.toml index 92065cd..32c5bee 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [build-system] build-backend = "maturin" requires = [ - "maturin>=1.5.1", + "maturin>=1.7.1", ] [project] @@ -27,6 +27,7 @@ classifiers = [ "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", ] dynamic = [ "version", @@ -35,7 +36,7 @@ dependencies = [ ] optional-dependencies.test = [ "covdefaults>=2.3", - "pytest>=8.2", + "pytest>=8.3.2", "pytest-cov>=5", ] urls."Bug Tracker" = "https://github.com/tox-dev/pyproject-fmt-rust/issues" @@ -100,6 +101,9 @@ lint.preview = true builtin = "clear,usage,en-GB_to_en-US" count = true +[tool.pyproject-fmt] +max_supported_python = "3.13" + [tool.pytest] ini_options.testpaths = [ "tests", diff --git a/tox.ini b/tox.ini index afef20a..ad4ba8e 100644 --- a/tox.ini +++ b/tox.ini @@ -1,16 +1,18 @@ [tox] requires = tox>=4.2 + tox-uv>=1.11.3 env_list = fix - py312 - py311 - py310 - py39 - py38 type readme docs + 3.13 + 3.12 + 3.11 + 3.10 + 3.9 + 3.8 skip_missing_interpreters = true [testenv] @@ -37,16 +39,14 @@ allowlist_externals = description = run static analysis and style check using flake8 skip_install = true deps = - pre-commit>=3.7 + pre-commit-uv>=4.1 commands = pre-commit run --all-files --show-diff-on-failure [testenv:type] description = run type check on code base deps = - mypy==1.10 -set_env = - {tty:MYPY_FORCE_COLOR = 1} + mypy==1.11.2 commands = mypy src mypy tests @@ -55,10 +55,10 @@ commands = description = check that the long description is valid skip_install = true deps = - build[virtualenv]>=1.2.1 - twine>=5 + build[uv]>=1.2.2 + twine>=5.1.1 commands = - python -m build --sdist --wheel -o {envtmpdir} . + pyproject-build --installer uv --sdist --wheel -o {envtmpdir} . twine check {envtmpdir}/* [testenv:docs] @@ -76,6 +76,5 @@ extras = docs test commands = - python -m pip list --format=columns + uv pip tree python -c 'import sys; print(sys.executable)' -uv_seed = true