pypa / hatch

Modern, extensible Python project management
https://hatch.pypa.io/latest/
MIT License
5.89k stars 292 forks source link

hatch env prune leaves a directory in LOCALAPPDATA #737

Open pfmoore opened 1 year ago

pfmoore commented 1 year ago

I was trying out the environment features of hatch. In doing so, I created environments linked to a bunch of scratch directories. To tidy up, I ran hatch env prune, which according to the help, "Removes all environments". However, although the environments are removed, there's still a directory $env:LOCALAPPDATA\hatch\env\virtual\ppp left (for the project directory ppp). I would have expected hatch env prune to remove all trace of the project directory from the virtual environment shared area, but that doesn't seem to be the case.

If hatch env prune doesn't remove that top-level directory by design, how do I remove it? More generally, what's the command I should use to get hatch to completely forget about a project, so that I can safely delete the project without leaving any linked information lying around (now orphaned)?

ofek commented 1 year ago

The logic for that resides here https://github.com/pypa/hatch/blob/2f685c7de285eed72b0bb0f4b01ef251e9ab033d/src/hatch/env/virtual.py#L83-L87

I'll tackle this soon 👍

More generally, what's the command I should use to get hatch to completely forget about a project

Pretty much just the pruning command for environments

pfmoore commented 1 year ago

OK, so you're saying it's unintended, and the directory getting left behind is "just" a bug. That's cool. It's not urgent, obviously, so get to it whenever you can.