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
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.12.4"
hooks:
- id: ruff-format
- id: ruff
- id: ruff-check
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gaborbernat Why have you moved the format after check on ruff? My impression was that it was far better to do the format first and the check with fix after. Reason for this being that reformatting is likely to also include fixes for stuff that check might only complain about, so more noise.

Am I wrong? ChatGPT seems to agree, not that I would trust it so much anyway.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/astral-sh/ruff-pre-commit it's what the official doc recommended

args: ["--fix", "--unsafe-fixes", "--exit-non-zero-on-fix"]
- id: ruff-format
- repo: https://github.com/asottile/blacken-docs
rev: 1.19.1
hooks:
Expand Down
1 change: 1 addition & 0 deletions docs/changelog/3568.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Don't pass in the filter argument to tar.extractall on old Python versions - by :user:`gaborbernat`.
13 changes: 8 additions & 5 deletions src/tox/tox_env/python/virtual_env/package/cmd_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,16 @@ def extract_install_info(self, for_env: EnvConfigSet, path: Path) -> list[Packag
if not work_dir.exists(): # pragma: no branch
work_dir.mkdir()
with tarfile.open(str(path), "r:gz") as tar:
tar.extractall( # noqa: S202
path=str(work_dir),
filter=tarfile.data_filter
if sys.version_info >= (3, 11, 4)
kwargs = {}
if (
sys.version_info >= (3, 11, 4)
or (3, 10, 12) <= sys.version_info < (3, 11)
or (3, 9, 17) <= sys.version_info < (3, 10)
else None,
) is not None:
kwargs["filter"] = tarfile.data_filter
tar.extractall( # noqa: S202
path=str(work_dir),
**kwargs, # type: ignore[arg-type]
)
# the register run env is guaranteed to be called before this
assert self._sdist_meta_tox_env is not None # noqa: S101
Expand Down