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

chore: DROP 3.8, leverage hatch to run tests and static analisys #1221

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all 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
145 changes: 107 additions & 38 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ classifiers = [
"License :: OSI Approved :: BSD License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Topic :: Software Development :: Libraries :: Python Modules",
]
dependencies = [
Expand All @@ -30,25 +30,11 @@ dependencies = [

[project.optional-dependencies]
dev = ["black", "mypy", "pylint"]
test = [
"pytest",
"pytest-asyncio",
"pytest-benchmark",
"pytest-cov",
"pytest-mock",
"freezegun",
"syrupy",
"werkzeug",
"httpx",
"opentracing",
"opentelemetry-api",
"python-multipart>=0.0.5",
"aiodataloader",
"graphql-sync-dataloaders;python_version>\"3.7\"",
]
asgi-file-uploads = ["python-multipart>=0.0.5"]
tracing = ["opentracing"]
telemetry = ["opentelemetry-api"]
types = ["mypy[faster-cache]>=1.0.0"]


[project.urls]
"Homepage" = "https://ariadnegraphql.org/"
Expand All @@ -68,35 +54,118 @@ exclude = [
"tests",
]

# Environment configuration

## Default environment

[tool.hatch.envs.default]
features = ["dev", "test"]
features = ["dev", "types"]

[tool.hatch.envs.default.scripts]
test = "coverage run -m pytest"
check = [
"hatch fmt",
"hatch test -a -p",
"hatch test --cover",
"hatch run types:check",
]

[tool.black]
line-length = 88
target-version = ['py36', 'py37', 'py38']
include = '\.pyi?$'
exclude = '''
/(
\.eggs
| \.git
| \.hg
| \.mypy_cache
| \.tox
| \.venv
| _build
| buck-out
| build
| dist
| snapshots
)/
'''
## Types environment

[tool.hatch.envs.types.scripts]
check = "mypy --install-types --non-interactive"

## Test environment

[tool.hatch.envs.hatch-test]
extra-dependencies = [
"pytest",
"pytest-asyncio",
"pytest-benchmark",
"pytest-cov",
"pytest-mock",
"freezegun",
"syrupy",
"werkzeug",
"httpx",
"opentracing",
"opentelemetry-api",
"python-multipart>=0.0.5",
"aiodataloader",
"graphql-sync-dataloaders;python_version>\"3.7\"",
]
extra-args = []

[[tool.hatch.envs.hatch-test.matrix]]
python = ["3.9", "3.10", "3.11", "3.12", "3.13"]

# Tool configuration

## Pytest configuration

[tool.pytest.ini_options]
asyncio_mode = "strict"
asyncio_default_fixture_loop_scope = "function"
testpaths = ["tests"]

## Types configuration

[tool.mypy]
python_version = "3.9"
files = ["ariadne", "tests_mypy"]
check_untyped_defs = true
# disallow_untyped_defs = true
ignore_missing_imports = true
# warn_redundant_casts = true
# warn_unused_ignores = true
# disallow_any_generics = true
no_implicit_reexport = true
# strict = true
disable_error_code = ["import-untyped"]

## Coverage configuration

[tool.coverage.run]
source = ["ariadne", "tests"]

[tool.coverage.report]
exclude_also = [
"def __repr__",
"if self.debug:",
"if settings.DEBUG",
"raise AssertionError",
"raise NotImplementedError",
"if 0:",
"if __name__ == .__main__.:",
"if TYPE_CHECKING:",
"class .*\\bProtocol\\):",
"@(abc\\.)?abstractmethod",
]
omit = ["*/__about__.py", "*/__main__.py", "*/cli/__init__.py"]
fail_under = 90

## Ruff configuration

[tool.ruff]
line-length = 88
target-version = "py39"

[tool.ruff.format]
docstring-code-format = true
docstring-code-line-length = 80

[tool.ruff.lint]
select = ["E", "F", "G", "I", "N", "Q", "UP", "C90", "T20", "TID"]
ignore = ["TID252"]

# [tool.ruff.lint.flake8-tidy-imports]
# ban-relative-imports = "all"

[tool.ruff.lint.mccabe]
max-complexity = 10

[tool.ruff.lint.isort]
known-first-party = ["ariadne"]

[tool.ruff.lint.flake8-pytest-style]
fixture-parentheses = false
mark-parentheses = false
Loading