Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ repos:
rev: v2.4.1
hooks:
- id: codespell
additional_dependencies: ["tomli>=2.1"]
additional_dependencies: ["tomli>=2.2.1"]
- repo: https://github.com/tox-dev/pyproject-fmt
rev: "v2.5.0"
hooks:
Expand All @@ -23,7 +23,7 @@ repos:
hooks:
- id: validate-pyproject
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.9.4"
rev: "v0.9.6"
hooks:
- id: ruff-format
- id: ruff
Expand All @@ -32,13 +32,13 @@ repos:
rev: 1.19.1
hooks:
- id: blacken-docs
additional_dependencies: [black==24.10]
additional_dependencies: [black==25.1]
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
- id: rst-backticks
- repo: https://github.com/rbubley/mirrors-prettier
rev: "v3.4.2"
rev: "v3.5.0"
hooks:
- id: prettier
- repo: local
Expand Down
36 changes: 18 additions & 18 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.26.3",
"hatchling>=1.27",
]

[project]
Expand Down Expand Up @@ -50,21 +50,21 @@ dynamic = [
"version",
]
dependencies = [
"cachetools>=5.5",
"cachetools>=5.5.1",
"chardet>=5.2",
"colorama>=0.4.6",
"filelock>=3.16.1",
"packaging>=24.2",
"platformdirs>=4.3.6",
"pluggy>=1.5",
"pyproject-api>=1.8",
"tomli>=2.1; python_version<'3.11'",
"tomli>=2.2.1; python_version<'3.11'",
"typing-extensions>=4.12.2; python_version<'3.11'",
"virtualenv>=20.27.1",
"virtualenv>=20.29.1",
]
optional-dependencies.test = [
"devpi-process>=1.0.2",
"pytest>=8.3.3",
"pytest>=8.3.4",
"pytest-mock>=3.14",
]
urls.Documentation = "https://tox.wiki"
Expand All @@ -89,29 +89,29 @@ test = [
"distlib>=0.3.9",
"flaky>=3.8.1",
"hatch-vcs>=0.4",
"hatchling>=1.26.3",
"psutil>=6.1",
"pytest>=8.3.3",
"hatchling>=1.27",
"psutil>=6.1.1",
"pytest>=8.3.4",
"pytest-cov>=5",
"pytest-mock>=3.14",
"pytest-xdist>=3.6.1",
"re-assert>=1.1",
"setuptools>=75.1; python_version<='3.8'",
"setuptools>=75.6; python_version>'3.8'",
"setuptools>=75.3; python_version<='3.8'",
"setuptools>=75.8; python_version>'3.8'",
"time-machine>=2.15; implementation_name!='pypy'",
"wheel>=0.45",
"wheel>=0.45.1",
]
type = [
"mypy==1.13",
"mypy==1.15",
"types-cachetools>=5.5.0.20240820",
"types-chardet>=5.0.4.6",
{ include-group = "test" },
]
docs = [
"furo>=2024.8.6",
"sphinx>=8.1.3",
"sphinx-argparse-cli>=1.18.2",
"sphinx-autodoc-typehints>=2.5",
"sphinx-argparse-cli>=1.19",
"sphinx-autodoc-typehints>=3.0.1",
"sphinx-copybutton>=0.5.2",
"sphinx-inline-tabs>=2023.4.21",
"sphinxcontrib-towncrier>=0.2.1a0",
Expand All @@ -121,12 +121,12 @@ fix = [
"pre-commit-uv>=4.1.4",
]
pkg-meta = [
"check-wheel-contents>=0.6",
"twine>=5.1.1",
"uv>=0.5.3",
"check-wheel-contents>=0.6.1",
"twine>=6.1",
"uv>=0.5.29",
]
release = [
"gitpython>=3.1.43",
"gitpython>=3.1.44",
"packaging>=24.2",
"towncrier>=24.8",
]
Expand Down
11 changes: 8 additions & 3 deletions src/tox/config/cli/parser.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Customize argparse logic for tox (also contains the base options).""" # noqa: A005
"""Customize argparse logic for tox (also contains the base options)."""

from __future__ import annotations

Expand All @@ -20,6 +20,11 @@
from .env_var import get_env_var
from .ini import IniConfig

if sys.version_info >= (3, 11): # pragma: >=3.11 cover
from typing import Self
else: # pragma: <3.11 cover
from typing_extensions import Self

if TYPE_CHECKING:
from tox.session.state import State

Expand Down Expand Up @@ -287,11 +292,11 @@ def add_argument(self, *args: str, of_type: type[Any] | None = None, **kwargs: A
return result

@classmethod
def base(cls: type[ToxParserT]) -> ToxParserT:
def base(cls) -> Self:
return cls(add_help=False, root=True)

@classmethod
def core(cls: type[ToxParserT]) -> ToxParserT:
def core(cls) -> Self:
return cls(
prog=NAME,
formatter_class=HelpFormatter,
Expand Down
2 changes: 1 addition & 1 deletion src/tox/config/types.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from __future__ import annotations # noqa: A005
from __future__ import annotations

from collections import OrderedDict
from typing import Iterator, Sequence
Expand Down
2 changes: 1 addition & 1 deletion src/tox/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def stderr(self) -> TextIOWrapper:
""":return: the current standard error"""
return self._local.out_err[1]

@property # type: ignore[override]
@property
def stream(self) -> IO[str]:
""":return: the current stream to write to (alias for the current standard output)"""
return self.stdout
Expand Down
11 changes: 9 additions & 2 deletions src/tox/tox_env/python/pip/req/args.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,20 @@
import bisect
import re
from argparse import Action, ArgumentParser, ArgumentTypeError, Namespace
from typing import IO, Any, NoReturn, Sequence
from typing import Any, NoReturn, Protocol, Sequence, TypeVar

from tox.tox_env.python.pip.req.util import handle_binary_option

_T_contra = TypeVar("_T_contra", contravariant=True)


# stable
class _SupportsWrite(Protocol[_T_contra]):
def write(self, s: _T_contra, /) -> object: ...


class _OurArgumentParser(ArgumentParser):
def print_usage(self, file: IO[str] | None = None) -> None:
def print_usage(self, file: _SupportsWrite[str] | None = None) -> None:
""" """

def exit(self, status: int = 0, message: str | None = None) -> NoReturn: # noqa: ARG002, PLR6301
Expand Down
7 changes: 6 additions & 1 deletion src/tox/util/spinner.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@

from colorama import Fore

if sys.version_info >= (3, 11): # pragma: >=3.11 cover
from typing import Self
else: # pragma: <3.11 cover
from typing_extensions import Self

if TYPE_CHECKING:
from types import TracebackType
from typing import Any, ClassVar
Expand Down Expand Up @@ -104,7 +109,7 @@ def frame(self) -> str:
text_frame = textwrap.shorten(text_frame, width=self.max_width - 1, placeholder="...")
return f"{frame} {text_frame}"

def __enter__(self: T) -> T:
def __enter__(self) -> Self:
if self.enabled:
self.disable_cursor()
self.render_frame()
Expand Down
2 changes: 1 addition & 1 deletion tox.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
requires = ["tox>=4.23.2"]
requires = ["tox>=4.24.1"]
env_list = ["fix", "3.13", "3.12", "3.11", "3.10", "3.9", "3.8", "cov", "type", "docs", "pkg_meta"]
skip_missing_interpreters = true

Expand Down