Skip to content

Commit 6fdde68

Browse files
authored
Merge branch 'tox-dev:main' into fix/toml_setenv_from_file
2 parents 7dc1f78 + 65d404e commit 6fdde68

File tree

11 files changed

+57
-39
lines changed

11 files changed

+57
-39
lines changed

.pre-commit-config.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ repos:
1313
rev: v2.4.1
1414
hooks:
1515
- id: codespell
16-
additional_dependencies: ["tomli>=2.1"]
16+
additional_dependencies: ["tomli>=2.2.1"]
1717
- repo: https://github.com/tox-dev/pyproject-fmt
1818
rev: "v2.5.0"
1919
hooks:
@@ -23,7 +23,7 @@ repos:
2323
hooks:
2424
- id: validate-pyproject
2525
- repo: https://github.com/astral-sh/ruff-pre-commit
26-
rev: "v0.9.4"
26+
rev: "v0.9.6"
2727
hooks:
2828
- id: ruff-format
2929
- id: ruff
@@ -32,13 +32,13 @@ repos:
3232
rev: 1.19.1
3333
hooks:
3434
- id: blacken-docs
35-
additional_dependencies: [black==24.10]
35+
additional_dependencies: [black==25.1]
3636
- repo: https://github.com/pre-commit/pygrep-hooks
3737
rev: v1.10.0
3838
hooks:
3939
- id: rst-backticks
4040
- repo: https://github.com/rbubley/mirrors-prettier
41-
rev: "v3.4.2"
41+
rev: "v3.5.0"
4242
hooks:
4343
- id: prettier
4444
- repo: local

docs/changelog/3456.doc.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Updates the documentation for ``os.environ['KEY']`` when the variable does not exist - by :user:`jugmac00`.

docs/changelog/3480.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
fix example on the docs

docs/config.rst

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1366,7 +1366,7 @@ You can reference other configurations via the ``ref`` replacement. This can eit
13661366
[env.src]
13671367
extras = ["A", "{env_name}"]
13681368
[env.dest]
1369-
extras = [{ replace = "ref", env = "src", key = "extras", extend = true }, "B"
1369+
extras = [{ replace = "ref", env = "src", key = "extras", extend = true }, "B"]
13701370
13711371
In this case ``dest`` environments ``extras`` will be ``A``, ``src``, ``B``.
13721372

@@ -1586,10 +1586,8 @@ create your virtual env for the developers.
15861586
py -> [no description]
15871587
15881588
additional environments:
1589-
py310-black -> [no description]
1590-
py310-lint -> [no description]
1591-
py311-black -> [no description]
1592-
py311-lint -> [no description]
1589+
py311-x86-venv -> [no description]
1590+
py311-x64-venv -> [no description]
15931591
15941592
.. _substitution:
15951593

@@ -1637,7 +1635,8 @@ If you specify a substitution string like this::
16371635

16381636
{env:KEY}
16391637

1640-
then the value will be retrieved as ``os.environ['KEY']`` and raise an Error if the environment variable does not exist.
1638+
then the value will be retrieved as ``os.environ['KEY']`` and replaced with an empty string if the environment variable
1639+
does not exist.
16411640

16421641

16431642
Environment variable substitutions with default values
@@ -1647,14 +1646,14 @@ If you specify a substitution string like this::
16471646

16481647
{env:KEY:DEFAULTVALUE}
16491648

1650-
then the value will be retrieved as ``os.environ['KEY']`` and replace with DEFAULTVALUE if the environment variable does
1649+
then the value will be retrieved as ``os.environ['KEY']`` and replaced with DEFAULTVALUE if the environment variable does
16511650
not exist.
16521651

16531652
If you specify a substitution string like this::
16541653

16551654
{env:KEY:}
16561655

1657-
then the value will be retrieved as ``os.environ['KEY']`` and replace with an empty string if the environment variable
1656+
then the value will be retrieved as ``os.environ['KEY']`` and replaced with an empty string if the environment variable
16581657
does not exist.
16591658

16601659
Substitutions can also be nested. In that case they are expanded starting from the innermost expression::

pyproject.toml

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

88
[project]
@@ -50,21 +50,21 @@ dynamic = [
5050
"version",
5151
]
5252
dependencies = [
53-
"cachetools>=5.5",
53+
"cachetools>=5.5.1",
5454
"chardet>=5.2",
5555
"colorama>=0.4.6",
5656
"filelock>=3.16.1",
5757
"packaging>=24.2",
5858
"platformdirs>=4.3.6",
5959
"pluggy>=1.5",
6060
"pyproject-api>=1.8",
61-
"tomli>=2.1; python_version<'3.11'",
61+
"tomli>=2.2.1; python_version<'3.11'",
6262
"typing-extensions>=4.12.2; python_version<'3.11'",
63-
"virtualenv>=20.27.1",
63+
"virtualenv>=20.29.1",
6464
]
6565
optional-dependencies.test = [
6666
"devpi-process>=1.0.2",
67-
"pytest>=8.3.3",
67+
"pytest>=8.3.4",
6868
"pytest-mock>=3.14",
6969
]
7070
urls.Documentation = "https://tox.wiki"
@@ -89,29 +89,29 @@ test = [
8989
"distlib>=0.3.9",
9090
"flaky>=3.8.1",
9191
"hatch-vcs>=0.4",
92-
"hatchling>=1.26.3",
93-
"psutil>=6.1",
94-
"pytest>=8.3.3",
92+
"hatchling>=1.27",
93+
"psutil>=6.1.1",
94+
"pytest>=8.3.4",
9595
"pytest-cov>=5",
9696
"pytest-mock>=3.14",
9797
"pytest-xdist>=3.6.1",
9898
"re-assert>=1.1",
99-
"setuptools>=75.1; python_version<='3.8'",
100-
"setuptools>=75.6; python_version>'3.8'",
99+
"setuptools>=75.3; python_version<='3.8'",
100+
"setuptools>=75.8; python_version>'3.8'",
101101
"time-machine>=2.15; implementation_name!='pypy'",
102-
"wheel>=0.45",
102+
"wheel>=0.45.1",
103103
]
104104
type = [
105-
"mypy==1.13",
105+
"mypy==1.15",
106106
"types-cachetools>=5.5.0.20240820",
107107
"types-chardet>=5.0.4.6",
108108
{ include-group = "test" },
109109
]
110110
docs = [
111111
"furo>=2024.8.6",
112112
"sphinx>=8.1.3",
113-
"sphinx-argparse-cli>=1.18.2",
114-
"sphinx-autodoc-typehints>=2.5",
113+
"sphinx-argparse-cli>=1.19",
114+
"sphinx-autodoc-typehints>=3.0.1",
115115
"sphinx-copybutton>=0.5.2",
116116
"sphinx-inline-tabs>=2023.4.21",
117117
"sphinxcontrib-towncrier>=0.2.1a0",
@@ -121,12 +121,12 @@ fix = [
121121
"pre-commit-uv>=4.1.4",
122122
]
123123
pkg-meta = [
124-
"check-wheel-contents>=0.6",
125-
"twine>=5.1.1",
126-
"uv>=0.5.3",
124+
"check-wheel-contents>=0.6.1",
125+
"twine>=6.1",
126+
"uv>=0.5.29",
127127
]
128128
release = [
129-
"gitpython>=3.1.43",
129+
"gitpython>=3.1.44",
130130
"packaging>=24.2",
131131
"towncrier>=24.8",
132132
]

src/tox/config/cli/parser.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""Customize argparse logic for tox (also contains the base options).""" # noqa: A005
1+
"""Customize argparse logic for tox (also contains the base options)."""
22

33
from __future__ import annotations
44

@@ -20,6 +20,11 @@
2020
from .env_var import get_env_var
2121
from .ini import IniConfig
2222

23+
if sys.version_info >= (3, 11): # pragma: >=3.11 cover
24+
from typing import Self
25+
else: # pragma: <3.11 cover
26+
from typing_extensions import Self
27+
2328
if TYPE_CHECKING:
2429
from tox.session.state import State
2530

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

289294
@classmethod
290-
def base(cls: type[ToxParserT]) -> ToxParserT:
295+
def base(cls) -> Self:
291296
return cls(add_help=False, root=True)
292297

293298
@classmethod
294-
def core(cls: type[ToxParserT]) -> ToxParserT:
299+
def core(cls) -> Self:
295300
return cls(
296301
prog=NAME,
297302
formatter_class=HelpFormatter,

src/tox/config/types.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from __future__ import annotations # noqa: A005
1+
from __future__ import annotations
22

33
from collections import OrderedDict
44
from typing import Iterator, Sequence

src/tox/report.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ def stderr(self) -> TextIOWrapper:
140140
""":return: the current standard error"""
141141
return self._local.out_err[1]
142142

143-
@property # type: ignore[override]
143+
@property
144144
def stream(self) -> IO[str]:
145145
""":return: the current stream to write to (alias for the current standard output)"""
146146
return self.stdout

src/tox/tox_env/python/pip/req/args.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,20 @@
33
import bisect
44
import re
55
from argparse import Action, ArgumentParser, ArgumentTypeError, Namespace
6-
from typing import IO, Any, NoReturn, Sequence
6+
from typing import Any, NoReturn, Protocol, Sequence, TypeVar
77

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

10+
_T_contra = TypeVar("_T_contra", contravariant=True)
11+
12+
13+
# stable
14+
class _SupportsWrite(Protocol[_T_contra]):
15+
def write(self, s: _T_contra, /) -> object: ...
16+
1017

1118
class _OurArgumentParser(ArgumentParser):
12-
def print_usage(self, file: IO[str] | None = None) -> None:
19+
def print_usage(self, file: _SupportsWrite[str] | None = None) -> None:
1320
""" """
1421

1522
def exit(self, status: int = 0, message: str | None = None) -> NoReturn: # noqa: ARG002, PLR6301

src/tox/util/spinner.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@
1212

1313
from colorama import Fore
1414

15+
if sys.version_info >= (3, 11): # pragma: >=3.11 cover
16+
from typing import Self
17+
else: # pragma: <3.11 cover
18+
from typing_extensions import Self
19+
1520
if TYPE_CHECKING:
1621
from types import TracebackType
1722
from typing import Any, ClassVar
@@ -104,7 +109,7 @@ def frame(self) -> str:
104109
text_frame = textwrap.shorten(text_frame, width=self.max_width - 1, placeholder="...")
105110
return f"{frame} {text_frame}"
106111

107-
def __enter__(self: T) -> T:
112+
def __enter__(self) -> Self:
108113
if self.enabled:
109114
self.disable_cursor()
110115
self.render_frame()

0 commit comments

Comments
 (0)