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

Install pip on Python 3 as well #1055

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

takluyver
Copy link

What is the problem that this PR is trying to fix?

Make pip available for Python 3, as well as Python 2, to ease the transition. This is particularly about using Python tools while testing non-Python projects (i.e. not necessarily using the Python language support on Travis). See the discussion on travis-ci/docs-travis-ci-com#2397 for details.

If I've understood this correctly, the pip command should still use Python 2, to avoid breaking things that rely on that. There will be an additional pip3 command for Python 3, or people can use the python3 -m pip syntax to call it.

What approach did you choose and why?

Finding the code that looked like it installs pip for Python 2, and copying it with modifications for Python 3.

How can you make sure the change works as expected?

I'm not, this is educated guesswork.

Would you like any additional feedback?

@takluyver
Copy link
Author

The CI builds failed almost immediately with "E: Unable to locate package chefdk". I don't think that's anything related to the changes here.

@cclauss
Copy link

cclauss commented Aug 15, 2019

I too doubt that these changes could effect the installation of https://github.com/chef/chef-dk

You could make a whitespace change to force Travis to run again.

@takluyver
Copy link
Author

Same again. I'm guessing something external to this repository has changed recently. Probably these messages are relevant:

Adding APT Sources
'sourceline' key missing:
\{:name\=\>"chef-stable-trusty"\}

@takluyver
Copy link
Author

Oh, it looks like PR #1051 has a fix for it:
a561e61

@cclauss
Copy link

cclauss commented Aug 15, 2019

Yes... This Travis job is running on Trusty which is EOL travis-ci/docs-travis-ci-com#2449 so Chef no longer builds for Trusty and seems to have dropped support for it from their downloads: https://downloads.chef.io/chefdk

Upgrading to Xenial (new Travis default distro) or Bionic will resolve that.

@takluyver
Copy link
Author

The fix/workaround from #1051 seems to have made the CI pass. I'm inclined to leave switching the distro it checks on for someone else to do, because I don't know what else that might affect.

Copy link

@cclauss cclauss left a comment

Choose a reason for hiding this comment

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

Well done. Really nice work. The Python Packaging Index (PyPI) download stats are skewed towards Python 2 because CI systems like Travis CI continue to favor pip2 over pip3. This will make it possible for non-Python projects to install their Python packages via pip3.

Given that Python 3.6 is now the default Python on Travis CI it would be good to go even one step further and make pip3 the default pip on non-Python projects on Travis. 139 days until Python 2 EOL. @MariadeAnton @BanzaiMan @native-api @hugovk Your reviews please?

@takluyver
Copy link
Author

Given that Python 3.6 is now the default Python on Travis CI ...

I wasn't aware of that. Do you mean that a language: python build with no version specified gets 3.6? Or that the python command in a non-Python build runs Python 3.6?

I'd say that the pip command should run on the same Python as the python command in any context. So when python is switched to Python 3, pip should be switched too.

@takluyver
Copy link
Author

Thanks. It looks like that's about builds with language: python set.

@cclauss
Copy link

cclauss commented Aug 15, 2019

Correct. If language: python is not set the Xenial defaults to python being legacy Python.

@cclauss
Copy link

cclauss commented Apr 21, 2020

@takluyver Could you please rebase? Now that the Python 2 EOL date has passed the last version of Python 2 (v2.7.18) has been released, it is time to default pip to Python 3. This PR and #1076 try move things forward in this regard. It would be quite useful to get one of them reviewed and landed.

@takluyver
Copy link
Author

Rebased. If I understood the various pieces correctly, this should do what was suggested on #1076: pip3 or python3 -m pip should work, but pip should still use Python 2 (because the Python 2 version is installed last).

Feel free to take over this branch in a new PR if changes are needed; I don't know this machinery well, and I don't have much time to spend on it.

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.

2 participants