/pipenv-cleanup

clean up pipenv virtualenvs for pipenv project homes that get deleted before deleting the virtualenvs

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

pipenv-cleanup

This is a script I use to clean up pipenv virtualenvs for pipenv project homes that I deleted before deleting the virtualenvs.

what you should do

$ mkdir something
$ cd something
$ pipenv install foo bar foo-bar
...
$ vim something.py
$ pipenv run python something.py
Hello World!
$ # A few hours later
$ pipenv --rm
$ cd ../
$ rm -rf something

what you actually do

$ mkdir investigating-something
$ cd investigating-something
$ pipenv install foo bar foo-bar
...
$ vim investigating-something.py
$ pipenv run python investigating-something.py
Hello World!
$ # A few hours later
$ cd ../
$ rm -rf investigating-something

time to clean up

$ /path/to/pipenv-cleanup.py
Found the following deleted pipenv project homes.

/home/user/investigating-something

Do you want to delete the corresponding pipenv virtualenvs?

/home/user/.local/share/virtualenvs/investigating-something-u88ilH1J

(y/N)n
no action taken
$ /path/to/pipenv-cleanup.py
Found the following deleted pipenv project homes.

/home/user/investigating-something

Do you want to delete the corresponding pipenv virtualenvs?

/home/user/.local/share/virtualenvs/investigating-something-u88ilH1J

(y/N)y
The pipenv virtualenvs have been deleted.
$ /path/to/pipenv-cleanup.py
There are no deleted pipenv project homes that still have pipenv virtualenvs.