Skip to content

Commit

Permalink
Add codespell: config, workflow, pre-commit config and make it fix fe…
Browse files Browse the repository at this point in the history
…w typos (#1219)

* Add rudimentary codespell config

* Add pre-commit definition for codespell

* some ignores for codespell

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Move comment as well to reside within the config section for codespell

* skip .nox and do not look for go.sum

* [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 ^^^

* Ignore all testdata (and not just one package name)

* Workaround for the codespell issue - duplicate exclude of testdata in pre-commit config

ref: codespell-project/codespell#3196

* Also ignore mypy_cache

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
yarikoptic and pre-commit-ci[bot] authored Jan 23, 2024
1 parent 39a47a9 commit 10cbc9c
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 5 deletions.
8 changes: 8 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,11 @@ 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
exclude: ^testdata
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
4 changes: 2 additions & 2 deletions docs/how-pipx-works.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
7 changes: 7 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,13 @@ lint.extend-select = [
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,.nox,testdata,.mypy_cache'
check-hidden = true
# case sensitive etc
ignore-regex = '\b(UE|path/doesnt/exist)\b'

[tool.pytest.ini_options]
markers = ["all_packages: test install with maximum number of packages"]

Expand Down
4 changes: 2 additions & 2 deletions src/pipx/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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",
Expand Down

0 comments on commit 10cbc9c

Please sign in to comment.