You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When tool.hatch.envs.default.python is specified after the first run (was not before) or amended, hatch keeps using the old version of python. In order to actually apply the change, the old environment should be deleted.
It might not be interpreted as a bug per ce, but it's not what is expected intuitively.
How to reproduce
Stage 1: No python version is specified under tool.hatch.*
Run: hatch run pytest
Hatch installs the latest available python version, for example, python=3.12
❯ hatch run pytest
============================================ test session starts ============================================
platform darwin -- Python 3.12.2, pytest-7.4.4, pluggy-1.4.0
...
Stage 2: Specify python version explicitly
pyproject.toml:
# ...
[tool.hatch.envs.default]
python=3.9
#...
Run: hatch run test
Expected: Hatch rebuild environment using python=3.9
Actual: Hatch keeps using python=3.12
To use python=3.9 you have to remove existing env manually, for example, hatch env prune
The text was updated successfully, but these errors were encountered:
nikitajz
changed the title
Hatch doesn't pick up python version when changed
Hatch doesn't pick up python version when changed in the config
Mar 15, 2024
+1 to this - it tripped me up because the docs say “dependencies are automatically synced” each time the environment is used, but it didn’t occur to me that this would mean only package dependencies and not python version.
Issue
When
tool.hatch.envs.default.python
is specified after the first run (was not before) or amended, hatch keeps using the old version of python. In order to actually apply the change, the old environment should be deleted.It might not be interpreted as a bug per ce, but it's not what is expected intuitively.
How to reproduce
Stage 1: No python version is specified under
tool.hatch.*
pyproject.toml:
Run:
hatch run pytest
Hatch installs the latest available python version, for example, python=3.12
Stage 2: Specify python version explicitly
pyproject.toml:
Run:
hatch run test
Expected: Hatch rebuild environment using
python=3.9
Actual: Hatch keeps using
python=3.12
To use
python=3.9
you have to remove existing env manually, for example,hatch env prune
The text was updated successfully, but these errors were encountered: