Open dan-hook opened 1 month ago
My best guess is that this bug was introduced in this PR.
Bummer I missed this -- if someone wants to take a shot at fixing it, I would be super appreciative. I head to SF for work this weekend and won't be able to look into it for at least a week.
@dan-hook could you take a look at https://github.com/pypa/pipenv/pull/6209 and help me determine if this is the right behavioral fix.
I am confused on one point -- it should leave the entries in the Pipfile right when using --all
or --all-dev
? It seems there is a really old test assertion for --all-dev
that checks it removes everything from the Pipfile dev, which feels weird and like a difference between what --all
and --all-dev
was supposed to do. I am thinking both flags should not clear Pipfile entires for that category.
I've never used --all-dev
, but I recall seeing the same strange behavior in the docs. Since a change in --all
behavior broke my workflow, I'd be sympathetic to anyone who had come to rely on the behavior of --all-dev
. If the current --all-dev
behavior is useful, it might be worth considering adding a -c, --categories
option to uninstall
, since uninstall --categories dev
seems like it should remove all packages from [dev-packages] in the Pipfile.
I'd be sympathetic to anyone who had come to rely on the behavior of --all-dev
Yeah me too, I restored that part of the PR -- that is the super hard thing about inheriting mainteance of this project, has been how undocumented and not always logical all the use cases have been and evolved. Something I hope to improve eventually is the documentation.
Issue description
Running
pipenv uninstall --all
(the command) with the latest version of pipenv uninstalls all packages in the[packages]
group and removes them from the Pipfile. It doesn't uninstall packages from any other group.Expected result
I had been relying on the behavior last seen in Release v2023.12.1, where running the command produced output like:
There's a minor bug in that output in that it only lists that it's uninstalling from the
[dev-packages]
and[packages]
group, but that's just a display issue. It does actually uninstall all packages in all groups from the virtual environment and leaves the Pipfile untouched. This is consistent with the documentation.Actual result
For this project, the
[packages]
group only contains one package,src-1.0
. All the other packages are in either[dev-packages]
or[layer-packages]
. The current version of pipenv only uninstalls packages from the[packages]
group and removes them from the Pipfile as well.Steps to replicate
Create a Pipfile with several groups:
Install all of the packages:
Now run the command:
Examine the Pipfile, and see that the
[packages]
group is empty, but the other groups are still populated. Examine the site-packages in the virtualenv and note that the all group packages are still there.Notes on the code
It appears that the
do_purge
function is now an orphan. There's no active code that will displayEnvironment now purged and fresh!
.