-
-
Notifications
You must be signed in to change notification settings - Fork 309
Make targets for a virtualenv #1280
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
Conversation
README.md
Outdated
The Makefile can create the necessary Python virtual environment for you: | ||
|
||
```sh | ||
make venv |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you make requirements.txt
a dependency of .venv
, you can then make .venv
a dependency of the default target. If so, users would only need to run make
instead of make venv
followed by make
.
Given that and @webknjaz suggestion about the activation script, this could become just make
as it was originally documented
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@handrews I think this comment still applies. The venv
is now part of the all
target, so users can just run make
Sorry for the delay on this, and thanks for the valuable input @webknjaz and @jviotti . My understanding of I made a "clean" target that gets rid of the venv as well, and a "spec-clean" target that does not. Does that seem correct, or should "clean" just remove the built specs, and then we have a "clean-all" or "clean-venv" or something that either removes everything or just removes the venv? |
FWIW many Python projects just use tox or nox and not Makefile which is not really native to the Python ecosystem. Also, you may want to make use of |
@webknjaz for now I just want something that works at all. I don't have time to delve into additional tools, although if someone wants to pick that up they're more than welcome to. |
It's common to make a virtualenv inside of your cloned repo to ensure that you have the right enviornment for that repository, and .venv is a common convention for that virtualenv. This adds targets to create and clean a .venv virtual env using the checked-in requirements.txt file. It also adds the .venv to the .gitignore, and updates the README.
Much better usage of make, incorporate venv into default target and clean target, add a spec-clean target to avoid having to always rebuild the venv.
Makefile
Outdated
$(VENV): requirements.txt | ||
python -m venv $@ | ||
$@/bin/python -m pip install --upgrade pip | ||
$@/bin/python -m pip install -r requirements.txt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You probably want to refer to requirements.txt
as $<
README.md
Outdated
The Makefile can create the necessary Python virtual environment for you: | ||
|
||
```sh | ||
make venv |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@handrews I think this comment still applies. The venv
is now part of the all
target, so users can just run make
It's common to make a virtualenv inside of your cloned repo
to ensure that you have the right enviornment for that repository,
and .venv is a common convention for that virtualenv.
This adds targets to create and clean a .venv virtual env using
the checked-in requirements.txt file. It also adds the .venv
to the .gitignore, and updates the README.