-
Notifications
You must be signed in to change notification settings - Fork 337
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
Fix issue 826 - correct python and pip fallback #878
Fix issue 826 - correct python and pip fallback #878
Conversation
See AcademySoftwareFoundation#878 for CI check
src/rez/pip.py
Outdated
python_version, | ||
pip_version=pip_version or "latest" | ||
) | ||
for version in [pip_version, pip_version or "latest"]: |
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.
won't this attempt to find the same pip version twice, when pip_version
is specified?
src/rez/pip.py
Outdated
|
||
if not py_exe: | ||
else: # No break from: for version in [pip_version,...] |
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 can't believe I've been writing python this long and have never seen this. There's nothing technically wrong with this, but tbh I'd avoid it because it's so esoteric.
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.
True, I also find it fairly susceptible to indent/whitespace messing up logic if code was reformatted/refactored incorrectly hence the comment. I'll see if I can change it up a bit
src/rez/pip.py
Outdated
# by RexExecutor.append_system_paths(), which calls Shell.get_syspaths() | ||
shell_class = create_shell().__class__ | ||
current_syspaths = shell_class.syspaths | ||
try: |
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.
Yeah I don't think we should do this. Not because it's a hack per se, but because it isn't threadsafe. Ie this could alter syspaths in a context being created in another thread.
So wrt find_python_from_package:
So 2. is basically your first suggestion, but I think no_append_sys_paths is a bit better naming since no_append_sys_paths=False is definitely default behaviour. I would go with this. Definitely not with the hack in place currently, see comments. Cheers |
See AcademySoftwareFoundation#878 for CI check
Good point, the logic can be much simpler now too!
Cool, I'll go with
|
Actually, I still prefer the name without the |
ce3c9da
to
72f6a00
Compare
.github/workflows/installation.yml
Outdated
linux-containers: | ||
name: python:${{ matrix.python-version }} - ${{ matrix.method }} | ||
runs-on: ubuntu-latest | ||
container: python:${{ matrix.python-version }} |
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.
That runs the test in a docker container right? What's the reason for doing this? I can't think of a case where install rez would fail in a container but not on a bare metal/vm machine. But maybe I'm missing something.
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 was just double checking that if the system already has Python it wasn't doing anything different from using actions/setup-python
It didn't, see here, so I'll remove it
- name: Install | ||
run: | | ||
${{ matrix.method }} | ||
find /opt/rez/ -maxdepth 2 |
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 tempted to suggest to use check-manifest to test that pip would install the correct files. Though, we would probably have to work a little bit on the MANIFEST.in
to make it work. But that should be done in another PR IMO if we ever decide to go that way.
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.
yeah, sounds like a good idea. Let's get a new PR/issue opened for that
- '3.6' | ||
- '3.7' | ||
method: | ||
- 'python ./install.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.
We technically already test this type of install quite a lot for all platforms and all python versions. I think it would make sense to test this here, but only if we test install.py
more in depth, like make sure it installs the rez scripts in the rez
folder correctly, and on all platforms. We should also test https://github.com/nerdvegas/rez/blob/master/install.py#L81.
Without testing these things, I have the feeling we will just have jobs that will take CPU time without much benefits.
What do you think?
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.
test install.py more in depth, like make sure it installs the rez scripts in the rez folder correctly, and on all platforms. We should also test https://github.com/nerdvegas/rez/blob/master/install.py#L81.
I agree with testing python -E
, let's do those in a separate PRs.
We technically already test this type of install quite a lot for all platforms and all python versions.
Does rez-selftest
check python ./install.py
? The other CI tests checks via python ./install.py ./build
where as I wanted this to actually check the wiki's python ./install.py
Originally these tests were written just to double check what is said in the Installation Wiki page actually holds true and is not misleading beginners.
So far, this is just a start and we can expand on it to more in-depth and multi-platform tests in the future to ensure whenever someone discovers this project and tries to follow the wiki step by step, it should just work.
Ok cheers, pretty much ready to merge this. Ran out of time just now but this will be done soon. ps - let's keep separate issues (eg installation CI) in separate PRs ;) The smaller the PR the easier it is for me to digest and merge it. |
Cheers for the review! I've updated with changes to code comments.
Sure thing, I'll keep that in mind next time! |
See AcademySoftwareFoundation#878 for CI check
See AcademySoftwareFoundation#878 for CI check
See AcademySoftwareFoundation#878 for CI check
See AcademySoftwareFoundation#878 for CI check
See AcademySoftwareFoundation#878 for CI check
See AcademySoftwareFoundation#878 for CI check
commit 8d51e29 Author: Joseph Yu <josephyu2712+github@gmail.com> Date: Mon Apr 27 15:16:37 2020 +0100 Emphasised pip CLI warnings commit e0d698e Author: Joseph Yu <josephyu2712+github@gmail.com> Date: Wed Apr 22 11:36:00 2020 +0100 Extra links to install from GitHub commit 13183cf Author: Joseph Yu <josephyu2712+github@gmail.com> Date: Wed Apr 22 10:56:48 2020 +0100 Updated CLI in rez-env warning commit e922172 Author: Joseph Yu <josephyu2712+github@gmail.com> Date: Sat Apr 18 17:39:40 2020 +0100 Just update Installation.md See AcademySoftwareFoundation#878 for CI check
commit 8d51e29 Author: Joseph Yu <josephyu2712+github@gmail.com> Date: Mon Apr 27 15:16:37 2020 +0100 Emphasised pip CLI warnings commit e0d698e Author: Joseph Yu <josephyu2712+github@gmail.com> Date: Wed Apr 22 11:36:00 2020 +0100 Extra links to install from GitHub commit 13183cf Author: Joseph Yu <josephyu2712+github@gmail.com> Date: Wed Apr 22 10:56:48 2020 +0100 Updated CLI in rez-env warning commit e922172 Author: Joseph Yu <josephyu2712+github@gmail.com> Date: Sat Apr 18 17:39:40 2020 +0100 Just update Installation.md See AcademySoftwareFoundation#878 for CI check
commit 8d51e29 Author: Joseph Yu <josephyu2712+github@gmail.com> Date: Mon Apr 27 15:16:37 2020 +0100 Emphasised pip CLI warnings commit e0d698e Author: Joseph Yu <josephyu2712+github@gmail.com> Date: Wed Apr 22 11:36:00 2020 +0100 Extra links to install from GitHub commit 13183cf Author: Joseph Yu <josephyu2712+github@gmail.com> Date: Wed Apr 22 10:56:48 2020 +0100 Updated CLI in rez-env warning commit e922172 Author: Joseph Yu <josephyu2712+github@gmail.com> Date: Sat Apr 18 17:39:40 2020 +0100 Just update Installation.md See AcademySoftwareFoundation#878 for CI check
commit 8d51e29 Author: Joseph Yu <josephyu2712+github@gmail.com> Date: Mon Apr 27 15:16:37 2020 +0100 Emphasised pip CLI warnings commit e0d698e Author: Joseph Yu <josephyu2712+github@gmail.com> Date: Wed Apr 22 11:36:00 2020 +0100 Extra links to install from GitHub commit 13183cf Author: Joseph Yu <josephyu2712+github@gmail.com> Date: Wed Apr 22 10:56:48 2020 +0100 Updated CLI in rez-env warning commit e922172 Author: Joseph Yu <josephyu2712+github@gmail.com> Date: Sat Apr 18 17:39:40 2020 +0100 Just update Installation.md See AcademySoftwareFoundation#878 for CI check
commit 8d51e29 Author: Joseph Yu <josephyu2712+github@gmail.com> Date: Mon Apr 27 15:16:37 2020 +0100 Emphasised pip CLI warnings commit e0d698e Author: Joseph Yu <josephyu2712+github@gmail.com> Date: Wed Apr 22 11:36:00 2020 +0100 Extra links to install from GitHub commit 13183cf Author: Joseph Yu <josephyu2712+github@gmail.com> Date: Wed Apr 22 10:56:48 2020 +0100 Updated CLI in rez-env warning commit e922172 Author: Joseph Yu <josephyu2712+github@gmail.com> Date: Sat Apr 18 17:39:40 2020 +0100 Just update Installation.md See AcademySoftwareFoundation#878 for CI check
commit 8d51e29 Author: Joseph Yu <josephyu2712+github@gmail.com> Date: Mon Apr 27 15:16:37 2020 +0100 Emphasised pip CLI warnings commit e0d698e Author: Joseph Yu <josephyu2712+github@gmail.com> Date: Wed Apr 22 11:36:00 2020 +0100 Extra links to install from GitHub commit 13183cf Author: Joseph Yu <josephyu2712+github@gmail.com> Date: Wed Apr 22 10:56:48 2020 +0100 Updated CLI in rez-env warning commit e922172 Author: Joseph Yu <josephyu2712+github@gmail.com> Date: Sat Apr 18 17:39:40 2020 +0100 Just update Installation.md See AcademySoftwareFoundation#878 for CI check
commit 8d51e29 Author: Joseph Yu <josephyu2712+github@gmail.com> Date: Mon Apr 27 15:16:37 2020 +0100 Emphasised pip CLI warnings commit e0d698e Author: Joseph Yu <josephyu2712+github@gmail.com> Date: Wed Apr 22 11:36:00 2020 +0100 Extra links to install from GitHub commit 13183cf Author: Joseph Yu <josephyu2712+github@gmail.com> Date: Wed Apr 22 10:56:48 2020 +0100 Updated CLI in rez-env warning commit e922172 Author: Joseph Yu <josephyu2712+github@gmail.com> Date: Sat Apr 18 17:39:40 2020 +0100 Just update Installation.md See AcademySoftwareFoundation#878 for CI check
commit 8d51e29 Author: Joseph Yu <josephyu2712+github@gmail.com> Date: Mon Apr 27 15:16:37 2020 +0100 Emphasised pip CLI warnings commit e0d698e Author: Joseph Yu <josephyu2712+github@gmail.com> Date: Wed Apr 22 11:36:00 2020 +0100 Extra links to install from GitHub commit 13183cf Author: Joseph Yu <josephyu2712+github@gmail.com> Date: Wed Apr 22 10:56:48 2020 +0100 Updated CLI in rez-env warning commit e922172 Author: Joseph Yu <josephyu2712+github@gmail.com> Date: Sat Apr 18 17:39:40 2020 +0100 Just update Installation.md See AcademySoftwareFoundation#878 for CI check
Closes #826
Ran across #826 while trying to refactoring pip wiki fix PR #749. The CI for #749 is also added here since it requires the pip fallback fix
Use
python2
orpython3
rather thanpython
Currently with disgusting hack and thinking about either (need feedback!):a newadd_sys_path
kwargs forResolvedContext.get_environ
andResovledContext._execute
, orResolvedContext.append_sys_path
attribute whichResovledContext._execute
and any other methods can useFallback to more compatible
pip
version if possible