Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pre-commit.ci] pre-commit autoupdate #3217

Merged
merged 2 commits into from
Feb 13, 2024
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ assignees: ""

## Issue

<!-- Describe what's the expected behaviour and what you're observing. -->
<!-- Describe what's the expected behavior and what you're observing. -->

## Environment

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: check
on:
workflow_dispatch:
push:
branches: "main"
branches: ["main"]
tags-ignore: [ "**" ]
pull_request:
schedule:
Expand Down
27 changes: 15 additions & 12 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,37 @@ repos:
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.28.0
hooks:
- id: check-github-workflows
args: [ "--verbose" ]
- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
hooks:
- id: codespell
args: ["--ignore-words-list", "crate,releas", "--skip", "*.svg"]
additional_dependencies:
- tomli>=2.0.1
additional_dependencies: ["tomli>=2.0.1"]
- repo: https://github.com/tox-dev/tox-ini-fmt
rev: 1.3.1
rev: "1.3.1"
hooks:
- id: tox-ini-fmt
args: ["-p", "fix"]
- repo: https://github.com/tox-dev/pyproject-fmt
rev: 1.7.0
rev: "1.7.0"
hooks:
- id: pyproject-fmt
additional_dependencies: ["tox>=4.11.4"]
- repo: https://github.com/asottile/blacken-docs
rev: 1.16.0
hooks:
- id: blacken-docs
additional_dependencies: [black==23.12.1]
additional_dependencies: ["tox>=4.12.1"]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.14
rev: "v0.2.1"
hooks:
- id: ruff-format
- id: ruff
args: ["--fix", "--unsafe-fixes", "--exit-non-zero-on-fix"]
- repo: https://github.com/asottile/blacken-docs
rev: 1.16.0
hooks:
- id: blacken-docs
additional_dependencies: [black==23.12.1]
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
Expand Down
6 changes: 3 additions & 3 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -559,8 +559,8 @@ v4.1.2 (2022-12-30)

Bugfixes - 4.1.2
~~~~~~~~~~~~~~~~
- Fix ``--skip-missing-interpreters`` behaviour - by :user:`q0w`. (:issue:`2649`)
- Restore tox 3 behaviour of showing the output of pip freeze, however now only active when running inside a CI
- Fix ``--skip-missing-interpreters`` behavior - by :user:`q0w`. (:issue:`2649`)
- Restore tox 3 behavior of showing the output of pip freeze, however now only active when running inside a CI
environment - by :user:`gaborbernat`. (:issue:`2685`)
- Fix extracting extras from markers with many extras - by :user:`q0w`. (:issue:`2791`)

Expand Down Expand Up @@ -614,7 +614,7 @@ Features - 4.0.17

Bugfixes - 4.0.17
~~~~~~~~~~~~~~~~~
- Fix ``--sdistonly`` behaviour. (:issue:`2653`)
- Fix ``--sdistonly`` behavior. (:issue:`2653`)
- Override toxworkdir with --workdir. (:issue:`2654`)


Expand Down
2 changes: 1 addition & 1 deletion docs/changelog/3197.doc.rst
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Development: summarise important points experienced developers need to know - by :user:`0cjs`.
Development: summarize important points experienced developers need to know - by :user:`0cjs`.
2 changes: 1 addition & 1 deletion docs/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ Run
.. note::

Inline scripts can be used, however note these are discovered from the project root directory, and is not
influenced by :ref:`change_dir` (this only affects the runtime current working directory). To make this behaviour
influenced by :ref:`change_dir` (this only affects the runtime current working directory). To make this behavior
explicit we recommend that you make inline scripts absolute paths by prepending ``{tox_root}``, instead of
``path/to/my_script`` prefer ``{tox_root}{/}path{/}to{/}my_script``. If your inline script is platform dependent
refer to :ref:`platform-specification` on how to select different script per platform.
Expand Down
2 changes: 2 additions & 0 deletions ignore-words.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
releas
master
24 changes: 13 additions & 11 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,11 @@ build.targets.sdist.include = ["/src", "/tests", "/tox.ini"]
version.source = "vcs"

[tool.ruff]
select = ["ALL"]
line-length = 120
target-version = "py38"
isort = { known-first-party = ["tox", "tests"], required-imports = ["from __future__ import annotations"] }
ignore = [
lint.isort = { known-first-party = ["tox", "tests"], required-imports = ["from __future__ import annotations"] }
lint.select = ["ALL"]
lint.ignore = [
"CPY", # No copyright header
"INP001", # no implicit namespaces here
"D", # ignore documentation for now
Expand All @@ -118,21 +118,16 @@ ignore = [
"D212", # `multi-line-summary-first-line` (D212) and `multi-line-summary-second-line` (D213) are incompatible
"S104", # Possible binding to all interfaces
"COM812", # conflicts with formatter
"COM819", # conflicts with formatter
"E501", # conflicts with formatter
"ISC001", # conflicts with formatter
"Q000", # conflicts with formatter
"Q001", # conflicts with formatter
"Q002", # conflicts with formatter
"Q003", # conflicts with formatter
"W191", # conflicts with formatter
"S404", # Using subprocess is alright.
"PLR0914", ## Too many local variables
"PLR0917", ## Too many positional arguments
]
format.preview = true
lint.preview = true
[tool.ruff.per-file-ignores]
format.docstring-code-format = true
format.docstring-code-line-length = 100
[tool.ruff.lint.per-file-ignores]
"tests/**/*.py" = [
"S101", # asserts allowed in tests...
"FBT", # don"t care about booleans as positional arguments in tests
Expand All @@ -142,6 +137,13 @@ lint.preview = true
"PLR2004", # Magic value used in comparison, consider replacing with a constant variable
]

[tool.codespell]
builtin = "clear,usage,en-GB_to_en-US"
write-changes = true
skip = "*.svg"
ignore-words = "ignore-words.txt"
count = true

[tool.pytest.ini_options]
testpaths = ["tests"]
addopts = "--tb=auto -ra --showlocals --no-success-flaky-report"
Expand Down
2 changes: 1 addition & 1 deletion src/tox/config/set_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def __init__(self, raw: str, name: str, env_name: str | None, root: Path) -> Non
self._name, self._env_name, self._root = name, env_name, root
from .loader.ini.replace import MatchExpression, find_replace_expr # noqa: PLC0415

for line in raw.splitlines():
for line in raw.splitlines(): # noqa: PLR1702
if line.strip():
if line.startswith("file|"):
self._env_files.append(line[len("file|") :])
Expand Down
2 changes: 1 addition & 1 deletion src/tox/plugin/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
tox uses `pluggy <https://pluggy.readthedocs.io/en/stable/>`_ to customize the default behaviour. It provides an
tox uses `pluggy <https://pluggy.readthedocs.io/en/stable/>`_ to customize the default behavior. It provides an
extension mechanism for plugin management an calling hooks.

Pluggy discovers a plugin by looking up for entry-points named ``tox``, for example in a pyproject.toml:
Expand Down
8 changes: 4 additions & 4 deletions src/tox/session/cmd/run/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,9 @@ def execute(state: State, max_workers: int | None, has_spinner: bool, live: bool
interrupt.set()
# cancel in reverse order to not allow submitting new jobs as we cancel running ones
for future, tox_env in reversed(list(future_to_env.items())):
cancelled = future.cancel()
# if cannot be cancelled and not done -> still runs
if cancelled is False and not future.done(): # pragma: no branch
canceled = future.cancel()
# if cannot be canceled and not done -> still runs
if canceled is False and not future.done(): # pragma: no branch
tox_env.interrupt()
done.wait()
# workaround for https://bugs.python.org/issue45274
Expand Down Expand Up @@ -310,7 +310,7 @@ def _queue_and_wait( # noqa: C901, PLR0913, PLR0915
spinner: ToxSpinner,
live: bool, # noqa: FBT001
) -> None:
try:
try: # noqa: PLR1702
options = state._options # noqa: SLF001
with spinner:
max_workers = len(to_run_list) if max_workers is None else max_workers
Expand Down
4 changes: 2 additions & 2 deletions src/tox/session/env_select.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def _ensure_envs_valid(self) -> None:
for env in self._cli_envs or []:
if env.startswith(".pkg_external"): # external package
continue
factors: dict[str, str | None] = {k: None for k in env.split("-")}
factors: dict[str, str | None] = dict.fromkeys(env.split("-"))
found_factors: set[str] = set()
for factor in factors:
if (
Expand Down Expand Up @@ -247,7 +247,7 @@ def _defined_envs(self) -> dict[str, _ToxEnvInfo]: # noqa: C901, PLR0912
# we need to redefine it, e.g. when it shows up in config as [testenv:.package] and afterwards by a run env is
# marked as package_env.

if self._defined_envs_ is None:
if self._defined_envs_ is None: # noqa: PLR1702
self._defined_envs_ = {}
failed: dict[str, Exception] = {}
env_name_to_active = self._env_name_to_active()
Expand Down
4 changes: 2 additions & 2 deletions src/tox/tox_env/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def register_config(self) -> None:

def pass_env_post_process(values: list[str]) -> list[str]:
values.extend(self._default_pass_env())
result = sorted({k: None for k in values}.keys())
result = sorted(dict.fromkeys(values).keys())
invalid_chars = set(string.whitespace)
invalid = [v for v in result if any(c in invalid_chars for c in v)]
if invalid:
Expand Down Expand Up @@ -436,7 +436,7 @@ def execute_async( # noqa: PLR0913
finally:
self._execute_statuses.pop(execute_id)
if show and self._hidden_outcomes is not None and execute_status.outcome is not None:
# if it gets cancelled before even starting
# if it gets canceled before even starting
self._hidden_outcomes.append(execute_status.outcome)
if self.journal and execute_status.outcome is not None:
self.journal.add_execute(execute_status.outcome, run_id)
Expand Down
4 changes: 2 additions & 2 deletions src/tox/util/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ def visit(vertex: str) -> dict[str, None] | None:
return None
visited.add(vertex)
path[vertex] = None
for neighbour in graph.get(vertex, ()):
if neighbour in path or visit(neighbour):
for neighbor in graph.get(vertex, ()):
if neighbor in path or visit(neighbor):
return path
del path[vertex]
return None
Expand Down