From a02a6583932468db278db31540af4a00da190989 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 13 May 2024 19:38:08 +0000 Subject: [PATCH 1/2] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/python-jsonschema/check-jsonschema: 0.28.2 → 0.28.3](https://github.com/python-jsonschema/check-jsonschema/compare/0.28.2...0.28.3) - [github.com/tox-dev/pyproject-fmt: 1.8.0 → 2.0.4](https://github.com/tox-dev/pyproject-fmt/compare/1.8.0...2.0.4) - [github.com/astral-sh/ruff-pre-commit: v0.4.3 → v0.4.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.4.3...v0.4.4) --- .pre-commit-config.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 97d7d01ab..2eb443c7c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -5,7 +5,7 @@ repos: - id: end-of-file-fixer - id: trailing-whitespace - repo: https://github.com/python-jsonschema/check-jsonschema - rev: 0.28.2 + rev: 0.28.3 hooks: - id: check-github-workflows args: [ "--verbose" ] @@ -20,12 +20,12 @@ repos: - id: tox-ini-fmt args: ["-p", "fix"] - repo: https://github.com/tox-dev/pyproject-fmt - rev: "1.8.0" + rev: "2.0.4" hooks: - id: pyproject-fmt additional_dependencies: ["tox>=4.12.1"] - repo: https://github.com/astral-sh/ruff-pre-commit - rev: "v0.4.3" + rev: "v0.4.4" hooks: - id: ruff-format - id: ruff From 64abe43554e2414fcc113868885a5cd0fe5ce956 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 13 May 2024 19:39:26 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit for more information, see https://pre-commit.ci Signed-off-by: Bernát Gábor --- .pre-commit-config.yaml | 1 - pyproject.toml | 88 ++++++++++++++++++----------- src/virtualenv/discovery/py_info.py | 2 +- tasks/make_zipapp.py | 2 +- tests/unit/activation/conftest.py | 2 +- 5 files changed, 57 insertions(+), 38 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2eb443c7c..bb581af38 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -23,7 +23,6 @@ repos: rev: "2.0.4" hooks: - id: pyproject-fmt - additional_dependencies: ["tox>=4.12.1"] - repo: https://github.com/astral-sh/ruff-pre-commit rev: "v0.4.4" hooks: diff --git a/pyproject.toml b/pyproject.toml index 0aaa3db7e..49cd2388b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,7 +15,9 @@ keywords = [ "virtual", ] license = "MIT" -maintainers = [{ name = "Bernat Gabor", email = "gaborjbernat@gmail.com" }] +maintainers = [ + { name = "Bernat Gabor", email = "gaborjbernat@gmail.com" }, +] requires-python = ">=3.7" classifiers = [ "Development Status :: 5 - Production/Stable", @@ -31,7 +33,6 @@ classifiers = [ "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", - "Programming Language :: Python :: 3.13", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Software Development :: Libraries", @@ -44,7 +45,7 @@ dynamic = [ dependencies = [ "distlib<1,>=0.3.7", "filelock<4,>=3.12.2", - 'importlib-metadata>=6.6; python_version < "3.8"', + "importlib-metadata>=6.6; python_version<'3.8'", "platformdirs<5,>=3.9.1", ] optional-dependencies.docs = [ @@ -63,50 +64,57 @@ optional-dependencies.test = [ "packaging>=23.1", "pytest>=7.4", "pytest-env>=0.8.2", - 'pytest-freezer>=0.4.8; platform_python_implementation == "PyPy"', + "pytest-freezer>=0.4.8; platform_python_implementation=='PyPy'", "pytest-mock>=3.11.1", "pytest-randomly>=3.12", "pytest-timeout>=2.1", "setuptools>=68", - 'time-machine>=2.10; platform_python_implementation == "CPython"', + "time-machine>=2.10; platform_python_implementation=='CPython'", ] urls.Documentation = "https://virtualenv.pypa.io" urls.Homepage = "https://github.com/pypa/virtualenv" urls.Source = "https://github.com/pypa/virtualenv" urls.Tracker = "https://github.com/pypa/virtualenv/issues" scripts.virtualenv = "virtualenv.__main__:run_with_catch" -[project.entry-points."virtualenv.activate"] -bash = "virtualenv.activation.bash:BashActivator" -batch = "virtualenv.activation.batch:BatchActivator" -cshell = "virtualenv.activation.cshell:CShellActivator" -fish = "virtualenv.activation.fish:FishActivator" -nushell = "virtualenv.activation.nushell:NushellActivator" -powershell = "virtualenv.activation.powershell:PowerShellActivator" -python = "virtualenv.activation.python:PythonActivator" -[project.entry-points."virtualenv.create"] -cpython3-mac-brew = "virtualenv.create.via_global_ref.builtin.cpython.mac_os:CPython3macOsBrew" -cpython3-mac-framework = "virtualenv.create.via_global_ref.builtin.cpython.mac_os:CPython3macOsFramework" -cpython3-posix = "virtualenv.create.via_global_ref.builtin.cpython.cpython3:CPython3Posix" -cpython3-win = "virtualenv.create.via_global_ref.builtin.cpython.cpython3:CPython3Windows" -pypy3-posix = "virtualenv.create.via_global_ref.builtin.pypy.pypy3:PyPy3Posix" -pypy3-win = "virtualenv.create.via_global_ref.builtin.pypy.pypy3:Pypy3Windows" -venv = "virtualenv.create.via_global_ref.venv:Venv" -[project.entry-points."virtualenv.discovery"] -builtin = "virtualenv.discovery.builtin:Builtin" -[project.entry-points."virtualenv.seed"] -app-data = "virtualenv.seed.embed.via_app_data.via_app_data:FromAppData" -pip = "virtualenv.seed.embed.pip_invoke:PipInvoke" +entry-points."virtualenv.activate".bash = "virtualenv.activation.bash:BashActivator" +entry-points."virtualenv.activate".batch = "virtualenv.activation.batch:BatchActivator" +entry-points."virtualenv.activate".cshell = "virtualenv.activation.cshell:CShellActivator" +entry-points."virtualenv.activate".fish = "virtualenv.activation.fish:FishActivator" +entry-points."virtualenv.activate".nushell = "virtualenv.activation.nushell:NushellActivator" +entry-points."virtualenv.activate".powershell = "virtualenv.activation.powershell:PowerShellActivator" +entry-points."virtualenv.activate".python = "virtualenv.activation.python:PythonActivator" +entry-points."virtualenv.create".cpython3-mac-brew = "virtualenv.create.via_global_ref.builtin.cpython.mac_os:CPython3macOsBrew" +entry-points."virtualenv.create".cpython3-mac-framework = "virtualenv.create.via_global_ref.builtin.cpython.mac_os:CPython3macOsFramework" +entry-points."virtualenv.create".cpython3-posix = "virtualenv.create.via_global_ref.builtin.cpython.cpython3:CPython3Posix" +entry-points."virtualenv.create".cpython3-win = "virtualenv.create.via_global_ref.builtin.cpython.cpython3:CPython3Windows" +entry-points."virtualenv.create".pypy3-posix = "virtualenv.create.via_global_ref.builtin.pypy.pypy3:PyPy3Posix" +entry-points."virtualenv.create".pypy3-win = "virtualenv.create.via_global_ref.builtin.pypy.pypy3:Pypy3Windows" +entry-points."virtualenv.create".venv = "virtualenv.create.via_global_ref.venv:Venv" +entry-points."virtualenv.discovery".builtin = "virtualenv.discovery.builtin:Builtin" +entry-points."virtualenv.seed".app-data = "virtualenv.seed.embed.via_app_data.via_app_data:FromAppData" +entry-points."virtualenv.seed".pip = "virtualenv.seed.embed.pip_invoke:PipInvoke" [tool.hatch] build.hooks.vcs.version-file = "src/virtualenv/version.py" -build.targets.sdist.include = ["/src", "/tests", "/tasks", "/tox.ini"] +build.targets.sdist.include = [ + "/src", + "/tests", + "/tasks", + "/tox.ini", +] version.source = "vcs" [tool.ruff] line-length = 120 target-version = "py37" -lint.isort = { known-first-party = ["virtualenv"], required-imports = ["from __future__ import annotations"] } -lint.select = ["ALL"] +lint.isort = { known-first-party = [ + "virtualenv", +], required-imports = [ + "from __future__ import annotations", +] } +lint.select = [ + "ALL", +] lint.ignore = [ "CPY", # No copyright header "ANN", # no type checking added yet @@ -144,10 +152,14 @@ builtin = "clear,usage,en-GB_to_en-US" count = true [tool.pytest.ini_options] -markers = ["slow"] +markers = [ + "slow", +] timeout = 600 addopts = "--showlocals --no-success-flaky-report" -env = ["PYTHONIOENCODING=utf-8"] +env = [ + "PYTHONIOENCODING=utf-8", +] [tool.coverage] html.show_contexts = true @@ -159,12 +171,20 @@ report.omit = [ "**/src/virtualenv/activation/python/activate_this.py", "**/src/virtualenv/seed/wheels/embed/pip-*.whl/pip/**", ] -paths.source = ["src", "**/site-packages"] +paths.source = [ + "src", + "**/site-packages", +] report.fail_under = 76 -run.source = ["${_COVERAGE_SRC}", "tests"] +run.source = [ + "${_COVERAGE_SRC}", + "tests", +] run.dynamic_context = "test_function" run.parallel = true -run.plugins = ["covdefaults"] +run.plugins = [ + "covdefaults", +] run.relative_files = true [tool.towncrier] diff --git a/src/virtualenv/discovery/py_info.py b/src/virtualenv/discovery/py_info.py index 7fe1f54c1..882daa331 100644 --- a/src/virtualenv/discovery/py_info.py +++ b/src/virtualenv/discovery/py_info.py @@ -383,7 +383,7 @@ def from_exe( # noqa: PLR0913 if isinstance(proposed, PythonInfo) and resolve_to_host: try: proposed = proposed._resolve_to_system(app_data, proposed) # noqa: SLF001 - except Exception as exception: # noqa: BLE001 + except Exception as exception: if raise_on_error: raise logging.info("ignore %s due cannot resolve system due to %r", proposed.original_executable, exception) diff --git a/tasks/make_zipapp.py b/tasks/make_zipapp.py index 546d826cf..dec0f1fd1 100644 --- a/tasks/make_zipapp.py +++ b/tasks/make_zipapp.py @@ -52,7 +52,7 @@ def create_zipapp(dest, packages): print(f"zipapp created at {dest}") # noqa: T201 -def write_packages_to_zipapp(base, dist, modules, packages, zip_app): # noqa: C901 +def write_packages_to_zipapp(base, dist, modules, packages, zip_app): # noqa: C901, PLR0912 has = set() for name, p_w_v in packages.items(): # noqa: PLR1702 for platform, w_v in p_w_v.items(): diff --git a/tests/unit/activation/conftest.py b/tests/unit/activation/conftest.py index f1229ff6c..87e3307aa 100644 --- a/tests/unit/activation/conftest.py +++ b/tests/unit/activation/conftest.py @@ -41,7 +41,7 @@ def get_version(self, raise_on_fail): encoding="utf-8", ) out, err = process.communicate() - except Exception as exception: # noqa: BLE001 + except Exception as exception: self._version = exception if raise_on_fail: raise