Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upStandardize python setup, ensure homu gets python3 #148
Conversation
| - pkgs: | ||
| - python3-pip | ||
| # Virtualenv package creates virtualenv and virtualenv-3.4 executables |
This comment has been minimized.
This comment has been minimized.
Manishearth
Nov 4, 2015
Member
In my experience I needed to pip3 install virtualenv before I got virtualenv3. Should we make two keys here, one with bin_env: pip and one with bin_env: pip3?
This comment has been minimized.
This comment has been minimized.
aneeshusa
Nov 4, 2015
Author
Member
I just tested this in a fresh vagrant box. It started out without pip or virtualenv (any version). I ran
sudo apt-get install python-pipsudo pip install virtualenv
This created/usr/local/bin/virtualenvand/usr/local/bin/virtualenv-3.4executables, the latter of which works fine for the homu venv - I peeked inside the vagrant box and the homu venv had python3 and pip3.
bin_env is used when you want to run pip inside a virtualenv, such as in homu/init.sls, so I'm not sure what you are proposing with the two keys. Could you please clarify?
This comment has been minimized.
This comment has been minimized.
Manishearth
Nov 4, 2015
Member
Are the default python/pip/virtualenv the 2.7 ones?
bin_env is for both selecting a virtualenv or selecting a custom binary to run. It lets you say "Install this pip package, but use the pip3.4 binary". https://docs.saltstack.com/en/latest/ref/modules/all/salt.modules.pip.html
This comment has been minimized.
This comment has been minimized.
aneeshusa
Nov 4, 2015
Author
Member
Yes, on Ubuntu the defaults are all 2.7. Ubuntu is not planning to change this until PEP 394 says otherwise.
bin_env: Right, I'm using this but in a different way. The approach I'm taking is to use virtualenv.managed and pass in python3 in homu/init.sls; salt automatically will install pip3 in the virtualenv (pip3 is bundled with python starting with python3.4). Then, I use pip.installed and set bin_env to the virtualenv location for homu's dependencies, which means it ends up using pip3 under the hood.
Also, for future reference you'll want to use the state documentation, not the module docs :)
This comment has been minimized.
This comment has been minimized.
Manishearth
Nov 4, 2015
Member
Okay, sounds good. So when you say python: python3 in the homu setup below, does that mean that it will also use virtualenv3? Because homu doesn't even install properly with an older virtualenv version, it needs to use pip3, python3, and virtualenv3. (Not sure if virtualenv2 even lets you create a python3 env, but it's good to be certain)
9295f2a
to
929a16d
|
I don't have the salt-fu to be completely sure of what's going on here |
|
If the salt states aren't clear, let me know what's confusing! These should be relatively easy to read as high-level declarative descriptions. |
|
Also, I don't know anything about how installing python, pip, and virtualenv works on OS X (versions 2 and 3). Are they installed by default or can/should they be installed via homebrew? I don't have a Mac so I'd appreciate some help figuring that out to address the build failures. |
|
We need pip3 only on servo-master |
|
(which is linux) |
|
Overall LGTM, but I'd like someone who understands salt more than I do (which is nearly nothing) to look at it too. Also, we might want to test this out from scratch on a prod instance. At the very least we should backup the homu dir, delete the original, and ensure it's created from scratch correctly. (A related issue is that servo-master is never spun up from scratch unlike the other machines, so the salt config may not reflect the actual steps needed for servo-master to be set up -- like python3 being missing from salt. We discussed this the other day and might be testing this somehow soon) |
|
If we only need python3 on linux then I'm probably going to change how I do this a bit. What base image are you using for prod? I can probably modify the Vagrant boxes to use that instead so you can test it locally. (It works fine AFAICT with the ubuntu/trusty64 boxes). |
| - venv_bin: virtualenv-3.4 | ||
| - python: python3 |
This comment has been minimized.
This comment has been minimized.
aneeshusa
Nov 4, 2015
Author
Member
@Manishearth the venv_bin option is what tells salt to use virtualenv-3.4, and the python option tells virtualenv to install python3 (and pip3) inside the virtualenv.
This comment has been minimized.
This comment has been minimized.
|
I'm okay with python3 being available on mac too as long as buildbot doesn't break. System is trusty:
|
|
Reviewed 7 of 7 files at r1. common/init.sls, line 14 [r1] (raw file): Comments from the review on Reviewable.io |
|
Testing in the servo-master Vagrant VM, the provisioning succeeds without errors, and homu successfully starts up. (If you ssh in, |
|
Yeah, homu should fail early if the venv is not set up correctly -- if the virtualenv is the wrong version the egg doesn't even unpack correctly, and if you hack it so that it does, the Python parser will choke on the |
|
Also note that the latest commit will restart various services when their packages are updated, to help keep servo-master's running services in sync with what's on disk. If you'd prefer to manually restart any of these packages, just let me know which ones and I'll drop them back down from |
|
Restarting homu/buildbot at the wrong time can break things. Then again, we don't really update packages much (oh the horror) |
|
OK, that's what I was thinking based on the wiki. With this PR, homu won't restart if the git checkout is updated, but it will restart automatically if either of its configuration files are updated - let me know if you want me to have it never restart automatically. |
|
I thought that was already the case? We only really update the conf files from salt, so homu gets restarted anyway |
|
Hmm, looks like you're right. I rearranged the states a bit and thought I changed it. |
|
@Manishearth @aneeshusa Where are we at with this? Is it OK to leave, or are we still waiting for some changes and a rebase? |
|
I think this was OK, but I'll give it a rebase and take a look. |
|
Thanks, no rush! I was just trying to look across our repos and see what PRs are stalled, especially if it's on the reviewer-side :-) |
|
I actually had just sat down to put in some work for this repo, I blocked off a few hours for it today :) |
a844419
to
b3057ca
- Trusty comes with python3, pip and virtualenv by default, but write states defensively to install these dependencies as required and require the pip or virtualenv states as used by other states. - Homu requires a python3 toolchain, use virtualenv-3.4 and pass python: python3 to get the correct setup (including pip3 inside the venv). - Update the style guide example to use pkg.installed instead of pip.installed to avoid muddling it with a require: pip. Fixes #142.
servo-master is updated in-place instead of a fresh machine being built for every update, so this ensures services are restarted when the underlying code is updated.
b3057ca
to
a3baeaa
|
OK, ready for review. |
| - name: buildbot == 0.8.12 | ||
| essential-dependencies: | ||
| pkg.installed: | ||
| - name: cowsay |
This comment has been minimized.
This comment has been minimized.
Manishearth
Feb 11, 2016
Member
_____________________________________
< a very essential dependency, indeed >
-------------------------------------
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||
|
This looks good to me. |
|
@bors-servo r+ (lgtm, too) |
|
|
…rgstrom Standardize python setup, ensure homu gets python3 - Trusty comes with python3, pip and virtualenv by default, but write states defensively to install these dependencies as required and require the pip or virtualenv states as used by other states. - Homu requires a python3 toolchain, use virtualenv-3.4 and pass python: python3 to get the correct setup (including pip3 inside the venv). - Update the style guide example to use pkg.installed instead of pip.installed to avoid muddling it with a require: pip. Fixes #142. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/saltfs/148) <!-- Reviewable:end -->
|
|
aneeshusa commentedNov 4, 2015
states defensively to install these dependencies as required and require
the pip or virtualenv states as used by other states.
python3 to get the correct setup (including pip3 inside the venv).
pip.installed to avoid muddling it with a require: pip.
Fixes #142.