Open juftin opened 10 months ago
The way that it's handled in this repo means we generate a lockfile for each Python version - if you wanted one lockfile for all python versions you could handle it like this and forget the hatch matrix entirely:
[tool.hatch.envs.default]
type = "pip-compile"
python = "3.11"
[tool.hatch.envs.test]
template = "test"
dependencies = [
"pytest",
"pytest-cov"
]
type = "pip-compile"
pip-compile-constraint = "default"
[tool.hatch.envs.test.scripts]
cov = [
"pytest --cov-config=pyproject.toml --cov {args:tests}"
]
This can be problematic in CI/CD where you run
hatch run +py={{ matrix.python }} matrix:cov
and havehatch.python
set to a differing version than your current matrix versionIn the above example you must have the
3.11
environment available to usepip-compile
environments from amatrix
becausedefault
is a constraint environmenthttps://github.com/juftin/hatch-pip-compile/actions/runs/7117731072/job/19379122673?pr=28
See how this is handled here: https://github.com/juftin/hatch-pip-compile/blob/238fd44410ece0b53f5f2eb059ae85406a3aba45/.github/workflows/tests.yaml#L41-L49
IMO this isn't a bug - but this should probably be documented