From 6d7acc78b993e7f400aad6de8c18a9a651016043 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Mon, 13 Nov 2023 11:28:28 -0500 Subject: [PATCH] Add codespell config and add to pre-commit (#10893) Co-authored-by: Serina Grill <42048900+serinamarie@users.noreply.github.com> --- .codespellrc | 6 ++++++ .github/ISSUE_TEMPLATE/2_ui_bug_report.yaml | 2 +- .github/ISSUE_TEMPLATE/5_maintenance_ticket.yaml | 2 +- .github/workflows/python-tests.yaml | 4 ++-- .pre-commit-config.yaml | 5 +++++ .ruff.toml | 2 +- RELEASE-NOTES.md | 2 +- client/README.md | 2 +- requirements-dev.txt | 1 + src/prefect/_internal/pydantic/v2_schema.py | 2 +- src/prefect/_internal/pytz.py | 2 +- tests/server/orchestration/test_rules.py | 4 ++-- 12 files changed, 23 insertions(+), 11 deletions(-) create mode 100644 .codespellrc diff --git a/.codespellrc b/.codespellrc new file mode 100644 index 000000000000..8655652cadcd --- /dev/null +++ b/.codespellrc @@ -0,0 +1,6 @@ +[codespell] +skip = .git,*.pdf,*.svg,versioneer.py,package-lock.json,_vendor,*.css,.codespellrc +# from https://github.com/PrefectHQ/prefect/pull/10813#issuecomment-1732676130 +ignore-regex = .*lazy=\"selectin\"|.*e import Bloc$|America/Nome +ignore-words-list = selectin,aci,wqs,aks,ines,dependant +check-hidden = true diff --git a/.github/ISSUE_TEMPLATE/2_ui_bug_report.yaml b/.github/ISSUE_TEMPLATE/2_ui_bug_report.yaml index fdfb448587c7..b41721ad8a11 100644 --- a/.github/ISSUE_TEMPLATE/2_ui_bug_report.yaml +++ b/.github/ISSUE_TEMPLATE/2_ui_bug_report.yaml @@ -66,7 +66,7 @@ body: - type: checkboxes attributes: - label: Browers + label: Browsers description: Which browsers was this bug reproduced on? Please check if your issue is specific to your browser by testing on another browser. options: - label: Chrome diff --git a/.github/ISSUE_TEMPLATE/5_maintenance_ticket.yaml b/.github/ISSUE_TEMPLATE/5_maintenance_ticket.yaml index af6606c0a190..df4507a5ded1 100644 --- a/.github/ISSUE_TEMPLATE/5_maintenance_ticket.yaml +++ b/.github/ISSUE_TEMPLATE/5_maintenance_ticket.yaml @@ -1,4 +1,4 @@ -name: 🛠️ Track a maintenence task +name: 🛠️ Track a maintenance task description: These are for changes that are not user or product related for maintenance of this repository. labels: ["maintenance"] body: diff --git a/.github/workflows/python-tests.yaml b/.github/workflows/python-tests.yaml index 6ddbdd8ced7a..ab6ad927770f 100644 --- a/.github/workflows/python-tests.yaml +++ b/.github/workflows/python-tests.yaml @@ -67,7 +67,7 @@ jobs: include: # Include Docker image builds on the service test run, and disallow the test - # suite from building images automaticlly in fixtures + # suite from building images automatically in fixtures - pytest-options: "--only-services" build-docker-images: true @@ -253,7 +253,7 @@ jobs: include: # Include Docker image builds on the service test run, and disallow the test - # suite from building images automaticlly in fixtures + # suite from building images automatically in fixtures - pytest-options: "--only-services" build-docker-images: true diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 021c0f2524c4..211446fd2687 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -11,3 +11,8 @@ repos: - id: black language_version: python3 args: ['--preview'] + - repo: https://github.com/codespell-project/codespell + rev: v2.2.5 + hooks: + - id: codespell + exclude: package-lock.json|_vendor/.* diff --git a/.ruff.toml b/.ruff.toml index e1517bef7352..f26004b8d2e9 100644 --- a/.ruff.toml +++ b/.ruff.toml @@ -7,7 +7,7 @@ extend-select = ["I"] ignore = ["E501"] [per-file-ignores] -# Do not inforce usage and import order rules in init files +# Do not enforce usage and import order rules in init files "__init__.py" = ["E402", "F401", "I"] # Do not fix import in compatibility module diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 9976965c536e..65a43bc0acdc 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -319,7 +319,7 @@ See implementation details in the following pull requests: ### Enabling Pydantic V2 -In 2.13.5 we released experimental support for Pydantic V2, which made it co-installable via forced install. In this release, we are enabling co-installation by default which will allow you to leverage Pydantic V2 in your flows and tasks. Additionally, you can choose to update to Pydantic V2 on your own timeline as we maintain compatability with V1 within flows and tasks. +In 2.13.5 we released experimental support for Pydantic V2, which made it co-installable via forced install. In this release, we are enabling co-installation by default which will allow you to leverage Pydantic V2 in your flows and tasks. Additionally, you can choose to update to Pydantic V2 on your own timeline as we maintain compatibility with V1 within flows and tasks. See implementation details in the following pull request: - https://github.com/PrefectHQ/prefect/pull/10946 diff --git a/client/README.md b/client/README.md index ca82b85f6656..ea8bdc6391c5 100644 --- a/client/README.md +++ b/client/README.md @@ -21,7 +21,7 @@ tests to ensure that the built `prefect-client` is functional. In general, these builds, smoke tests, and publish steps should be transparent. It these automated steps fail, use the `client/build_client.sh` script to run -the build and smoke test locally and interate on a fix. The failures will likely +the build and smoke test locally and iterate on a fix. The failures will likely be from: - including a new dependency that is not installed in `prefect-client` diff --git a/requirements-dev.txt b/requirements-dev.txt index a87fdddba8c0..58df955be44a 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,5 +1,6 @@ ruff cairosvg +codespell flaky # Pin IPython to 8.12 when building on Python 3.8 # https://github.com/ipython/ipython/blob/main/README.rst diff --git a/src/prefect/_internal/pydantic/v2_schema.py b/src/prefect/_internal/pydantic/v2_schema.py index f96d43f90502..cdd73f5a494b 100644 --- a/src/prefect/_internal/pydantic/v2_schema.py +++ b/src/prefect/_internal/pydantic/v2_schema.py @@ -95,7 +95,7 @@ def create_v2_schema(name_: str, model_cfg: ConfigDict, **model_fields): ref_template="#/definitions/{model}", schema_generator=GenerateEmptySchemaForUserClasses, ) - # ensure backwards compatability by copying $defs into definitions + # ensure backwards compatibility by copying $defs into definitions if "$defs" in schema: schema["definitions"] = schema["$defs"] return schema diff --git a/src/prefect/_internal/pytz.py b/src/prefect/_internal/pytz.py index 3552cfcbb04d..a21bd8a45651 100644 --- a/src/prefect/_internal/pytz.py +++ b/src/prefect/_internal/pytz.py @@ -1,5 +1,5 @@ """ -This is a compatability module that allows us to drop our dependency on pytz in the mimimal prefect-client. +This is a compatibility module that allows us to drop our dependency on pytz in the minimal prefect-client. All values here are taken from: diff --git a/tests/server/orchestration/test_rules.py b/tests/server/orchestration/test_rules.py index 68754fb04cdf..cf4cbed8836b 100644 --- a/tests/server/orchestration/test_rules.py +++ b/tests/server/orchestration/test_rules.py @@ -1570,7 +1570,7 @@ async def cleanup(self, initial_state, validated_state, context): before_transition_hook.assert_called_once() if proposed_state_type is not None: after_transition_hook.assert_not_called() - cleanup_hook.assert_called_once(), "Cleanup should be called when trasition is aborted" + cleanup_hook.assert_called_once(), "Cleanup should be called when transition is aborted" else: after_transition_hook.assert_called_once(), "Rule expected no transition" cleanup_hook.assert_not_called() @@ -1635,7 +1635,7 @@ async def cleanup(self, initial_state, validated_state, context): before_transition_hook.assert_called_once() if proposed_state_type is not None: after_transition_hook.assert_not_called() - cleanup_hook.assert_called_once(), "Cleanup should be called when trasition is aborted" + cleanup_hook.assert_called_once(), "Cleanup should be called when transition is aborted" else: after_transition_hook.assert_called_once(), "Rule expected no transition" cleanup_hook.assert_not_called()