From 12dcdd269105f69e602b0eff3c8227c996f7b491 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 10 Feb 2025 20:19:27 +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/tox-dev/pyproject-fmt: 2.2.4 → v2.5.0](https://github.com/tox-dev/pyproject-fmt/compare/2.2.4...v2.5.0) - [github.com/astral-sh/ruff-pre-commit: v0.6.9 → v0.9.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.6.9...v0.9.6) - [github.com/pre-commit/mirrors-mypy: v1.11.2 → v1.15.0](https://github.com/pre-commit/mirrors-mypy/compare/v1.11.2...v1.15.0) - [github.com/codespell-project/codespell: v2.3.0 → v2.4.1](https://github.com/codespell-project/codespell/compare/v2.3.0...v2.4.1) --- .pre-commit-config.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a915b442c..fd5a61d09 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -7,17 +7,17 @@ repos: - id: trailing-whitespace - id: check-yaml - repo: https://github.com/tox-dev/pyproject-fmt - rev: "2.2.4" + rev: "v2.5.0" hooks: - id: pyproject-fmt - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.6.9 + rev: v0.9.6 hooks: - id: ruff args: [ "--fix", "--unsafe-fixes", "--show-fixes", "--exit-non-zero-on-fix"] - id: ruff-format - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.11.2 + rev: v1.15.0 hooks: - id: mypy args: ['--warn-unused-ignores', '--strict-equality','--no-implicit-optional', '--check-untyped-defs'] @@ -30,7 +30,7 @@ repos: - "tomli; python_version < '3.11'" # Configuration for codespell is in pyproject.toml - repo: https://github.com/codespell-project/codespell - rev: v2.3.0 + rev: v2.4.1 hooks: - id: codespell additional_dependencies: From e3518b6be2853d2cdfc82a9fe75478a2a89c4fc7 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 10 Feb 2025 20:21:00 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- pyproject.toml | 3 ++- src/pipx/commands/common.py | 4 ++-- src/pipx/main.py | 2 +- src/pipx/pipx_metadata_file.py | 2 +- src/pipx/venv.py | 2 +- testdata/empty_project/pyproject.toml | 1 + tests/test_animate.py | 4 ++-- tests/test_install.py | 12 ++++++------ 8 files changed, 16 insertions(+), 14 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index b78b5c299..2b2166c2e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -31,6 +31,7 @@ classifiers = [ "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", ] dynamic = [ "version", @@ -41,7 +42,7 @@ dependencies = [ "packaging>=20", "platformdirs>=2.1", "tomli; python_version<'3.11'", - "userpath!=1.9,>=1.6", + "userpath>=1.6,!=1.9", ] urls."Bug Tracker" = "https://github.com/pypa/pipx/issues" urls.Documentation = "https://pipx.pypa.io" diff --git a/src/pipx/commands/common.py b/src/pipx/commands/common.py index 0f187af97..04d814cb6 100644 --- a/src/pipx/commands/common.py +++ b/src/pipx/commands/common.py @@ -379,7 +379,7 @@ def package_name_from_spec(package_spec: str, python: str, *, pip_args: List[str # will use the pypi name package_name = pypi_name logger.info(f"Determined package name: {package_name}") - logger.info(f"Package name determined in {time.time()-start_time:.1f}s") + logger.info(f"Package name determined in {time.time() - start_time:.1f}s") return package_name # check syntax and clean up spec and pip_args @@ -390,7 +390,7 @@ def package_name_from_spec(package_spec: str, python: str, *, pip_args: List[str venv.create_venv(venv_args=[], pip_args=[]) package_name = venv.install_package_no_deps(package_or_url=package_spec, pip_args=pip_args) - logger.info(f"Package name determined in {time.time()-start_time:.1f}s") + logger.info(f"Package name determined in {time.time() - start_time:.1f}s") return package_name diff --git a/src/pipx/main.py b/src/pipx/main.py index f06e47c4e..c1e87a228 100644 --- a/src/pipx/main.py +++ b/src/pipx/main.py @@ -163,7 +163,7 @@ def __init__(self, venv_container: VenvContainer) -> None: self.packages = [str(p.name) for p in sorted(venv_container.iter_venv_dirs())] def use(self, prefix: str, **kwargs: Any) -> List[str]: - return [f"{prefix}{x[len(prefix):]}" for x in self.packages if x.startswith(canonicalize_name(prefix))] + return [f"{prefix}{x[len(prefix) :]}" for x in self.packages if x.startswith(canonicalize_name(prefix))] def get_pip_args(parsed_args: Dict[str, str]) -> List[str]: diff --git a/src/pipx/pipx_metadata_file.py b/src/pipx/pipx_metadata_file.py index 3362698e9..cb97510e7 100644 --- a/src/pipx/pipx_metadata_file.py +++ b/src/pipx/pipx_metadata_file.py @@ -114,7 +114,7 @@ def _convert_legacy_metadata(self, metadata_dict: Dict[str, Any]) -> Dict[str, A raise PipxError( f""" {self.venv_dir.name}: Unknown metadata version - {metadata_dict['pipx_metadata_version']}. Perhaps it was + {metadata_dict["pipx_metadata_version"]}. Perhaps it was installed with a later version of pipx. """ ) diff --git a/src/pipx/venv.py b/src/pipx/venv.py index 422de3da0..123eea6ee 100644 --- a/src/pipx/venv.py +++ b/src/pipx/venv.py @@ -348,7 +348,7 @@ def install_package_no_deps(self, package_or_url: str, pip_args: List[str]) -> s def get_venv_metadata_for_package(self, package_name: str, package_extras: Set[str]) -> VenvMetadata: data_start = time.time() venv_metadata = inspect_venv(package_name, package_extras, self.bin_path, self.python_path, self.man_path) - logger.info(f"get_venv_metadata_for_package: {1e3*(time.time()-data_start):.0f}ms") + logger.info(f"get_venv_metadata_for_package: {1e3 * (time.time() - data_start):.0f}ms") return venv_metadata def update_package_metadata( diff --git a/testdata/empty_project/pyproject.toml b/testdata/empty_project/pyproject.toml index 9b59eaa14..8f29ebbbd 100644 --- a/testdata/empty_project/pyproject.toml +++ b/testdata/empty_project/pyproject.toml @@ -20,6 +20,7 @@ classifiers = [ "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", ] scripts.empty-project = "empty_project.main:cli" entry-points."pipx.run".empty-project = "empty_project.main:cli" diff --git a/tests/test_animate.py b/tests/test_animate.py index d70e0b2e3..758d2bdb7 100644 --- a/tests/test_animate.py +++ b/tests/test_animate.py @@ -66,7 +66,7 @@ def test_delay_suppresses_output(capsys, monkeypatch): @pytest.mark.parametrize( "env_columns,expected_frame_message", [ - (45, f"{TEST_STRING_40_CHAR:.{45-6}}..."), + (45, f"{TEST_STRING_40_CHAR:.{45 - 6}}..."), (46, f"{TEST_STRING_40_CHAR}"), (47, f"{TEST_STRING_40_CHAR}"), ], @@ -87,7 +87,7 @@ def test_line_lengths_emoji(capsys, monkeypatch, env_columns, expected_frame_mes @pytest.mark.parametrize( "env_columns,expected_frame_message", [ - (43, f"{TEST_STRING_40_CHAR:.{43-4}}"), + (43, f"{TEST_STRING_40_CHAR:.{43 - 4}}"), (44, f"{TEST_STRING_40_CHAR}"), (45, f"{TEST_STRING_40_CHAR}"), ], diff --git a/tests/test_install.py b/tests/test_install.py index 2cff93688..e794e4122 100644 --- a/tests/test_install.py +++ b/tests/test_install.py @@ -409,15 +409,15 @@ def test_passed_python_and_force_flag_warning(pipx_temp_env, capsys): assert not run_pipx_cli(["install", "black", "--force"]) captured = capsys.readouterr() - assert ( - "--python is ignored when --force is passed." not in captured.out - ), "Should only print warning if both flags present" + assert "--python is ignored when --force is passed." not in captured.out, ( + "Should only print warning if both flags present" + ) assert not run_pipx_cli(["install", "pycowsay", "--force"]) captured = capsys.readouterr() - assert ( - "--python is ignored when --force is passed." not in captured.out - ), "Should not print warning if package does not exist yet" + assert "--python is ignored when --force is passed." not in captured.out, ( + "Should not print warning if package does not exist yet" + ) @pytest.mark.parametrize(