Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add clean option for Makefile #9

Merged
merged 3 commits into from
Jan 18, 2024
Merged

Conversation

nghi01
Copy link
Collaborator

@nghi01 nghi01 commented Jan 14, 2024

Recently had a problem when forgotting to clean venv on my Windows machine leading to Permission Error. Looks like it's treating the venv created on my previous session as not belonging to me. Weird, but cleaning it and remaking the venv solves the issue, so I'm just creating an option for cleaning for convenience if anyone needs it.

Recently had a problem when forgotting to clean venv on windows leading to Permission Error. Looks like it's treating the venv created on my previous session as not belonging to me. Weird, but cleaning it and remaking the venv solves the issue.
Makefile Outdated Show resolved Hide resolved
Makefile Outdated

clean:
@echo "I'm cleaning OwO"
rm -rf venv
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be better to not pull the supporting directory out from underneath an activated virtualenv.
Please add a guard to detect if the virtualenv is active and deactivate it if so.

Something like:

declare -F deactivate && deactivate
rm -rf venv

deactivate is a shell function that is inserted into the environment when source venv/bin/activate is run and removed when deactivate is called.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, apparently Makefile cannot find the deactivate or the activate command to call. Based on this, it seems like every make command is executed in a new shell, which leads to our problem. One solution I found is we can use virtualenvwrapper as an extension, but we should decide together to use it or not.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've heard good things about virtualenvwrapper. Initially stuck with virtualenv since it's commonly used.

Other ones to look at before finalizing on that are the pyenv plugins for virtualenvs:
https://github.com/pyenv/pyenv-virtualenv
https://github.com/pyenv/pyenv-virtualenvwrapper

Copy link
Collaborator Author

@nghi01 nghi01 Jan 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good. I've cleared the clean-env and will work on the virtualenvwrapper on my own free time. Should be ready to get merged now so you can merge your coverage PR.

Makefile Outdated Show resolved Hide resolved
@zimmermatt zimmermatt merged commit 013d763 into zimmermatt:main Jan 18, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants