From a3693a796df87a05177577da2752d1b78a72a270 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Thu, 4 Sep 2025 12:54:24 +0200 Subject: [PATCH 1/2] Fix typos discovered by codespell --- .pre-commit-config.yaml | 56 ++++++++++++++++++++++++++++++++++++++++ CHANGELOG.md | 4 +-- docs/advanced/ssl.md | 4 +-- httpx/_multipart.py | 2 +- httpx/_urlparse.py | 4 +-- pyproject.toml | 5 +++- tests/models/test_url.py | 2 +- 7 files changed, 68 insertions(+), 9 deletions(-) create mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000000..fce94bdb83 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,56 @@ +# Learn more about this config here: https://pre-commit.com/ + +# To enable these pre-commit hooks run: `uv tool install pre-commit` +# or `pipx install pre-commit` or `brew install pre-commit`, etc. +# Then in the project root directory run `pre-commit install` + +repos: + #- repo: https://github.com/pre-commit/pre-commit-hooks + # rev: v6.0.0 + # hooks: + # - id: check-added-large-files + # - id: check-ast + # - id: check-builtin-literals + # - id: check-case-conflict + # - id: check-docstring-first + # - id: check-executables-have-shebangs + # - id: check-json + # - id: check-merge-conflict + # - id: check-shebang-scripts-are-executable + # - id: check-symlinks + # - id: check-toml + # - id: check-vcs-permalinks + # - id: check-xml + # - id: check-yaml + # - id: debug-statements + # - id: destroyed-symlinks + # - id: detect-private-key + # - id: end-of-file-fixer + # - id: file-contents-sorter + # - id: fix-byte-order-marker + # - id: forbid-new-submodules + # - id: forbid-submodules + # - id: mixed-line-ending + # args: + # - --fix=lf + # - id: requirements-txt-fixer + # - id: sort-simple-yaml + # - id: trailing-whitespace + + - repo: https://github.com/codespell-project/codespell + rev: v2.4.1 + hooks: + - id: codespell # See pyproject.toml for args + additional_dependencies: + - tomli + + #- repo: https://github.com/pre-commit/mirrors-mypy + # rev: v1.17.1 + # hooks: + # - id: mypy + + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.12.11 + hooks: + - id: ruff-check + # - id: ruff-format diff --git a/CHANGELOG.md b/CHANGELOG.md index 13bbfcdb79..48cdce7bf5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,7 +16,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## 0.28.0 (28th November, 2024) -Be aware that the default *JSON request bodies now use a more compact representation*. This is generally considered a prefered style, tho may require updates to test suites. +Be aware that the default *JSON request bodies now use a more compact representation*. This is generally considered a preferred style, tho may require updates to test suites. The 0.28 release includes a limited set of deprecations... @@ -151,7 +151,7 @@ Our revised [SSL documentation](docs/advanced/ssl.md) covers how to implement th ### Removed -* The `rfc3986` dependancy has been removed. (#2252) +* The `rfc3986` dependency has been removed. (#2252) ## 0.23.3 (4th January, 2023) diff --git a/docs/advanced/ssl.md b/docs/advanced/ssl.md index da40ed2843..8e08c91e02 100644 --- a/docs/advanced/ssl.md +++ b/docs/advanced/ssl.md @@ -29,7 +29,7 @@ import certifi import httpx import ssl -# This SSL context is equivelent to the default `verify=True`. +# This SSL context is equivalent to the default `verify=True`. ctx = ssl.create_default_context(cafile=certifi.where()) client = httpx.Client(verify=ctx) ``` @@ -46,7 +46,7 @@ ctx = truststore.SSLContext(ssl.PROTOCOL_TLS_CLIENT) client = httpx.Client(verify=ctx) ``` -Loding an alternative certificate verification store using [the standard SSL context API](https://docs.python.org/3/library/ssl.html)... +Loading an alternative certificate verification store using [the standard SSL context API](https://docs.python.org/3/library/ssl.html)... ```python import httpx diff --git a/httpx/_multipart.py b/httpx/_multipart.py index b4761af9b2..31843c729b 100644 --- a/httpx/_multipart.py +++ b/httpx/_multipart.py @@ -130,7 +130,7 @@ def __init__(self, name: str, value: FileTypes) -> None: # This large tuple based API largely mirror's requests' API # It would be good to think of better APIs for this that we could # include in httpx 2.0 since variable length tuples(especially of 4 elements) - # are quite unwieldly + # are quite unwieldy if isinstance(value, tuple): if len(value) == 2: # neither the 3rd parameter (content_type) nor the 4th (headers) diff --git a/httpx/_urlparse.py b/httpx/_urlparse.py index bf190fd560..8b8f8de978 100644 --- a/httpx/_urlparse.py +++ b/httpx/_urlparse.py @@ -250,8 +250,8 @@ def urlparse(url: str = "", **kwargs: str | None) -> ParseResult: # Replace "raw_path" with "path" and "query". if "raw_path" in kwargs: raw_path = kwargs.pop("raw_path") or "" - kwargs["path"], seperator, kwargs["query"] = raw_path.partition("?") - if not seperator: + kwargs["path"], separator, kwargs["query"] = raw_path.partition("?") + if not separator: kwargs["query"] = None # Ensure that IPv6 "host" addresses are always escaped with "[...]". diff --git a/pyproject.toml b/pyproject.toml index eb9e5c9a3d..2a66203215 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -123,10 +123,13 @@ filterwarnings = [ "ignore: trio.MultiError is deprecated since Trio 0.22.0:trio.TrioDeprecationWarning" ] markers = [ - "copied_from(source, changes=None): mark test as copied from somewhere else, along with a description of changes made to accodomate e.g. our test setup", + "copied_from(source, changes=None): mark test as copied from somewhere else, along with a description of changes made to accommodate e.g. our test setup", "network: marks tests which require network connection. Used in 3rd-party build environments that have network disabled." ] [tool.coverage.run] omit = ["venv/*"] include = ["httpx/*", "tests/*"] + +[tool.codespell] +ignore-words-list = "asend,te" diff --git a/tests/models/test_url.py b/tests/models/test_url.py index 03072e8f5c..b4a39cb5d1 100644 --- a/tests/models/test_url.py +++ b/tests/models/test_url.py @@ -285,7 +285,7 @@ def test_url_leading_dot_prefix_on_relative_url(): def test_param_with_space(): # Params passed as form key-value pairs should be form escaped, - # Including the special case of "+" for space seperators. + # Including the special case of "+" for space separators. url = httpx.URL("http://webservice", params={"u": "with spaces"}) assert str(url) == "http://webservice?u=with+spaces" From f08272113776ce121279eb5c235ad7f927d0990b Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Wed, 17 Sep 2025 14:54:22 +0200 Subject: [PATCH 2/2] Delete .pre-commit-config.yaml --- .pre-commit-config.yaml | 56 ----------------------------------------- 1 file changed, 56 deletions(-) delete mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml deleted file mode 100644 index fce94bdb83..0000000000 --- a/.pre-commit-config.yaml +++ /dev/null @@ -1,56 +0,0 @@ -# Learn more about this config here: https://pre-commit.com/ - -# To enable these pre-commit hooks run: `uv tool install pre-commit` -# or `pipx install pre-commit` or `brew install pre-commit`, etc. -# Then in the project root directory run `pre-commit install` - -repos: - #- repo: https://github.com/pre-commit/pre-commit-hooks - # rev: v6.0.0 - # hooks: - # - id: check-added-large-files - # - id: check-ast - # - id: check-builtin-literals - # - id: check-case-conflict - # - id: check-docstring-first - # - id: check-executables-have-shebangs - # - id: check-json - # - id: check-merge-conflict - # - id: check-shebang-scripts-are-executable - # - id: check-symlinks - # - id: check-toml - # - id: check-vcs-permalinks - # - id: check-xml - # - id: check-yaml - # - id: debug-statements - # - id: destroyed-symlinks - # - id: detect-private-key - # - id: end-of-file-fixer - # - id: file-contents-sorter - # - id: fix-byte-order-marker - # - id: forbid-new-submodules - # - id: forbid-submodules - # - id: mixed-line-ending - # args: - # - --fix=lf - # - id: requirements-txt-fixer - # - id: sort-simple-yaml - # - id: trailing-whitespace - - - repo: https://github.com/codespell-project/codespell - rev: v2.4.1 - hooks: - - id: codespell # See pyproject.toml for args - additional_dependencies: - - tomli - - #- repo: https://github.com/pre-commit/mirrors-mypy - # rev: v1.17.1 - # hooks: - # - id: mypy - - - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.12.11 - hooks: - - id: ruff-check - # - id: ruff-format