-
Notifications
You must be signed in to change notification settings - Fork 1
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
Pre-hook for virtual env #1
Comments
Yeah, I remember that. I'll take a look at the bunch of new features in 1.1 and see if something can be done along these lines. |
@pauleveritt: Ok, not sure I grasp exactly what you wanted to get, but I made a branch that allows you to pass a flag, --setup-venv, when running cookiecutter. I can now do, e.g.: $ cookiecutter --setup-venv myrepo After I answer the questions, I end up with a directory, myrepo. If I cd there, the virtualenv is already set up and I can just run: $ bin/python setup.py development.ini Is that what you were after? See: https://github.com/cguardia/cookiecutter/tree/setup-venv |
That’s pretty cool, in that it eliminates the step of making the virtual environment. I wonder if it this knob could be in the template, as a way to further decrease the concepts needed for a newbie. I was hoping, though, to eliminate the part of running “env/bin/python ./setup.py develop” or “env/bin/pip -e .” to put the Python project (to use the correct jargon) in editable mode. It’s a hard thing to explain. I doubt though that this is easy. I’ve seen some subclasses of Python 3’s EnvBuilder that automate actions inside the build virtual environment (e.g. executing a CookieCutter template):
I think virtualenv might have some similar scripting, not sure. —Paul
|
@pauleveritt I'd like to run it from the template as well, to avoid the --setup-venv flag on the cookiecutter call. However, in that case we would need the user to have already installed virtualenv, because the cookiecutter template itself can't have dependencies. Maybe we could convince the cookiecutter team to add it as a dependency for cookiecutter, not sure. |
Yeh, unfortunately, this was an idea geared more towards Python 3.3+. —Paul |
@pauleveritt I confess I have mostly stayed with 2.7, but looking at this now, I'm not loving pyvenv. It doesn't install setuptools, so that would need to be done by the template as well, whereas with good old virtualenv, we get that for free. |
@pauleveritt Ok, I changed tracks. Maybe this doesn't belong in cookiecutter after all. Try this template again, but make sure virtualenv is installed for the python with which you run cookiecutter. It should create the environment and run setup.py develop. All the user has to do after that is cd to the project directory and run bin/pserve development.ini. We can always change this to deal with pyvenv later. |
Do I still do the --setup-venv flag? |
Ok, ran it, and yep, it did exactly as you described. Very cool! Very very very cool. |
No need for flag anymore. This time the work is all done in the template. |
@pauleveritt I turned parts of this into a PR for cookiecutter: Please see their comment at the bottom. Do you use homebrew? I don't really know much about homebrew. Would virtualenv work there? |
Stated differently, is there anything about virtualenv that makes it more problematic for cookiecutter to install than click? —Paul |
Virtualenv now works (if installed). There's a pull request to the cookiecutter project that could make sure virtualenv is there, but it's currently waiting for review/support: In the meantime, I'll close this, since one way or another we have virtualenv support available now. |
Well, I wonder if we don't come back to Python 3.4+. You said: "I confess I have mostly stayed with 2.7, but looking at this now, I'm not loving pyvenv. It doesn't install setup tools" but pyvenv in 3.4 does install pip and setuptools in the environment. I guess I should look at the couple of lines in here that script virtualenv and see what it would be like under 3.4/3.5. For the target audience, it would sure be nice to eliminate an explanation of pip install virtualenv into a possible-system location. |
I should say, though, that this shouldn't stop evaluation of this template and hopeful adoption by the Pyramid community. |
First, I'm very interested in this project. I communicated with Danny and Audrey once though about making a virtualenv before running the template, thus automating that step as well (to be more newbie friendly.) I think they were interested, but CookieCutter has a million things to do and not enough volunteers to do them.
Is this something that can be done in a template? I doubt it, because the template itself needs to run in a virtual env. But then again, I've seen some virtualenv and PyVenv wrappers that do funky things.
The text was updated successfully, but these errors were encountered: