-
Notifications
You must be signed in to change notification settings - Fork 4
Leverage virtualenv to ensure pip and setuptools and wheel are recent #25
Conversation
Try out this PR here: https://m.devpi.net/jaraco/dev/tox-venv/0.3.1+pr25 |
I'll be honest, I don't fully understand the test failures. Some of them seem spurious to me, like the assertions are too tightly coupled to the implementation details. Other ones may be more legitimate, revealing that in some cases 'python' doesn't exist. I'm not sure why that would be. So I present this PR for your consideration. It works for me and it solves the issue in my environment. I don't do a lot of Python 3.5 work, but when I do, it's nice to have this functionality. |
A few minor concerns, it's probably fine:
|
I just installed virtualenv 15.0.1 and ran
Hard to say, but I'd imagine so, in part because it's leveraging the virtualenv code, but also because I just ran a test with this branch on ubuntu bionic... and it creates the environments just fine. Is there a test I could run that would reveal an anticipated failure? |
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.
probably sufficient then!
Thanks. In that case, I'll try to get the tests to pass. |
I'm having difficulty running the tests. I can't get the tests on master to pass, nevermind the patch. I get 18 failures, most similar to those failing in Travis. Can someone help with ferreting out the issues with the tests failing - maybe give some advice how I might proceed? |
Hi @jaraco. I haven't had time to look at this yet, but my immediate guess is that the test failures are due to the test suite being out of date. One maintenance annoyance is making sure the test suite is kept up to date, the reapplying the tox-venv related changes. Try temporarily pinning I'll try to take a look at this soon. |
Cool. I created the stable-deps branch, where tests are passing for me (and some pass in travis). I then rebased the work in this branch on there in the stable-deps+feature/update-env-installer branch, and many tests are failing, revealing apparent regressions. At least the concerns are separated now. |
These errors match what I'm seeing locally. Probably the mocks need to be updated to mock out the virtualenv install_wheel call. |
I've pushed 8b59f63, and I expect the tests to pass in Travis for that branch, but it doesn't prove much; it just disables the added functionality to prevent it from causing the tests to fail. |
In pypa/setuptools#1500, I discovered a regression. It seems that when testing setuptools, including this functionality causes the (may be false alarm; tests now pass reliably and team member was unable to replicate even with this patch installed) |
…l. Fixes test failures on Python 3.5
Today I found another regression elicited by the test suite on Python 3.5 (and probably Python 2.7). That's fixed in d988843. And as you can see in this build, if the dependencies are pinned to avoid unrelated issues in the dependencies, the tests pass on the same Pythons in which master passes with those some pins. I'd like to propose merging this PR (and cutting an 0.4 release). I've used this technique for months with no issues other than the apparent regression I reported on Sep 23 that hasn't re-emerged, and I again today confirmed it's not happening in a typical environment. |
Hmm. I may have run into a new issue with this code. This morning, I've created literally hundreds of virtualenvs using this tox-venv version. But now I'm trying it and it's failing with this traceback:
Immediately I notice one deficiency - if an issue does occur when venv calls virtualenv to upgrade the packages, the output is unconditionally suppressed. Let's see if I can find a way to override that setting to see what the underlying error is. |
virtualenv 16.2 was released this morning, perhaps related? |
Aha - so while trying to create a breakpoint in the stack trace above, I found it was failing earlier, and from there I was able to ascertain the underlying cause:
I had a malformed setup.cfg... and that's almost certainly what's tripping up the invocation. Probably it would be best if the invocation of |
I was thinking the same thing, but I'm still running the older version. |
ahah, yeah I've hit that in the past too -- pre-commit works around this by invoking in
|
I've confirmed that the |
Hi @jaraco. I've fixed a few issues with the test suite and updated it to reflect tox 3.8.1 |
…ding 'python -m venv', don't emit any output. Fixes #38.
@rpkilby I'm hoping you'll have a chance to review/accept this and cut a release with it. |
I expect this is going to break a lot of people's use of tox-venv, as they expect that with this plugin the new venv is raw from Python, which is very stable except that the builtin Python I dont understand why people would want to use tox-venv if this gets merged, as it seems easier to just use the standard tox without tox-venv which will do all this. |
That's not my experience:
Note that pip 19.1.1 is the latest pip at this time of writing.
There are many reasons.
All of these reasons are why I use |
Builtin venv has option As noted elsewhere, mandatory installation and upgrading of That only leaves the problem of auto upgrading setuptools, which is a simple problem to solve without |
I only see |
and |
https://github.com/python/cpython/blob/master/Lib/venv/__init__.py#L269 - it uses --upgrade https://github.com/python/cpython/blob/master/Lib/ensurepip/__init__.py#L110 passes upgrade to pip
|
You missed the |
Bugger! I guess they also decided to choose stability over dephell of constantly updating pip/setuptools/etc., a reason I used tox-venv. As we can disregard 2.7, 3.4, etc now all EOL or close to EOL, most people are using venv bundles from py36, pip-18.1 and setuptools-40.6.2 . https://github.com/python/cpython/tree/3.6/Lib/ensurepip/_bundled And they are being updated fairly frequently https://github.com/python/cpython/commits/master/Lib/ensurepip/_bundled We're not in the days of distros providing pip 0.3-ish, which couldnt even read 90% of requirements files in the wild. For people needing more recent versions, another approach is tox-pip-version , which does provide upgrading, as this is also a feature requested of tox - tox-dev/tox#791 . The beauty of plugins where each does one thing.
|
Leaving this functionality to tox-pip-version seems sensible to me. @jaraco any reason this wouldn't work? |
I have no reason to expect that I still think you want this change to get parity between virtualenv and env envs (even for just between py2/3 when tox-venv is present). Another way to achieve parity would be to instead use ensurepip in virtualenv envs. |
II agree it seems nicer to separate the concerns of pip version requirements and virtualenv management. I'll give tox-pip-version a try and stop fighting this battle. |
Apologies - never meant for this to be difficult. I'm just stretched on time. Currently, I'm waiting on the tox 4 to see if this is even necessary. But for now, using tox-pip-version is the way to go. |
tox-pip-version does not seem to work with tox-venv How can I at the same time not use virtualenv with tox and also have a reasonable version of pip? |
I take it back! it works!
|
Thanks for making this package. tox-venv and tox-pip-version have combined to saved me from the Fifth Circle of python hell.
|
Unfortunately, it seems that |
Hi @gaborbernat. Given the changes to virtualenv 20, is there a "recommended" but unofficial way of installing the bundled wheels? Right now, it looks like we'd need to do something like: from virtualenv.run import session_via_cli
session = session_via_cli(['path/to/venv', '--seeder', 'pip'])
session.seeder.run(session.creator) |
Out of box it installs bundled wheels. |
venv is dead. long live virtualenv. |
Fixes #24. Obviates #23. Fixes #17.