Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Determine default Python interpreter based on the pants_version being used #49
Now that using Python 2.7 is ~deprecated and support will be removed soon, we need to stop defaulting to 2.7.
Defaulting to Python 3 will make for a less stark transition. Specifically, users will be able to leave out
However, we do not want to break backwards compatibility. A user should be able to downgrade to 1.14.0 without issues.
Notably, we first default to Python 3 and only fall back to Python 2 when necessary. We do this because we want most people using Python 3 so that we can completely stress test it before dropping Python 2.
If the user has not pinned
We also avoid the ambiguous
Ah my bad - should have mentioned I expect CI to fail until 1.15.0 is released. Pants doesn't work with Python 3 when using 1.14.0, which is what an unconfigured
Note everything passes except for
My intent in requesting a review was so that this is ready for me to merge once 1.15.0 is released and we get green CI.
Important clarification with this PR. Users who already have the script won't be impacted by the change, unless they curl the script again. This is a good thing, so that we don't change their behavior for 1.15.0 overnight.
Now, thanks to this PR, we will be able to simplify our instructions for current users to upgrade to Python 3 to simply:
referenced this pull request
Mar 31, 2019
@stuhood good idea! I would propose not only checking against 1.15.0, but also 1.16.0 and 1.17.0 splits, as follows:
At the cost of more complex code, we would have significantly less churn in this repo. Because people rarely update their
For example, with this scheme, new users who download the script at 1.16.0 will no longer have the risk of the
Foil here though, what to do when
With this question, note that we no longer pin
@jsirois is this getting too complex, do you think? Or is the reduction in churn + allowing users to downgrade versions without issues worth it?
Hm... I suspect that we do? Pip defaults to "the latest stable version", which is a good default, and a reasonable way to choose the default python as well.
The issue is technical with the execution order.
Pip requires the virtual env to already be set up, and pip corresponds to a specific Python version. Let's say 1.17.0 is now the stable release—then trying to use pip2 to install Pants and subsequently to determine which
Instead, what I propose is based on the assumption that the majority of users will have
Given this assumption, the only time this undefined
So, for the undefined
While this has some churn in the script, the key detail is pre-existing users have no need to re-curl the script. These updates are only expected to impact first-time users.