Skip to content

Commit

Permalink
[pre-commit.ci] pre-commit autoupdate (#150)
Browse files Browse the repository at this point in the history
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
pre-commit-ci[bot] committed Sep 16, 2024
1 parent 9371946 commit 302f383
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 89 deletions.
77 changes: 33 additions & 44 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,75 +19,64 @@ jobs:
strategy:
fail-fast: false
matrix:
os:
- windows-latest
- macos-latest
- ubuntu-latest
py:
- "3.13.0-beta.2"
- "3.13"
- "3.12"
- "3.11"
- "3.10"
- "3.9"
- "3.8"
os:
- ubuntu-latest
- windows-latest
- macos-latest
steps:
- name: Setup python for tox
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v2
with:
enable-cache: true
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: setup python for tox
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: install tox
run: uv pip install --system --python "3.12" tox-uv
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install tox-uv
run: python -m pip install tox-uv
- name: Setup python for test ${{ matrix.py }}
- name: setup python for test ${{ matrix.py }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.py }}
- name: Pick environment to run
run: |
import os; import platform; import sys; from pathlib import Path
env = f'TOXENV=py{"" if platform.python_implementation() == "CPython" else "py"}3{sys.version_info.minor}'
print(f"Picked: {env} for {sys.version} based of {sys.executable}")
with Path(os.environ["GITHUB_ENV"]).open("ta") as file_handler:
file_handler.write(env)
shell: python
- name: Setup test suite
run: tox -vv --notest
- name: Run test suite
run: tox --skip-pkg-install
env:
PYTEST_ADDOPTS: "-vv --durations=20"
CI_RUN: "yes"
DIFF_AGAINST: HEAD
allow-prereleases: true
- name: setup test suite
run: tox run -vv --notest --skip-missing-interpreters false -e ${{ matrix.py }}
- name: run test suite
run: tox run --skip-pkg-install -e ${{ matrix.py }}

check:
name: tox env ${{ matrix.tox_env }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
name: tox env ${{ matrix.tox_env }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
tox_env:
- type
- dev
- docs
- pkg_meta
os:
- ubuntu-latest
- windows-latest
exclude:
- { os: windows-latest, tox_env: pkg_meta }
- readme
steps:
- uses: actions/checkout@v4
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v2
with:
fetch-depth: 0
- name: Setup Python 3.12
enable-cache: true
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: setup Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install tox-uv
run: python -m pip install tox-uv
- name: Run check for ${{ matrix.tox_env }}
run: tox -e ${{ matrix.tox_env }}
env:
UPGRADE_ADVISORY: "yes"
- name: install tox
run: uv pip install --system --python "3.12" tox-uv
- name: setup test suite
run: tox run -vv --notest --skip-missing-interpreters false -e ${{ matrix.tox_env }}
- name: run test suite
run: tox run --skip-pkg-install -e ${{ matrix.tox_env }}
11 changes: 8 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,17 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install build
run: python -m pip install build
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v2
with:
enable-cache: true
github-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Build package
run: pyproject-build -s -w . -o dist
run: uv build --python "3.12" --sdist --wheel --out-dir dist .
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@v1.10.1
with:
attestations: true
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@ repos:
- id: codespell
additional_dependencies: ["tomli>=2.0.1"]
- repo: https://github.com/tox-dev/tox-ini-fmt
rev: "1.3.2"
rev: "1.4.0"
hooks:
- id: tox-ini-fmt
args: ["-p", "fix"]
- repo: https://github.com/tox-dev/pyproject-fmt
rev: "2.2.3"
hooks:
- id: pyproject-fmt
additional_dependencies: ["tox>=4.15.1"]
additional_dependencies: ["tox>=4.18.1"]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.6.4"
rev: "v0.6.5"
hooks:
- id: ruff-format
- id: ruff
Expand Down
17 changes: 9 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
build-backend = "hatchling.build"
requires = [
"hatch-vcs>=0.4",
"hatchling>=1.24.2",
"hatchling>=1.25",
]

[project]
Expand Down Expand Up @@ -51,15 +51,15 @@ dependencies = [
"tomli>=2.0.1; python_version<'3.11'",
]
optional-dependencies.docs = [
"furo>=2024.5.6",
"sphinx-autodoc-typehints>=2.2.1",
"furo>=2024.8.6",
"sphinx-autodoc-typehints>=2.4.1",
]
optional-dependencies.testing = [
"covdefaults>=2.3",
"pytest>=8.2.2",
"pytest>=8.3.3",
"pytest-cov>=5",
"pytest-mock>=3.14",
"setuptools>=70.1",
"setuptools>=75.1",
]
urls.Changelog = "https://github.com/tox-dev/pyproject-api/releases"
urls.Homepage = "https://pyproject-api.readthedocs.io"
Expand Down Expand Up @@ -87,6 +87,7 @@ lint.ignore = [
"CPY", # No copyright statements
"D203", # `one-blank-line-before-class` (D203) and `no-blank-line-before-class` (D211) are incompatible
"D212", # `multi-line-summary-first-line` (D212) and `multi-line-summary-second-line` (D213) are incompatible
"DOC", # no restructuredtext support
"INP001", # no implicit namespaces here
"ISC001", # Conflict with formatter
"S104", # Possible binding to all interface
Expand All @@ -103,13 +104,13 @@ lint.per-file-ignores."src/pyproject_api/_backend.pyi" = [
] # https://github.com/astral-sh/ruff/issues/10077
lint.per-file-ignores."tests/**/*.py" = [
"D", # don't care about documentation in tests
"FBT", # don"t care about booleans as positional arguments in tests
"FBT", # don't care about booleans as positional arguments in tests
"INP001", # no implicit namespace
"PLC2701", # private imports
"PLR0913", # too many positional arguments
"PLR0917", # too many positional arguments
"PLR2004", # Magic value used in comparison, consider replacing with a constant variable
"S101", # asserts allowed in tests...
"S101", # asserts allowed in tests
"S603", # `subprocess` call: check for execution of untrusted input
]
lint.isort = { known-first-party = [
Expand Down Expand Up @@ -146,7 +147,7 @@ run.plugins = [
]

[tool.mypy]
python_version = "3.11"
python_version = "3.12"
show_error_codes = true
strict = true
overrides = [
Expand Down
57 changes: 26 additions & 31 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,54 +1,50 @@
[tox]
requires =
tox>=4.2
tox>=4.18.1
tox-uv>=1.11.3
env_list =
fix
py313
py312
py311
py310
py39
py38
py37
3.13
3.12
3.11
3.10
3.9
3.8
type
docs
pkg_meta
readme
skip_missing_interpreters = true

[testenv]
description = run the tests with pytest under {envname}
description = run the tests with pytest under {env_name}
package = wheel
wheel_build_env = .pkg
extras =
testing
pass_env =
PYTEST_*
SSL_CERT_FILE
set_env =
COVERAGE_FILE = {env:COVERAGE_FILE:{toxworkdir}{/}.coverage.{envname}}
COVERAGE_FILE = {env:COVERAGE_FILE:{work_dir}{/}.coverage.{env_name}}
commands =
pytest {tty:--color=yes} {posargs: --no-cov-on-fail --cov-context=test \
--cov={envsitepackagesdir}{/}pyproject_api --cov={toxinidir}{/}tests --cov-config={toxinidir}{/}pyproject.toml \
--cov-report=term-missing:skip-covered --cov-report=html:{envtmpdir}{/}htmlcov \
--cov-report=xml:{toxworkdir}{/}coverage.{envname}.xml --junitxml={toxworkdir}{/}junit.{envname}.xml \
--cov={env_site_packages_dir}{/}pyproject_api --cov={tox_root}{/}tests --cov-config={tox_root}{/}pyproject.toml \
--cov-report=term-missing:skip-covered --cov-report=html:{env_tmp_dir}{/}htmlcov \
--cov-report=xml:{work_dir}{/}coverage.{env_name}.xml --junitxml={work_dir}{/}junit.{env_name}.xml \
tests}
labels = test

[testenv:fix]
description = run formatter and linters
skip_install = true
deps =
pre-commit>=3.7.1
pass_env =
{[testenv]passenv}
PROGRAMDATA
pre-commit-uv>=4.1.1
commands =
pre-commit run --all-files --show-diff-on-failure {tty:--color=always} {posargs}

[testenv:type]
description = run type check on code base
deps =
mypy==1.10
mypy==1.11.2
set_env =
{tty:MYPY_FORCE_COLOR = 1}
commands =
Expand All @@ -60,20 +56,20 @@ description = build documentation
extras =
docs
commands =
sphinx-build -d "{envtmpdir}{/}doctree" docs "{toxworkdir}{/}docs_out" --color -b html {posargs} -W
python -c 'print(r"documentation available under file://{toxworkdir}{/}docs_out{/}index.html")'
sphinx-build -d "{env_tmp_dir}{/}doc_tree" docs "{work_dir}{/}docs_out" --color -b html {posargs} -W
python -c 'print(r"documentation available under file://{work_dir}{/}docs_out{/}index.html")'

[testenv:pkg_meta]
[testenv:readme]
description = check that the long description is valid
skip_install = true
deps =
build[virtualenv]>=1.2.1
check-wheel-contents>=0.6
twine>=5.1
twine>=5.1.1
uv>=0.4.10
commands =
python -m build -o {envtmpdir} -s -w .
twine check --strict {envtmpdir}{/}*
check-wheel-contents --no-config {envtmpdir}
uv build --sdist --wheel --out-dir {env_tmp_dir} .
twine check {env_tmp_dir}{/}*
check-wheel-contents --no-config {env_tmp_dir}

[testenv:dev]
description = dev environment with all deps at {envdir}
Expand All @@ -82,6 +78,5 @@ extras =
docs
testing
commands =
python -m pip list --format=columns
python -c "print(r'{envpython}')"
uv_seed = true
uv pip tree
python -c "print(r'{env_python}')"

0 comments on commit 302f383

Please sign in to comment.