diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml index 5ec2ba9..e9b02b7 100644 --- a/.github/workflows/check.yaml +++ b/.github/workflows/check.yaml @@ -24,7 +24,6 @@ jobs: - "3.11" - "3.10" - "3.9" - - "3.8" - type - dev - pkg_meta diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 92fbc50..c332adf 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -13,7 +13,7 @@ repos: rev: v2.3.0 hooks: - id: codespell - additional_dependencies: ["tomli>=2.0.1"] + additional_dependencies: ["tomli>=2.0.2"] - repo: https://github.com/tox-dev/tox-ini-fmt rev: "1.4.1" hooks: diff --git a/pyproject.toml b/pyproject.toml index 5a79a13..36aae35 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,13 +17,12 @@ license.file = "LICENSE.txt" authors = [ { name = "Bernat Gabor", email = "gaborjbernat@gmail.com" }, ] -requires-python = ">=3.8" +requires-python = ">=3.9" classifiers = [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", @@ -34,19 +33,19 @@ dynamic = [ "version", ] dependencies = [ - "pyproject-fmt-rust==1.1.6", - "tomli>=2.0.1; python_version<'3.11'", + "pyproject-fmt-rust==1.2", + "tomli>=2.0.2; python_version<'3.11'", ] optional-dependencies.docs = [ "furo>=2024.8.6", "sphinx>=8.0.2", - "sphinx-argparse-cli>=1.17", - "sphinx-autodoc-typehints>=2.4", + "sphinx-argparse-cli>=1.18.2", + "sphinx-autodoc-typehints>=2.4.4", "sphinx-copybutton>=0.5.2", ] optional-dependencies.test = [ "covdefaults>=2.3", - "pytest>=8.3.2", + "pytest>=8.3.3", "pytest-cov>=5", "pytest-mock>=3.14", ] @@ -69,7 +68,7 @@ build.targets.sdist.include = [ version.source = "vcs" [tool.ruff] -target-version = "py38" +target-version = "py39" line-length = 120 format.preview = true format.docstring-code-line-length = 100 diff --git a/src/pyproject_fmt/__main__.py b/src/pyproject_fmt/__main__.py index ec400be..4b74ace 100644 --- a/src/pyproject_fmt/__main__.py +++ b/src/pyproject_fmt/__main__.py @@ -5,13 +5,15 @@ import difflib import sys from pathlib import Path -from typing import TYPE_CHECKING, Iterable, Sequence +from typing import TYPE_CHECKING from pyproject_fmt_rust import format_toml from pyproject_fmt.cli import cli_args if TYPE_CHECKING: + from collections.abc import Iterable, Sequence + from pyproject_fmt.cli import Config GREEN = "\u001b[32m" diff --git a/src/pyproject_fmt/cli.py b/src/pyproject_fmt/cli.py index 090d6be..3cfc540 100644 --- a/src/pyproject_fmt/cli.py +++ b/src/pyproject_fmt/cli.py @@ -13,10 +13,13 @@ from dataclasses import dataclass from importlib.metadata import version from pathlib import Path -from typing import Sequence +from typing import TYPE_CHECKING from pyproject_fmt_rust import Settings +if TYPE_CHECKING: + from collections.abc import Sequence + if sys.version_info >= (3, 11): # pragma: >=3.11 cover import tomllib else: # pragma: <3.11 cover @@ -80,12 +83,12 @@ def pyproject_toml_path_creator(argument: str) -> Path | None: def _version_argument(got: str) -> tuple[int, int]: parts = got.split(".") if len(parts) != 2: # noqa: PLR2004 - msg = f"invalid version: {got}, must be e.g. 3.12" + msg = f"invalid version: {got}, must be e.g. 3.13" raise ArgumentTypeError(msg) try: return int(parts[0]), int(parts[1]) except ValueError as exc: - msg = f"invalid version: {got} due {exc!r}, must be e.g. 3.12" + msg = f"invalid version: {got} due {exc!r}, must be e.g. 3.13" raise ArgumentTypeError(msg) from exc @@ -136,7 +139,7 @@ def _build_cli() -> ArgumentParser: "--max-supported-python", metavar="minor.major", type=_version_argument, - default=(3, 12), + default=(3, 13), help="latest Python version the project supports (e.g. 3.13)", ) @@ -190,7 +193,7 @@ def cli_args(args: Sequence[str]) -> list[Config]: indent=indent, keep_full_version=keep_full_version, max_supported_python=max_supported_python, - min_supported_python=(3, 8), # default for when the user did not specify via requires-python + min_supported_python=(3, 9), # default for when the user did not specify via requires-python ), ) ) diff --git a/tests/test_cli.py b/tests/test_cli.py index 5f2a998..bbc3fa4 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -33,7 +33,7 @@ def test_cli_invalid_version(capsys: pytest.CaptureFixture[str], tmp_path: Path) assert context.value.code == 2 out, err = capsys.readouterr() assert not out - assert "error: argument --max-supported-python: invalid version: 3, must be e.g. 3.12\n" in err + assert "error: argument --max-supported-python: invalid version: 3, must be e.g. 3.13\n" in err def test_cli_invalid_version_value(capsys: pytest.CaptureFixture[str], tmp_path: Path) -> None: diff --git a/tests/test_main.py b/tests/test_main.py index bd91196..ee3bc25 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -175,7 +175,7 @@ def test_keep_full_version_cli(tmp_path: Path) -> None: [project] classifiers = [ "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", ] dependencies = [ "a==1.0.0", @@ -186,7 +186,7 @@ def test_keep_full_version_cli(tmp_path: Path) -> None: """ pyproject_toml = tmp_path / "pyproject.toml" pyproject_toml.write_text(dedent(start)) - args = [str(pyproject_toml), "--keep-full-version", "--max-supported-python", "3.8"] + args = [str(pyproject_toml), "--keep-full-version", "--max-supported-python", "3.9"] run(args) output = pyproject_toml.read_text() assert output == dedent(start) @@ -212,7 +212,7 @@ def test_pyproject_toml_config(tmp_path: Path, capsys: pytest.CaptureFixture[str column_width = 20 indent = 4 keep_full_version = true - max_supported_python = "3.10" + max_supported_python = "3.11" ignore_extra = true """ filename = tmp_path / "pyproject.toml" @@ -226,9 +226,9 @@ def test_pyproject_toml_config(tmp_path: Path, capsys: pytest.CaptureFixture[str ] classifiers = [ "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", ] dynamic = [ "B", @@ -241,7 +241,7 @@ def test_pyproject_toml_config(tmp_path: Path, capsys: pytest.CaptureFixture[str column_width = 20 indent = 4 keep_full_version = true - max_supported_python = "3.10" + max_supported_python = "3.11" ignore_extra = true """ got = filename.read_text() diff --git a/tox.ini b/tox.ini index 3928a25..6abd338 100644 --- a/tox.ini +++ b/tox.ini @@ -9,7 +9,6 @@ env_list = 3.11 3.10 3.9 - 3.8 type docs pkg_meta @@ -35,7 +34,7 @@ commands = description = run static analysis and style check using flake8 skip_install = true deps = - pre-commit-uv>=4.1.1 + pre-commit-uv>=4.1.3 commands = pre-commit run --all-files --show-diff-on-failure python -c 'print("hint: run {envdir}/bin/pre-commit install to add checks as pre-commit hook")' @@ -64,7 +63,7 @@ skip_install = true deps = check-wheel-contents>=0.6 twine>=5.1.1 - uv>=0.4.10 + uv>=0.4.18 commands = uv build --sdist --wheel --out-dir {env_tmp_dir} . twine check {env_tmp_dir}{/}*