From a3609580d57e2603b23dd66434b349559bc9986c Mon Sep 17 00:00:00 2001 From: James Braza <jamesbraza@gmail.com> Date: Wed, 11 Oct 2023 04:23:00 -0400 Subject: [PATCH] `codespell` in `pre-commit` (#8040) * Moved codespell to pre-commit, and removed venv/.git ignores * Fixed two codespell errors that somehow now are revealed * Added CHANGELOG entry * Fixed comment tab and matched ordering to tools * Added astroid and momento to ignore words list --- .pre-commit-config.yaml | 5 +++++ CHANGELOG.md | 5 +++++ Makefile | 3 +-- examples/multimodal/data/llama/index_guide.md | 2 +- experimental/openai_fine_tuning/validate_json.py | 2 +- pyproject.toml | 5 ++--- requirements.txt | 1 - 7 files changed, 15 insertions(+), 8 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f7bb30538d..7c0ae83613 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -29,3 +29,8 @@ repos: rev: v0.23.1 hooks: - id: toml-sort-fix + - repo: https://github.com/codespell-project/codespell + rev: v2.2.6 + hooks: + - id: codespell + additional_dependencies: [tomli] diff --git a/CHANGELOG.md b/CHANGELOG.md index 5bad577310..42c202e7e5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # ChangeLog +## Unreleased + +### New Features +- Moves `codespell` to `pre-commit` (#8040) + ## [0.8.43] - 2023-10-10 ### New Features diff --git a/Makefile b/Makefile index 39301bac85..bd2936e223 100644 --- a/Makefile +++ b/Makefile @@ -6,10 +6,9 @@ help: ## Show all Makefile targets. format: ## Run code autoformatters (black). black . -lint: ## Run linters: mypy, black, codespell, ruff +lint: ## Run linters: pre-commit (black, ruff, codespell) and mypy pre-commit install && pre-commit run --all-files mypy . - codespell . test: ## Run tests via pytest. pytest tests diff --git a/examples/multimodal/data/llama/index_guide.md b/examples/multimodal/data/llama/index_guide.md index 3e57cdcfbd..4dae03ecab 100644 --- a/examples/multimodal/data/llama/index_guide.md +++ b/examples/multimodal/data/llama/index_guide.md @@ -17,7 +17,7 @@ The summary index simply stores Nodes as a sequential chain. ### Querying During query time, if no other query parameters are specified, LlamaIndex simply loads all Nodes in the list into -our Reponse Synthesis module. +our Response Synthesis module.  diff --git a/experimental/openai_fine_tuning/validate_json.py b/experimental/openai_fine_tuning/validate_json.py index a8aab77506..2b720d4248 100644 --- a/experimental/openai_fine_tuning/validate_json.py +++ b/experimental/openai_fine_tuning/validate_json.py @@ -165,7 +165,7 @@ def validate_json(data_path: str) -> None: f"~{n_epochs * n_billing_tokens_in_dataset} tokens" ) - print("As of Augest 22, 2023, fine-tuning gpt-3.5-turbo is $0.008 / 1K Tokens.") + print("As of August 22, 2023, fine-tuning gpt-3.5-turbo is $0.008 / 1K Tokens.") print( "This means your total cost for training will be " f"${n_billing_tokens_in_dataset * 0.008 / 1000} per epoch." diff --git a/pyproject.toml b/pyproject.toml index 0cc248f2f2..235c8029a5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,11 +5,10 @@ requires = ["poetry-core"] [tool.codespell] check-filenames = true check-hidden = true -ignore-words-list = "ot,gallary,rouge,narl" -# Remove .git and venv skips when integrated with pre-commit +ignore-words-list = "astroid,gallary,momento,narl,ot,rouge" # Feel free to un-skip examples, and experimental, you will just need to # work through many typos (--write-changes and --interactive will help) -skip = "poetry.lock,./.git,./*venv,./examples,./experimental,*.csv,*.html,*.json,*.jsonl,*.pdf,*.txt,*.ipynb" +skip = "./examples,./experimental,*.csv,*.html,*.json,*.jsonl,*.pdf,*.txt,*.ipynb" [tool.mypy] disallow_untyped_defs = true diff --git a/requirements.txt b/requirements.txt index 8969be08fa..de8e27b5c0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -17,7 +17,6 @@ types-setuptools==67.1.0.0 # linting black[jupyter]==23.9.1 -codespell[toml]>=v2.2.6 mypy==0.991 pre-commit==3.2.0 pylint==2.15.10 -- GitLab