Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request: pulling latest dictionary in pre-commit hook #3542

Open
jamesbraza opened this issue Sep 13, 2024 · 2 comments
Open

Request: pulling latest dictionary in pre-commit hook #3542

jamesbraza opened this issue Sep 13, 2024 · 2 comments

Comments

@jamesbraza
Copy link
Contributor

I use codespell as a pre-commit hook, and I love it. It's really quite useful.

Normally, a new release of codespell comes with the latest dictionary.txt. I would like to be able to pull the latest dictionary.txt without relying on a codespell release. #116 made the same request, and ultimately made these docs: https://github.com/codespell-project/codespell#updating-the-dictionaries

However, these docs are not applicable to pre-commit users, as the dictionary.txt is ultimately squirreled away somewhere in ~/.cache/pre-commit/:

> find ~/.cache/pre-commit -name "dictionary.txt"
/Users/user/.cache/pre-commit/repo4_vfx6q6/codespell_lib/data/dictionary.txt
/Users/user/.cache/pre-commit/repo4_vfx6q6/build/lib/codespell_lib/data/dictionary.txt
/Users/user/.cache/pre-commit/repo4_vfx6q6/py_env-python3/lib/python3.12/site-packages/codespell_lib/data/dictionary.txt
/Users/user/.cache/pre-commit/repoa0vhi7kx/codespell_lib/data/dictionary.txt

The request is, can codespell expose some CLI flag that triggers codespell to use the latest dictionary.txt on master (or some arbitrary codespell repo's commit ID).

@jamesobutler
Copy link

The request is, can codespell expose some CLI flag that triggers codespell to use the latest dictionary.txt on master

@jamesbraza Using main as the target wouldn't be something supported as per https://pre-commit.com/#using-the-latest-version-for-a-repository as the configuration is ultimately supposed to be a repeatable experience.

(or some arbitrary codespell repo's commit ID).

Yes you can already specify to use latest (6ed5df1) as completed by pre_commit autoupdate --bleeding-edge. See below:

 - repo: https://github.com/codespell-project/codespell
-  rev: v2.3.0
+  rev: 6ed5df16e9ddd436d6c093669e6d5e73de7c3dd1
   hooks:
   - id: codespell

@jamesbraza
Copy link
Contributor Author

Thanks for the suggestion, though it's not totally what I was looking for. I think with bleeding edge:

  1. The dictionary.txt always gets better: this is good
  2. The core codespell package may get issues on its HEAD branch that would my repo's CI's stability

What I want is a way to get the benefits of item 1 without the downsides of item 2. In other words, I mainly want the latest dictionary.txt, but actually don't want the latest codespell package version (it can stay at rev of v2.3.0).

So I am hoping there can be a better way, perhaps using pre-commit's additional_dependencies, where the dictionary.txt is a standalone PyPI package that gets autoreleased weekly with CalVer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants