Skip to content
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

rez-pip: Assume pip provided by python package #757

Merged

Conversation

JeanChristopheMorinPerso
Copy link
Member

@JeanChristopheMorinPerso JeanChristopheMorinPerso commented Oct 4, 2019

This PR closes #706 and closes #764

This PR adds a new logic to find which pip will be used to install pip packages.

The logic is as follow:

  1. Search for pip in the rezified python package specified with --python-version, or
    the latest version if not specified;
  2. If found, use it;
  3. If not found, search for pip in the rezified pip package specified with --pip-version,
    or latest version if not specified.
  4. If rezified pip is found, use it;
  5. If not found, fall back to pip installed in rez own virtualenv.

I also added a deprecation warning when --pip-version is used.

Lastly, I added a wiki page to explain what is rez-pip and how it really works under the hood. This, I hope, will save us some questions and will help us remember what are the good practices when it comes to pip + rez.

I've tested this with most (if not all) scenarios, but I invite everybody to also try on their side to verify that it works for everybody in all sort of environment (windows, osx, linux, etc).

@@ -40,6 +42,15 @@ def command(opts, parser, extra_arg_groups=None):
p.wait()
return

if opts.pip_ver:
with warnings.catch_warnings():
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like we should just trigger the warning here, and leave it up to elsewhere to set the filter. Since this is CLI code, we could safely just set to always in cli._main or something. The reason I say is because there are a bunch of other places where deprecation warnings should go, that aren't necessarily in CLi code. In those cases you would not be wanting to set the warnings filter - that would be up to the host application to set.

We might also consider wrapping this with a utils.deprecation_warning() func.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ps - I also think we should do this in a separate PR though, so happy to leave this as-is

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My thinking was that if we always let warnings be printed out, it could cause some noise. That's nice when doing development and when running tests, but it's not so nice for a user that just wants to use rez without getting warnings from other libs or python itself for example. That's why I haven't enabled them globally.

I also thought about a deprecation warning function but I wasn't sure if you would have like it since right now there is no deprecation policy in Rez (For example, see the policy of pip https://pip.pypa.io/en/stable/development/release-process/#deprecation-policy), as everything as to stay backward compatible... Introducing deprecation warnings would mean we would start to really deprecate things and break backward compatibility in some places... So I wasn't sure. But if we are fine with this (I am fully fine with breaking compatibility when necessary and when well documented with proper error messages/warnings that points to the right documentation), I'm all for a common function.

@nerdvegas
Copy link
Contributor

nerdvegas commented Oct 15, 2019 via email

@JeanChristopheMorinPerso JeanChristopheMorinPerso changed the title rez-pip: Assume pip provided by python package (#706) rez-pip: Assume pip provided by python package Oct 16, 2019
@JeanChristopheMorinPerso
Copy link
Member Author

@nerdvegas I added an entry in the changelog. You will just need to update the date for the release (I had to rebase too).

@JeanChristopheMorinPerso
Copy link
Member Author

@JeanChristopheMorinPerso
Copy link
Member Author

Though I haven't updated the version in rez.utils._version...

@nerdvegas
Copy link
Contributor

@JeanChristopheMorinPerso I notice you're using python's -s flag when using pip and I can't help but wonder if we should be doing this with rez's own CLI tools also. IIRC we only use -E for those.

@nerdvegas nerdvegas merged commit 244a1c0 into AcademySoftwareFoundation:master Oct 22, 2019
@JeanChristopheMorinPerso
Copy link
Member Author

@nerdvegas virtualenv technically ignores the user site directory by default. The only thing I'm not sure about is if it also ignores $PYTHONNOUSERSITE which I think it does. I'll try to find a documentation that correlates what I'm saying... but so far I find no useful info apart from me knowing it works like this... But I feel I'm missing something. In any case, we can go ahead with this PR and do the -s changes if needed in another PR I think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

rez-pip python 3 error rez-pip should assume python provided pip
2 participants