forked from Diaoul/subliminal
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use hatch and hatch-vcs (Diaoul#1192)
* use hatch and hatch-vcs * update github action to use hatch envs * add news * CI run doctest
- Loading branch information
Showing
5 changed files
with
179 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Use hatch builder and hatch-vcs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
# https://hatch.pypa.io/latest/config/environment/overview/ | ||
# --------------------------------------------------------- | ||
[envs.default] | ||
description = "Development environment" | ||
installer = "uv pip install" | ||
features = [ | ||
"tests", | ||
"types", | ||
"docs", | ||
"dev", | ||
] | ||
|
||
# --------------------------------------------------------- | ||
[envs.pkg] | ||
description = "package information" | ||
features = [ | ||
"tests", | ||
"dev", | ||
] | ||
[envs.pkg.scripts] | ||
show = [ | ||
"uv pip list --format=columns", | ||
'python -c "import sys; print(sys.version); print(sys.executable)"', | ||
] | ||
|
||
# --------------------------------------------------------- | ||
[envs.lint] | ||
template = "lint" | ||
installer = "uv pip install" | ||
description = "lint and format" | ||
detached = true | ||
dependencies = ["pre-commit"] | ||
|
||
[envs.lint.scripts] | ||
run = "pre-commit run --all-files --show-diff-on-failure" | ||
|
||
# --------------------------------------------------------- | ||
[envs.types] | ||
template = "types" | ||
installer = "uv pip install" | ||
description = "Run the type checker" | ||
dev-mode = false | ||
features = ["tests", "types"] | ||
|
||
[envs.types.scripts] | ||
run = "mypy --install-types --non-interactive --ignore-missing-imports --config-file={root}/pyproject.toml {args:src tests}" | ||
|
||
# --------------------------------------------------------- | ||
[envs.docs] | ||
template = "docs" | ||
installer = "uv pip install" | ||
description = "build and check documentation" | ||
features = ["docs"] | ||
# Keep in sync with CI.yaml/docs, tox/docs and .readthedocs.yaml. | ||
python = "3.12" | ||
|
||
[envs.docs.scripts] | ||
build = "sphinx-build -W --keep-going --color -b html docs docs/_build" | ||
linkcheck = "sphinx-build -W --keep-going --color -b linkcheck docs docs/_build" | ||
doctest = "sphinx-build -W --keep-going --color -b doctest docs docs/_build" | ||
run = ["build", "linkcheck"] | ||
all = ["build", "linkcheck", "doctest"] | ||
|
||
# --------------------------------------------------------- | ||
[envs.changelog] | ||
template = "changelog" | ||
installer = "uv pip install" | ||
description = "build changelog with towncrier" | ||
dev-mode = false | ||
dependencies = ["towncrier"] | ||
|
||
[envs.changelog.scripts] | ||
run = "towncrier build --version main --draft" | ||
|
||
# --------------------------------------------------------- | ||
[envs.tests] | ||
template = "tests" | ||
#installer = "uv pip install" | ||
description = "Run the tests suite" | ||
dev-mode = false | ||
features = ["tests"] | ||
|
||
[[envs.tests.matrix]] | ||
python = ["3.9", "3.10", "3.11", "3.12", "3.13"] | ||
|
||
[envs.tests.env-vars] | ||
COVERAGE_PROCESS_START = "pyproject.toml" | ||
COVERAGE_FILE = "report/.coverage.{matrix:python}" | ||
|
||
[envs.tests.overrides] | ||
# To allow environment variable overwrite | ||
env.COVERAGE_FILE.env-vars = "COVERAGE_FILE" | ||
env.COVERAGE_PROCESS_START.env-vars = "COVERAGE_PROCESS_START" | ||
|
||
[envs.tests.scripts] | ||
run = "pytest {args:-n auto}" | ||
test-cov = "python -m pytest --cov=subliminal --cov-report= --cov-fail-under=0 {args:-n auto}" | ||
test-cov-core = "python -m pytest -m core --cov=subliminal --cov-report= --cov-fail-under=0 {args:-n auto}" | ||
run-cov = [ | ||
"test-cov", | ||
"coverage report --skip-covered --show-missing --fail-under=80", | ||
] | ||
run-cov-core = [ | ||
"test-cov-core", | ||
"""\ | ||
coverage report --skip-covered --show-missing --fail-under=100 \ | ||
--omit='src/subliminal/cli.py,src/subliminal/converters/*,src/subliminal/providers/*,src/subliminal/refiners/*' \ | ||
""", | ||
] | ||
|
||
# --------------------------------------------------------- | ||
[envs.coverage] | ||
template = "coverage" | ||
installer = "uv pip install" | ||
description = "combine coverage files" | ||
detached = true | ||
dependencies = [ | ||
"coverage[toml]>=7.3.2", | ||
] | ||
env-vars = { COVERAGE_FILE = "report/.coverage" } | ||
# To allow environment variable overwrite | ||
overrides = { env.COVERAGE_FILE.env-vars = "COVERAGE_FILE" } | ||
|
||
[envs.coverage.scripts] | ||
run = [ | ||
"- coverage combine report", | ||
"coverage report --sort=-Cover --show-missing --skip-covered --skip-empty", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters