pypa-hatch/hatch.toml

139 lines
3.9 KiB
TOML

[envs.default]
dependencies = [
"coverage[toml]>=6.2",
"filelock>=3.7.1",
"pytest",
"pytest-cov",
"pytest-mock",
"pytest-randomly",
"pytest-rerunfailures",
"pytest-xdist",
"trustme",
]
post-install-commands = [
"python -m pip install --disable-pip-version-check {verbosity:flag:-1} -e ./backend",
]
[envs.default.overrides]
env.GITHUB_ACTIONS.env-vars = "COVERAGE_REPORT="
[envs.default.scripts]
# --cov must not come before an argument in order to use the sources defined by config
_cov = "pytest --cov --cov-report={env:COVERAGE_REPORT:term-missing} --cov-config=pyproject.toml"
dev = "pytest -p no:randomly --no-cov {args:tests}"
cov = "_cov -p no:randomly {args:tests}"
full = "_cov -n auto --reruns 5 --reruns-delay 3 -r aR {args:tests}"
[envs.test.overrides]
env.HERMETIC_TESTS.type = [
{ value = "container", if = ["true"] },
"virtual",
]
[[envs.test.matrix]]
python = ["37", "38", "39", "310"]
[envs.coverage]
detached = true
dependencies = [
"coverage[toml]>=6.2",
"lxml",
]
[envs.coverage.scripts]
combine = "coverage combine {args}"
report-xml = "coverage xml"
report-uncovered-html = "coverage html --skip-covered --skip-empty"
generate-summary = "python scripts/generate_coverage_summary.py"
write-summary-report = "python scripts/write_coverage_summary_report.py"
[envs.lint]
detached = true
dependencies = [
"bandit>=1.7.4",
"black>=22.6.0",
"flake8>=5.0.0",
"flake8-bugbear>=22.7.1",
"flake8-quotes>=3.3.1",
"flake8-tidy-imports>=4.8.0",
"isort>=5.10.1",
"mypy>=0.971",
]
[envs.lint.scripts]
typing = "mypy --install-types --non-interactive {args:backend/src/hatchling src/hatch tests}"
security = "bandit --quiet --recursive --skip B101,B102,B105,B110,B112,B301,B307,B324,B403,B404,B603,B604,B606,B607 {args:.}"
style = [
"flake8 {args:.}",
"black --check --diff {args:.}",
"isort --check-only --diff {args:.}",
]
fmt = [
"isort {args:.}",
"black {args:.}",
"style",
]
all = [
"style",
"typing",
"security",
]
[envs.docs]
dependencies = [
"mkdocs~=1.4.0",
"mkdocs-material~=8.5.6",
# Plugins
"mkdocs-minify-plugin~=0.5.0",
"mkdocs-git-revision-date-localized-plugin~=1.1.0",
"mkdocstrings-python~=0.7.1",
"mkdocs-redirects~=1.1.0",
"mkdocs-glightbox~=0.3.0",
# https://github.com/jimporter/mike/issues/82#issuecomment-1172913929
"mike @ https://github.com/jimporter/mike/archive/392d57b8bb9d14bcedf2451a0dc302709f8055eb.zip",
# Extensions
"mkdocs-click~=0.8.0",
"pymdown-extensions~=9.6.0",
# Necessary for syntax highlighting in code blocks
"pygments~=2.13.0",
# Validation
# https://github.com/linkchecker/linkchecker/pull/669#issuecomment-1267236287
"linkchecker @ git+https://github.com/linkchecker/linkchecker.git@d9265bb71c2054bf57b8c5734a4825d62505c779",
]
pre-install-commands = [
"python scripts/install_mkdocs_material_insiders.py",
]
[envs.docs.overrides]
env.GH_TOKEN_MKDOCS_MATERIAL_INSIDERS.env-vars = "MKDOCS_CONFIG=mkdocs.insiders.yml"
[envs.docs.env-vars]
SOURCE_DATE_EPOCH = "1580601600"
PYTHONUNBUFFERED = "1"
MKDOCS_CONFIG = "mkdocs.yml"
[envs.docs.scripts]
build = "mkdocs build --config-file {env:MKDOCS_CONFIG} --clean --strict {args}"
serve = "mkdocs serve --config-file {env:MKDOCS_CONFIG} --dev-addr localhost:8000 {args}"
ci-build = "mike deploy --config-file {env:MKDOCS_CONFIG} --update-aliases {args}"
validate = "linkchecker --config .linkcheckerrc site"
# https://github.com/linkchecker/linkchecker/issues/678
build-check = [
"build --no-directory-urls",
"validate",
]
[envs.backend]
detached = true
dependencies = [
"build~=0.7.0",
"httpx",
]
[envs.backend.env-vars]
HATCH_BUILD_CLEAN = "true"
[envs.backend.scripts]
build = "python -m build backend"
publish = "hatch publish backend/dist"
update-data = [
"update-classifiers",
"update-licenses",
]
update-licenses = "python backend/scripts/update_licenses.py"
update-classifiers = [
"pip install --upgrade trove-classifiers",
"python backend/scripts/update_classifiers.py",
]