From bc2f042aead4a60394fee5568f29efd155629623 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Thu, 18 Jan 2024 14:27:43 -0500 Subject: [PATCH 01/10] Add rudimentary codespell config --- pyproject.toml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 5c21a57ebd..169302c6d7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -86,3 +86,10 @@ package = "pipx" [[tool.mypy.overrides]] module = ["pycowsay.*"] ignore_missing_imports = true + +# Ref: https://github.com/codespell-project/codespell#using-a-config-file +[tool.codespell] +skip = '.git,*.pdf,*.svg,go.sum' +check-hidden = true +# ignore-regex = '' +# ignore-words-list = '' From 05f8bfc33b90ae93576d9a3ae488e9a3258de17a Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Thu, 18 Jan 2024 14:27:43 -0500 Subject: [PATCH 02/10] Add pre-commit definition for codespell --- .pre-commit-config.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7cae495c46..fa80f89c1e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -28,3 +28,10 @@ repos: - "packaging>=20" - "platformdirs>=2.1" - "tomli; python_version < '3.11'" +# Configuration for codespell is in pyproject.toml +- repo: https://github.com/codespell-project/codespell + rev: v2.2.6 + hooks: + - id: codespell + additional_dependencies: + - tomli From 73cb7630e222ae0321e82d110577659e4be03e31 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Thu, 18 Jan 2024 14:29:11 -0500 Subject: [PATCH 03/10] some ignores for codespell --- pyproject.toml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 169302c6d7..2fa33d6ef6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -91,5 +91,6 @@ ignore_missing_imports = true [tool.codespell] skip = '.git,*.pdf,*.svg,go.sum' check-hidden = true -# ignore-regex = '' -# ignore-words-list = '' +# case sensitive etc +ignore-regex = '\b(UE|path/doesnt/exist)\b' +ignore-words-list = 'astroid' From 91bff7e92ccfd66440b024103202c16517f5c5af Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 18 Jan 2024 19:33:05 +0000 Subject: [PATCH 04/10] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- pyproject.toml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 2fa33d6ef6..306245e3af 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -71,6 +71,13 @@ lint.extend-select = [ lint.isort = {known-first-party = ["helpers", "package_info", "pipx"]} lint.mccabe.max-complexity = 15 +[tool.codespell] +skip = '.git,*.pdf,*.svg,go.sum' +check-hidden = true +# case sensitive etc +ignore-regex = '\b(UE|path/doesnt/exist)\b' +ignore-words-list = 'astroid' + [tool.pytest.ini_options] markers = ["all_packages: test install with maximum number of packages"] @@ -88,9 +95,3 @@ module = ["pycowsay.*"] ignore_missing_imports = true # Ref: https://github.com/codespell-project/codespell#using-a-config-file -[tool.codespell] -skip = '.git,*.pdf,*.svg,go.sum' -check-hidden = true -# case sensitive etc -ignore-regex = '\b(UE|path/doesnt/exist)\b' -ignore-words-list = 'astroid' From 6b386498fefaecb552e4bcd673bc4cae25621cc7 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Thu, 18 Jan 2024 14:37:36 -0500 Subject: [PATCH 05/10] Move comment as well to reside within the config section for codespell --- pyproject.toml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 306245e3af..b39787e452 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -72,6 +72,7 @@ lint.isort = {known-first-party = ["helpers", "package_info", "pipx"]} lint.mccabe.max-complexity = 15 [tool.codespell] +# Ref: https://github.com/codespell-project/codespell#using-a-config-file skip = '.git,*.pdf,*.svg,go.sum' check-hidden = true # case sensitive etc @@ -93,5 +94,3 @@ package = "pipx" [[tool.mypy.overrides]] module = ["pycowsay.*"] ignore_missing_imports = true - -# Ref: https://github.com/codespell-project/codespell#using-a-config-file From cf25a32c0cd0c821419f93262bcbe2edd8e0d2c7 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Fri, 19 Jan 2024 17:41:49 -0500 Subject: [PATCH 06/10] skip .nox and do not look for go.sum --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index b39787e452..ad9d6019ed 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -73,7 +73,7 @@ lint.mccabe.max-complexity = 15 [tool.codespell] # Ref: https://github.com/codespell-project/codespell#using-a-config-file -skip = '.git,*.pdf,*.svg,go.sum' +skip = '.git,*.pdf,*.svg,.nox' check-hidden = true # case sensitive etc ignore-regex = '\b(UE|path/doesnt/exist)\b' From 2bedf581b12594071c9b05aa9b3aef29a5275880 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Fri, 19 Jan 2024 17:43:33 -0500 Subject: [PATCH 07/10] [DATALAD RUNCMD] run codespell throughout fixing typo automagically === Do not change lines below === { "chain": [], "cmd": "codespell -w", "exit": 0, "extra_inputs": [], "inputs": [], "outputs": [], "pwd": "." } ^^^ Do not change lines above ^^^ --- CHANGELOG.md | 2 +- docs/how-pipx-works.md | 4 ++-- src/pipx/main.py | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ff44484bf1..24b12b0854 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -76,7 +76,7 @@ This project uses [*towncrier*](https://towncrier.readthedocs.io/) for keeping t ### Improved Documentation -- Add additonal example for --pip-args option, to docs/examples.md +- Add additional example for --pip-args option, to docs/examples.md ## [1.3.1](https://github.com/pypa/pipx/tree/1.3.1) diff --git a/docs/how-pipx-works.md b/docs/how-pipx-works.md index f24bd6fcd5..509ec5055a 100644 --- a/docs/how-pipx-works.md +++ b/docs/how-pipx-works.md @@ -3,7 +3,7 @@ When installing a package and its binaries on linux (`pipx install package`) pipx will - create directory `~/.local/share/pipx/venvs/PACKAGE` -- create or re-use a shared virtual environment that contains shared packaging library `pip` in +- create or reuse a shared virtual environment that contains shared packaging library `pip` in `~/.local/share/pipx/shared/` - ensure the library is updated to its latest version - create a Virtual Environment in `~/.local/share/pipx/venvs/PACKAGE` that uses the shared pip mentioned above but @@ -19,7 +19,7 @@ When installing a package and its binaries on linux (`pipx install package`) pip When running a binary (`pipx run BINARY`), pipx will -- create or re-use a shared virtual environment that contains the shared packaging library `pip` +- create or reuse a shared virtual environment that contains the shared packaging library `pip` - ensure the library is updated to its latest version - create a temporary directory (or reuse a cached virtual environment for this package) with a name based on a hash of the attributes that make the run reproducible. This includes things like the package name, spec, python version, and diff --git a/src/pipx/main.py b/src/pipx/main.py index 86fe38ac98..618653932b 100644 --- a/src/pipx/main.py +++ b/src/pipx/main.py @@ -593,7 +593,7 @@ def _add_run(subparsers: argparse._SubParsersAction, shared_parser: argparse.Arg then run an app from it. The environment will be cached and re-used for up to {constants.TEMP_VENV_EXPIRATION_THRESHOLD_DAYS} days. This means subsequent calls to 'run' for the same package will be faster - since they can re-use the cached Virtual Environment. + since they can reuse the cached Virtual Environment. In support of PEP 582 'run' will use apps found in a local __pypackages__ directory, if present. Please note that this behavior is experimental, @@ -606,7 +606,7 @@ def _add_run(subparsers: argparse._SubParsersAction, shared_parser: argparse.Arg p.add_argument( "--no-cache", action="store_true", - help="Do not re-use cached virtual environment if it exists", + help="Do not reuse cached virtual environment if it exists", ) p.add_argument( "app_with_args", From 7b22610cbf9bd8fc7695f896355cc4cccb0ca723 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Mon, 22 Jan 2024 12:00:10 -0500 Subject: [PATCH 08/10] Ignore all testdata (and not just one package name) --- pyproject.toml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index ad9d6019ed..f619a491ae 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -73,11 +73,10 @@ lint.mccabe.max-complexity = 15 [tool.codespell] # Ref: https://github.com/codespell-project/codespell#using-a-config-file -skip = '.git,*.pdf,*.svg,.nox' +skip = '.git,*.pdf,*.svg,.nox,testdata' check-hidden = true # case sensitive etc ignore-regex = '\b(UE|path/doesnt/exist)\b' -ignore-words-list = 'astroid' [tool.pytest.ini_options] markers = ["all_packages: test install with maximum number of packages"] From d2ccbcec348f2ecaf6bb4be8899a43b00773845c Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Mon, 22 Jan 2024 15:25:54 -0500 Subject: [PATCH 09/10] Workaround for the codespell issue - duplicate exclude of testdata in pre-commit config ref: https://github.com/codespell-project/codespell/issues/3196 --- .pre-commit-config.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index fa80f89c1e..54cb33cc01 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -35,3 +35,4 @@ repos: - id: codespell additional_dependencies: - tomli + exclude: ^testdata From 299d48a0307ce5c54cb2bb878e8ab50389ccba38 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Mon, 22 Jan 2024 16:46:13 -0500 Subject: [PATCH 10/10] Also ignore mypy_cache --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index f619a491ae..fdd3433009 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -73,7 +73,7 @@ lint.mccabe.max-complexity = 15 [tool.codespell] # Ref: https://github.com/codespell-project/codespell#using-a-config-file -skip = '.git,*.pdf,*.svg,.nox,testdata' +skip = '.git,*.pdf,*.svg,.nox,testdata,.mypy_cache' check-hidden = true # case sensitive etc ignore-regex = '\b(UE|path/doesnt/exist)\b'