improve virtual environments

This commit is contained in:
Sina Atalay
2024-12-10 03:07:45 -05:00
parent 1de8c591e5
commit e199999b2e

View File

@@ -129,6 +129,7 @@ rendercv = 'rendercv.cli:app'
[tool.hatch.envs.default]
installer = "uv"
python = "3.13"
# Dependencies to be installed in the `default` virtual environment.
dependencies = [
"ruff", # to lint and format the code
@@ -141,8 +142,8 @@ dependencies = [
"time-machine==2.15.0", # to select an arbitrary date and time for testing
"pypdf==4.3.1", # to read PDF files
]
[[tool.hatch.envs.default.matrix]]
python = ["3.10", "3.11", "3.12", "3.13"]
[tool.hatch.envs.default.extra-scripts]
pip = "{env:HATCH_UV} pip {args}"
[tool.hatch.envs.default.scripts]
# Hatch allows us to define scripts that can be run in the activated virtual environment
# with `hatch run ENV_NAME:SCRIPT_NAME`.
@@ -152,16 +153,21 @@ format = "ruff check --fix && ruff format && black rendercv docs tests" # hatch
lint = "ruff check rendercv tests" # hatch run lint
# Check types in the `rendercv` package with `pyright`:
check-types = "pyright rendercv && pyright tests" # hatch run check-types
# Run pre-commit checks:
precommit = "pre-commit run --all-files" # hatch run pre-commit
# Run the tests:
test = "pytest" # hatch run test
# Run the tests and generate the coverage report as HTML:
test-and-report = "coverage run -m pytest && pytest -k \"test_watcher\" && coverage combine && coverage report && coverage html --show-contexts" # hatch run test-and-report
# Run pre-commit checks:
precommit = "pre-commit run --all-files" # hatch run pre-commit
[tool.hatch.envs.test]
template = "default"
[[tool.hatch.envs.test.matrix]]
python = ["3.10", "3.11", "3.12", "3.13"]
[tool.hatch.envs.docs]
installer = "uv"
python = "3.13"
# Dependencies to be installed in the `docs` virtual environment.
dependencies = [
"mkdocs-material==9.5.34", # to build docs
@@ -170,6 +176,8 @@ dependencies = [
"pillow==10.4.0", # lock the dependency of pdfCropMargins
"mkdocs-macros-plugin==1.0.5", # to be able to have dynamic content in the documentation
]
[tool.hatch.envs.docs.extra-scripts]
pip = "{env:HATCH_UV} pip {args}"
[tool.hatch.envs.docs.scripts]
# Build the documentation with `mkdocs`:
build = "mkdocs build --clean --strict" # hatch run docs:build