Dependencies are not removed after installation if removed from the dependency list
Hatch v1.3.1:
From the documentation:
Hatch ensures that environments are always compatible with the currently defined project dependencies.
However hatch only installs dependencies and does not remove them again even though the dep hash changes. This forces the user to use hatch env prune after removing a dependency.
Reproduce steps:
New template project:
$ hatch dep hash
ffd6dbb9ba774bb118e45997c1ec7bbf9d23e3c5c56b1780b45c666df6802e96
$ hatch run cowsay hi
/bin/sh: 1: cowsay: not found
Adding cowsay to dependencies in pyproject.toml.
$ hatch dep hash
04c5d630d30002861e7d0eb88cff9fcd5cbfad1bc6879e6fbd8adfb09d03b94b
$ hatch run cowsay hi
__
| hi |
==
\
\
^__^
(oo)\_______
(__)\ )\/\
||----w |
|| ||
Removing cowsay from dependencies in pyproject.toml.
$ hatch dep hash
ffd6dbb9ba774bb118e45997c1ec7bbf9d23e3c5c56b1780b45c666df6802e96
$ hatch run cowsay hi
__
| hi |
==
\
\
^__^
(oo)\_______
(__)\ )\/\
||----w |
|| ||
I'll do this when lock files happen 👍
While waiting for the standard lock files graal :wink: I quickly mashed up hatch and pip-deepfreeze into a hatch environment plugin.
This installs locked dependencies, locks new dependencies, and uninstalls unneeded dependencies automatically when entering hatch environments. It's a bit chatty (since it shows the pip log), but it does the job - for single platform without hashes use cases.
Did I say the hatch plugin system is cool yet ?
Oh wow, nice job!