Open
Description
This can be problematic in CI/CD where you run hatch run +py={{ matrix.python }} matrix:cov
and have hatch.python
set to a differing version than your current matrix version
[tool.hatch.envs.default]
pip-compile-constraint = "default"
type = "pip-compile"
python = "3.11"
[tool.hatch.envs.test]
dependencies = [
"pytest",
"pytest-cov"
]
[tool.hatch.envs.test.scripts]
cov = [
"pytest --cov-config=pyproject.toml --cov {args:tests}"
]
[tool.hatch.envs.matrix]
template = "test"
[[tool.hatch.envs.matrix.matrix]]
python = ["3.8", "3.9", "3.10", "3.11", "3.12"]
In the above example you must have the 3.11
environment available to use pip-compile
environments from a matrix
because default
is a constraint environment
AttributeError: 'NoneType' object has no attribute 'executable'
See how this is handled here:
hatch-pip-compile/.github/workflows/tests.yaml
Lines 41 to 49 in 238fd44
IMO this isn't a bug - but this should probably be documented