Skip to content

Commit

Permalink
Drop 3.8 support and set 3.13 latest stable (#267)
Browse files Browse the repository at this point in the history
  • Loading branch information
gaborbernat authored Oct 10, 2024
1 parent 4f909ee commit 3193010
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 25 deletions.
1 change: 0 additions & 1 deletion .github/workflows/check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ jobs:
- "3.11"
- "3.10"
- "3.9"
- "3.8"
- type
- dev
- pkg_meta
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
15 changes: 7 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,12 @@ license.file = "LICENSE.txt"
authors = [
{ name = "Bernat Gabor", email = "[email protected]" },
]
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",
Expand All @@ -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",
]
Expand All @@ -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
Expand Down
4 changes: 3 additions & 1 deletion src/pyproject_fmt/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
13 changes: 8 additions & 5 deletions src/pyproject_fmt/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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


Expand Down Expand Up @@ -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)",
)

Expand Down Expand Up @@ -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
),
)
)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
10 changes: 5 additions & 5 deletions tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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)
Expand All @@ -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"
Expand All @@ -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",
Expand All @@ -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()
Expand Down
5 changes: 2 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ env_list =
3.11
3.10
3.9
3.8
type
docs
pkg_meta
Expand All @@ -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")'
Expand Down Expand Up @@ -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}{/}*
Expand Down

0 comments on commit 3193010

Please sign in to comment.