Skip to content

Commit d6e3d40

Browse files
gaborbernatTaher Cheginicheginit
authored
Ignore failure of tox executable and drop 3.7 (#121)
Co-authored-by: Taher Chegini <[email protected]> Co-authored-by: Taher Chegini <[email protected]>
1 parent bece2c7 commit d6e3d40

File tree

12 files changed

+57
-38
lines changed

12 files changed

+57
-38
lines changed

.github/workflows/check.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,11 @@ jobs:
1818
fail-fast: false
1919
matrix:
2020
py:
21-
- "3.12.0-beta.2"
21+
- "3.12.0-rc.1"
2222
- "3.11"
2323
- "3.10"
2424
- "3.9"
2525
- "3.8"
26-
- "3.7"
2726
steps:
2827
- name: setup python for tox
2928
uses: actions/setup-python@v4

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ repos:
1717
rev: "0.13.1"
1818
hooks:
1919
- id: pyproject-fmt
20-
additional_dependencies: ["tox>=4.6.4"]
20+
additional_dependencies: ["tox>=4.8"]
2121
- repo: https://github.com/pre-commit/mirrors-prettier
2222
rev: "v3.0.2"
2323
hooks:

.readthedocs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ version: 2
22
build:
33
os: ubuntu-22.04
44
tools:
5-
python: "3"
5+
python: "3.11"
66
python:
77
install:
88
- method: pip

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Apply a consistent format to `pyproject.toml` files.
1414

1515
```yaml
1616
- repo: https://github.com/tox-dev/pyproject-fmt
17-
rev: "0.11.1"
17+
rev: "1.0.0"
1818
hooks:
1919
- id: pyproject-fmt
2020
```

docs/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ See :gh:`pre-commit/pre-commit` for instructions, sample ``.pre-commit-config.ya
2525
.. code-block:: yaml
2626
2727
- repo: https://github.com/tox-dev/pyproject-fmt
28-
rev: "0.9.0"
28+
rev: "1.0.0"
2929
hooks:
3030
- id: pyproject-fmt
3131

pyproject.toml

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
build-backend = "hatchling.build"
33
requires = [
44
"hatch-vcs>=0.3",
5-
"hatchling>=1.17.1",
5+
"hatchling>=1.18",
66
]
77

88
[project]
@@ -15,13 +15,12 @@ keywords = [
1515
]
1616
license.file = "LICENSE.txt"
1717
authors = [{ name = "Bernat Gabor", email = "[email protected]" }]
18-
requires-python = ">=3.7"
18+
requires-python = ">=3.8"
1919
classifiers = [
2020
"License :: OSI Approved :: MIT License",
2121
"Operating System :: OS Independent",
2222
"Programming Language :: Python",
2323
"Programming Language :: Python :: 3 :: Only",
24-
"Programming Language :: Python :: 3.7",
2524
"Programming Language :: Python :: 3.8",
2625
"Programming Language :: Python :: 3.9",
2726
"Programming Language :: Python :: 3.10",
@@ -34,14 +33,13 @@ dynamic = [
3433
dependencies = [
3534
"natsort>=8.4",
3635
"packaging>=23.1",
37-
"tomlkit>=0.11.8",
38-
'typing-extensions>=4.7.1; python_version < "3.8"',
36+
"tomlkit>=0.12.1",
3937
]
4038
optional-dependencies.docs = [
41-
"furo>=2023.5.20",
42-
"sphinx>=7.0.1",
39+
"furo>=2023.7.26",
40+
"sphinx>=7.1.2",
4341
"sphinx-argparse-cli>=1.11.1",
44-
"sphinx-autodoc-typehints!=1.23.4,>=1.23.3",
42+
"sphinx-autodoc-typehints>=1.24",
4543
"sphinx-copybutton>=0.5.2",
4644
]
4745
optional-dependencies.test = [
@@ -65,7 +63,7 @@ version.source = "vcs"
6563
[tool.ruff]
6664
select = ["ALL"]
6765
line-length = 120
68-
target-version = "py37"
66+
target-version = "py38"
6967
isort = {known-first-party = ["pyproject_fmt"], required-imports = ["from __future__ import annotations"]}
7068
ignore = [
7169
"ANN101", # no typoe annotation for self

src/pyproject_fmt/cli.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,9 @@ def cli_args(args: Sequence[str]) -> PyProjectFmtNamespace:
8282
:return: the parsed options
8383
"""
8484
parser = _build_cli()
85-
return parser.parse_args(namespace=PyProjectFmtNamespace(), args=args)
85+
result = PyProjectFmtNamespace()
86+
parser.parse_args(namespace=result, args=args)
87+
return result
8688

8789

8890
__all__ = [

src/pyproject_fmt/formatter/config.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,8 @@
55
from typing import TYPE_CHECKING
66

77
if TYPE_CHECKING:
8-
import sys
98
from pathlib import Path
10-
11-
if sys.version_info >= (3, 8): # pragma: no cover (py38+)
12-
from typing import Final
13-
else: # pragma: no cover (<py38)
14-
from typing_extensions import Final
9+
from typing import Final
1510

1611

1712
DEFAULT_INDENT: Final[int] = 2 #: default indentation level

src/pyproject_fmt/formatter/project.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
from __future__ import annotations
33

44
import re
5-
import subprocess
65
from shutil import which
6+
from subprocess import CalledProcessError, check_output
77
from typing import TYPE_CHECKING, Optional, cast
88

99
from packaging.utils import canonicalize_name
@@ -25,11 +25,14 @@ def _get_max_version() -> int:
2525
max_version = _PY_MAX_VERSION
2626
tox = which("tox")
2727
if tox is not None: # pragma: no branch
28-
tox_environments = subprocess.check_output(
29-
["tox", "-aqq"], # noqa: S603, S607
30-
encoding="utf-8",
31-
text=True,
32-
)
28+
try:
29+
tox_environments = check_output(
30+
[tox, "-aqq"], # noqa: S603
31+
encoding="utf-8",
32+
text=True,
33+
)
34+
except (OSError, CalledProcessError):
35+
return max_version
3336
if not re.match(r"ROOT: No .* found, assuming empty", tox_environments):
3437
found = set()
3538
for env in tox_environments.split():

src/pyproject_fmt/formatter/util.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
"""Utility methods."""
22
from __future__ import annotations
33

4-
import sys
54
from collections import defaultdict
65
from dataclasses import dataclass, field
7-
from typing import Any, Callable, Iterable, Sequence, TypeVar
6+
from typing import Any, Callable, Iterable, Protocol, Sequence, TypeVar
87

98
from natsort import natsorted
109
from tomlkit.container import OutOfOrderTableProxy
@@ -22,11 +21,6 @@
2221
_ArrayItemGroup,
2322
)
2423

25-
if sys.version_info >= (3, 8): # pragma: no cover (py38+)
26-
from typing import Protocol
27-
else: # pragma: no cover (<py38)
28-
from typing_extensions import Protocol
29-
3024

3125
class SupportsDunderLT(Protocol):
3226
def __lt__(self, __other: Any) -> bool:

0 commit comments

Comments
 (0)