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

Move configurations to pyproject.toml, use ruff #754

Merged
merged 9 commits into from
Jul 13, 2023
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,55 @@ path = "README.md"

[[tool.hatch.metadata.hooks.fancy-pypi-readme.fragments]]
path = "CHANGELOG.md"

[tool.mypy]
strict = true
show_error_codes = true

[[tool.mypy.overrides]]
module = "tests.*"
disallow_untyped_defs = false
check_untyped_defs = true

[[tool.mypy.overrides]]
module = "h2.*"
ignore_missing_imports = true

[[tool.mypy.overrides]]
module = "hpack.*"
ignore_missing_imports = true

[tool.isort]
profile = "black"
combine_as_imports = true
known_first_party = "httpcore,tests"
known_third_party = "brotli,certifi,chardet,cryptography,h11,h2,hstspreload,pytest,rfc3986,setuptools,sniffio,trio,trustme,urllib3,uvicorn"
skip = ["httpcore/_sync/,tests/_sync"]

karpetrosyan marked this conversation as resolved.
Show resolved Hide resolved
[tool.pytest.ini_options]
addopts = ["-rxXs", "--strict-config", "--strict-markers"]
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"]
filterwarnings = ["error"]

[tool.coverage.run]
omit = [
"venv/*",
"httpcore/_sync/*"
]
include = ["httpcore/*", "tests/*"]

[tool.ruff]
exclude = [
"httpcore/_sync",
"tests/_sync",
]
line-length = 120
select = [
"E",
"F",
"W",
"I"
]

[tool.ruff.isort]
combine-as-imports = true
7 changes: 2 additions & 5 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,9 @@ twine

# Tests & Linting
anyio==3.6.2
autoflake==1.7.7
black==23.3.0
coverage==7.2.7
flake8==3.9.2 # See: https://github.com/PyCQA/flake8/pull/1438
isort==5.11.4
importlib-metadata==4.13.0
coverage[toml]==7.2.7
ruff==0.0.277
mypy==1.2.0
trio-typing==0.8.0
types-certifi==2021.10.8.3
Expand Down
3 changes: 1 addition & 2 deletions scripts/check
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ export SOURCE_FILES="httpcore tests"

set -x

${PREFIX}isort --check --diff --project=httpcore $SOURCE_FILES
${PREFIX}ruff check --show-source $SOURCE_FILES
${PREFIX}black --exclude '/(_sync|sync_tests)/' --check --diff --target-version=py37 $SOURCE_FILES
karpetrosyan marked this conversation as resolved.
Show resolved Hide resolved
${PREFIX}flake8 $SOURCE_FILES
${PREFIX}mypy $SOURCE_FILES
scripts/unasync --check
2 changes: 1 addition & 1 deletion scripts/lint
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export SOURCE_FILES="httpcore tests"
set -x

${PREFIX}autoflake --in-place --recursive --remove-all-unused-imports $SOURCE_FILES
karpetrosyan marked this conversation as resolved.
Show resolved Hide resolved
${PREFIX}isort --project=httpcore $SOURCE_FILES
${PREFIX}ruff --fix $SOURCE_FILES
${PREFIX}black --target-version=py37 --exclude '/(_sync|sync_tests)/' $SOURCE_FILES
karpetrosyan marked this conversation as resolved.
Show resolved Hide resolved

# Run unasync last because its `--check` mode is not aware of code formatters.
Expand Down
36 changes: 0 additions & 36 deletions setup.cfg

This file was deleted.