-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
rewrite feedback #1481
rewrite feedback #1481
Conversation
- Use architecture, version, implementation and platform extensions for candiates - Cache PythonInfo.from_exe by path (resolving symlinks) - Ensure what we discover has the same version, implementation and architecture. - Improve our test suite for this functionality. Signed-off-by: Bernat Gabor <bgabor8@bloomberg.net>
Signed-off-by: Bernat Gabor <bgabor8@bloomberg.net>
Signed-off-by: Bernat Gabor <bgabor8@bloomberg.net>
Signed-off-by: Bernat Gabor <bgabor8@bloomberg.net>
* creator unicode support Signed-off-by: Bernat Gabor <bgabor8@bloomberg.net> * activator support Signed-off-by: Bernat Gabor <bgabor8@bloomberg.net> * fix * add space * python3.4 support * Windows fixes * some fixes * fix powershell requires utf-16 * try to fix python2 windows Signed-off-by: Bernat Gabor <bgabor8@bloomberg.net> * use utf-8 for activation scripts Signed-off-by: Bernat Gabor <bgabor8@bloomberg.net> * fix * more fix Signed-off-by: Bernat Gabor <bgabor8@bloomberg.net> * fix Signed-off-by: Bernat Gabor <bgabor8@bloomberg.net> * windows path py2.7 * fixes for Python 2 and unicode on Windows * do not single out mbcs, but the file system encoder * do not install pathlib python 2 windows Signed-off-by: Bernat Gabor <bgabor8@bloomberg.net> * fix encoding on py35 Signed-off-by: Bernat Gabor <bgabor8@bloomberg.net>
Ensure that what ran with virtualenv 17 will continue running in a post rewrite world minus the deprecated flags, plus the relocatable feature. Signed-off-by: Bernat Gabor <bgabor8@bloomberg.net>
* fix app data logic Ensure that what ran with virtualenv 17 will continue running in a post rewrite world minus the deprecated flags, plus the relocatable feature. Signed-off-by: Bernat Gabor <bgabor8@bloomberg.net> * fix Windows * fix * fix Signed-off-by: Bernat Gabor <bgabor8@bloomberg.net>
Some initial (very simple) tests on Windows look OK.
I tried to test with Python 2.7, using a custom Python 2.7 install (installed via Scoop) and By the way, the new virtualenv seems to install But overall, this looks very nice. Good job! |
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.
(I didn't review the tests)
most of my comments are little things
some stuff I noticed from this:
- the new structure ends up with lots of circular imports :S
- while the new structure seems to separate logic nicely, it was kinda hard for me to follow the control flow (especially with the deep inheritance hierarchies)
- I'm very concerned about
virtualenv
growing dependencies, this breaks a lot of my usecases
I haven't had a chance to actually try this out yet, will give that a spin
Co-Authored-By: Anthony Sottile <asottile@umich.edu>
Co-Authored-By: Anthony Sottile <asottile@umich.edu>
Co-Authored-By: Anthony Sottile <asottile@umich.edu>
Co-Authored-By: Anthony Sottile <asottile@umich.edu>
This seems a good idea, will try to add.
Interesting, wonder why an official installation python does not need it. 🤔 this needs to be investigated and determined to see if it's reasonable or not to automatically and when to add it.
You can always disable the generation of the Batch activation scripts. pydoc working on other shells and not in Batch was a bug we solved now by adding it.
I know of 3 🤔 could not eliminate these three so kept it.
I personally find it easier to identify this way what's common across different things, and what's different. This might be just my maintainer POV. Having endless if/else branches in the old way made it hard to see just what each target interpreter needed, where things differed.
Would like to hear with concrete examples here, and why those can't be solved via a zippapp (perhaps one where part of the build operation we bundle the dependencies). Vendoring would be my very last option. |
Co-Authored-By: Anthony Sottile <asottile@umich.edu>
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.
first i want to recognize the sheer amount of work that went into this rewrite - thank you :)
also thanks to @asottile - your prior run review things made thins more easy
i like the overall restructuring and splitting things into smaller comprehensible things
the overall quality is just lovely, my key irks where about minor details of api style (which is neglect-able)
so again thank you and great work !
def supports(cls, interpreter): | ||
return interpreter.os != "nt" | ||
|
||
def templates(self): |
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.
this could be a list for all use cases i currently see, is there a use-case requiring this to be a callable?
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.
I'm not sure I follow here 🤔
return session | ||
|
||
|
||
def session_via_cli(args): |
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.
the control flow of this function is horrendous to follow, almost gives me hives
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.
reorganized under #1487
Maybe because an all-users Python 2 install using the python.org installer puts
Ah, if it's considered a "batch" activation script, then yes I could do this, as I use PowerShell, so the batch scripts are not very useful to me. Thanks for the suggestion. |
For some reason I can't reply inline to this comment :-( Yes, when using the legacy (non-PEP 517) code path, pip will check if |
Confirmed with a clean install. #1484 raised for this. |
I've addressed all points raised inside #1487 (minus three that have their own issues); will close this now, if anyone has further feedback please open a new PR and do it there; or reach out to me. Thanks for everyone for their effort. |
Woohoo! In case it hasn't been said enough yet, @gaborbernat you are great thanks for moving this forward it is awesome. |
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.
This is all pretty great looking. I haven't finished reviewing this yet, but it seems like you've closed the PR so I'll push these not-so-polished-or-complete review comments.
Items prefixed with "nit: " are exactly that -- nitpicks that IMO aren't worth anyone's time to spend discussing in detail if there are disagreements.
@@ -1,22 +1,12 @@ | |||
include virtualenv.py |
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.
I wonder if it's worth it to make this work, an orphan branch (see https://stackoverflow.com/a/30284471/1931274 for how to). Then we'd rename the current master
to legacy
(+ add a tag) and rename rewrite
to master
instead of doing a merge. :P
That'd also allow for the rewrite to be more representative of the degree of work. :P
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.
hmm pushing an orphan branch takes a while 🤔
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.
orphan branch created under https://github.com/pypa/virtualenv/commits/rewrite
|
||
from virtualenv.util.path import Path, copy | ||
|
||
from .common import CPython, CPythonPosix, CPythonWindows |
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.
Why are some imports relative and some absolute? It'd be preferable to maintain the same style.
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.
mostly because I did not find a tool to automate it 😢 any suggestions? I'd prefer to make relative what's possible without (or at most 1 level ..
and keep everything else as absolute)
This is a PR meant to allow people to give feedback on the rewrite. For such big rewrite, I'm not sure Github UI is good so I'd recommend checking out the rewrite branch. Opened the PR though to allow people to comment in the code inline - or attach their feedback as a comment. If you take the time and give feedback I'd like to say thank you very much, appreciated 🙇
A bit of context on the design, the core rewrite idea is to make the project as fast as possible and relatively easy to extend/maintain. We now have a config file support, which allows users to choose their own defaults globally (
virtualenv -h
now shows where defaults come from, experience prooved that's there's no such thing as good default for everyone, and these can be also used to globally fix when some dependency pip/setuptools breaks the world). Furthermore, we still support python 2; and plan to support it for the foreseeable future - pypy is still supported, and we plan to support that. As such all code must support python 2.7+. That being said, the rewrite simplifies the python 2 env creation, to something that looks a lot more like python 3 style via a pyenv.cfg.The idea is also to support a clean programmatic API for tox/pipenv/etc (e.g. what's the site-package folder for this env, without creating it; reuse environment discovery, etc).
The project is split into four main sections:
-p 3.8-64
discover/find an interpreter that satisfies those requirements - supports PEP-514 or path discovery mechanism)CC @pfmoore @pradyunsg @RonnyPfannschmidt
PS: There still are some release blockers beyond this review -> https://github.com/pypa/virtualenv/milestone/7