From 625d69ef1f477e2085c95264fea543e39cefa4da Mon Sep 17 00:00:00 2001 From: karosis88 Date: Wed, 25 Oct 2023 09:15:12 +0300 Subject: [PATCH 1/7] Use ruff format instead of black --- httpcore/_models.py | 1 - pyproject.toml | 3 ++- requirements.txt | 3 +-- scripts/check | 3 ++- scripts/lint | 3 ++- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/httpcore/_models.py b/httpcore/_models.py index 11bfcd84..b21adfd2 100644 --- a/httpcore/_models.py +++ b/httpcore/_models.py @@ -16,7 +16,6 @@ # Functions for typechecking... - HeadersAsSequence = Sequence[Tuple[Union[bytes, str], Union[bytes, str]]] HeadersAsMapping = Mapping[Union[bytes, str], Union[bytes, str]] HeaderTypes = Union[HeadersAsSequence, HeadersAsMapping, None] diff --git a/pyproject.toml b/pyproject.toml index 719fb180..1ee7171c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -106,7 +106,7 @@ exclude = [ "httpcore/_sync", "tests/_sync", ] -line-length = 120 +line-length = 88 select = [ "E", "F", @@ -114,5 +114,6 @@ select = [ "I" ] +ignore = ["E501"] [tool.ruff.isort] combine-as-imports = true diff --git a/requirements.txt b/requirements.txt index 3c18d1ca..88667d46 100644 --- a/requirements.txt +++ b/requirements.txt @@ -13,9 +13,8 @@ build==1.0.3 twine # Tests & Linting -black==23.7.0 coverage[toml]==7.3.0 -ruff==0.0.291 +ruff==0.1.2 mypy==1.5.1 trio-typing==0.8.0 types-certifi==2021.10.8.3 diff --git a/scripts/check b/scripts/check index cf0dba53..e10d16b3 100755 --- a/scripts/check +++ b/scripts/check @@ -5,10 +5,11 @@ if [ -d 'venv' ] ; then export PREFIX="venv/bin/" fi export SOURCE_FILES="httpcore tests" +SOURCE_FILES_WITHOUT_SYNC=$(find httpcore tests -maxdepth 1 -not -path "*/_sync*" -type d) set -x ${PREFIX}ruff check --show-source $SOURCE_FILES -${PREFIX}black --exclude '/(_sync|sync_tests)/' --check --diff $SOURCE_FILES +${PREFIX}ruff format $SOURCE_FILES_WITHOUT_SYNC --check ${PREFIX}mypy $SOURCE_FILES scripts/unasync --check diff --git a/scripts/lint b/scripts/lint index 22a40d75..5ccdd9c5 100755 --- a/scripts/lint +++ b/scripts/lint @@ -7,9 +7,10 @@ fi export SOURCE_FILES="httpcore tests" set -x +SOURCE_FILES_WITHOUT_SYNC=$(find httpcore tests -maxdepth 1 -not -path "*/_sync*" -type d) ${PREFIX}ruff --fix $SOURCE_FILES -${PREFIX}black --exclude '/(_sync|sync_tests)/' $SOURCE_FILES +${PREFIX}ruff format $SOURCE_FILES_WITHOUT_SYNC # Run unasync last because its `--check` mode is not aware of code formatters. # (This means sync code isn't prettified, and that's mostly okay.) From 1b306654fc155db0d077b44b8fe346a956cd6491 Mon Sep 17 00:00:00 2001 From: Kar Petrosyan <92274156+karpetrosyan@users.noreply.github.com> Date: Wed, 25 Oct 2023 12:32:02 +0300 Subject: [PATCH 2/7] Update scripts/check --- scripts/check | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/check b/scripts/check index e10d16b3..d9954c08 100755 --- a/scripts/check +++ b/scripts/check @@ -10,6 +10,6 @@ SOURCE_FILES_WITHOUT_SYNC=$(find httpcore tests -maxdepth 1 -not -path "*/_sync* set -x ${PREFIX}ruff check --show-source $SOURCE_FILES -${PREFIX}ruff format $SOURCE_FILES_WITHOUT_SYNC --check +${PREFIX}ruff format $SOURCE_FILES_WITHOUT_SYNC --diff ${PREFIX}mypy $SOURCE_FILES scripts/unasync --check From 0ed1f186d09205be4a15bc0fcbe2de85cff12ef5 Mon Sep 17 00:00:00 2001 From: karpetrosyan Date: Fri, 3 Nov 2023 14:58:01 +0400 Subject: [PATCH 3/7] Keep the 120 line limit --- httpcore/_models.py | 1 + pyproject.toml | 4 +++- requirements.txt | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/httpcore/_models.py b/httpcore/_models.py index b21adfd2..11bfcd84 100644 --- a/httpcore/_models.py +++ b/httpcore/_models.py @@ -16,6 +16,7 @@ # Functions for typechecking... + HeadersAsSequence = Sequence[Tuple[Union[bytes, str], Union[bytes, str]]] HeadersAsMapping = Mapping[Union[bytes, str], Union[bytes, str]] HeaderTypes = Union[HeadersAsSequence, HeadersAsMapping, None] diff --git a/pyproject.toml b/pyproject.toml index 1ee7171c..8e7ccf50 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -114,6 +114,8 @@ select = [ "I" ] -ignore = ["E501"] +[tool.ruff.pycodestyle] +max-line-length = 120 + [tool.ruff.isort] combine-as-imports = true diff --git a/requirements.txt b/requirements.txt index 88667d46..d84a0878 100644 --- a/requirements.txt +++ b/requirements.txt @@ -14,7 +14,7 @@ twine # Tests & Linting coverage[toml]==7.3.0 -ruff==0.1.2 +ruff==0.1.3 mypy==1.5.1 trio-typing==0.8.0 types-certifi==2021.10.8.3 From a30632d2dd5ee6d12cecc89c440ae0fb7ed901bf Mon Sep 17 00:00:00 2001 From: karpetrosyan Date: Mon, 13 Nov 2023 11:08:09 +0400 Subject: [PATCH 4/7] Simplify ruff format --- scripts/check | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/check b/scripts/check index d9954c08..02ed35c0 100755 --- a/scripts/check +++ b/scripts/check @@ -5,11 +5,10 @@ if [ -d 'venv' ] ; then export PREFIX="venv/bin/" fi export SOURCE_FILES="httpcore tests" -SOURCE_FILES_WITHOUT_SYNC=$(find httpcore tests -maxdepth 1 -not -path "*/_sync*" -type d) set -x ${PREFIX}ruff check --show-source $SOURCE_FILES -${PREFIX}ruff format $SOURCE_FILES_WITHOUT_SYNC --diff +${PREFIX}ruff format $SOURCE_FILES --diff ${PREFIX}mypy $SOURCE_FILES scripts/unasync --check From 3bcfe58fb4bfbf5793409c76ab6d22262ab736c6 Mon Sep 17 00:00:00 2001 From: karpetrosyan Date: Mon, 13 Nov 2023 11:09:41 +0400 Subject: [PATCH 5/7] Update scripts/lint --- scripts/lint | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/lint b/scripts/lint index 5ccdd9c5..ec38987d 100755 --- a/scripts/lint +++ b/scripts/lint @@ -7,10 +7,9 @@ fi export SOURCE_FILES="httpcore tests" set -x -SOURCE_FILES_WITHOUT_SYNC=$(find httpcore tests -maxdepth 1 -not -path "*/_sync*" -type d) ${PREFIX}ruff --fix $SOURCE_FILES -${PREFIX}ruff format $SOURCE_FILES_WITHOUT_SYNC +${PREFIX}ruff format $SOURCE_FILES # Run unasync last because its `--check` mode is not aware of code formatters. # (This means sync code isn't prettified, and that's mostly okay.) From fd0ef87db200c634aa5639cb53ad8499eef6d71b Mon Sep 17 00:00:00 2001 From: Kar Petrosyan <92274156+karpetrosyan@users.noreply.github.com> Date: Wed, 29 Nov 2023 14:23:18 +0400 Subject: [PATCH 6/7] Update pyproject.toml Co-authored-by: T-256 <132141463+T-256@users.noreply.github.com> --- pyproject.toml | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 8e7ccf50..3aa2de67 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -106,16 +106,7 @@ exclude = [ "httpcore/_sync", "tests/_sync", ] -line-length = 88 -select = [ - "E", - "F", - "W", - "I" -] - -[tool.ruff.pycodestyle] -max-line-length = 120 +select = ["E", "F", "W", "I"] [tool.ruff.isort] combine-as-imports = true From 4c362e9cbd201580da4198bc3933282a175b12c4 Mon Sep 17 00:00:00 2001 From: karpetrosyan Date: Thu, 30 Nov 2023 10:04:54 +0400 Subject: [PATCH 7/7] Revert "Update pyproject.toml" This reverts commit fd0ef87db200c634aa5639cb53ad8499eef6d71b. --- pyproject.toml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 3aa2de67..8e7ccf50 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -106,7 +106,16 @@ exclude = [ "httpcore/_sync", "tests/_sync", ] -select = ["E", "F", "W", "I"] +line-length = 88 +select = [ + "E", + "F", + "W", + "I" +] + +[tool.ruff.pycodestyle] +max-line-length = 120 [tool.ruff.isort] combine-as-imports = true