-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
drop easy_install script/command, re-implement fetch_build_egg
to use pip
#1830
Conversation
Note that this does not work with ptr.py | 54 +++++++++---------------------------------------------
1 file changed, 9 insertions(+), 45 deletions(-)
diff --git i/ptr.py w/ptr.py
index f3952e8..cd753cf 100644
--- i/ptr.py
+++ w/ptr.py
@@ -2,7 +2,6 @@
Implementation
"""
-import os as _os
import shlex as _shlex
import contextlib as _contextlib
import sys as _sys
@@ -37,51 +36,16 @@ class CustomizedDist(Distribution):
allow_hosts = None
index_url = None
- def fetch_build_egg(self, req):
- """ Specialized version of Distribution.fetch_build_egg
+ def get_option_dict(self, command):
+ """ Specialized version of Distribution.get_option_dict
that respects respects allow_hosts and index_url. """
- from setuptools.command.easy_install import easy_install
-
- dist = Distribution({'script_args': ['easy_install']})
- dist.parse_config_files()
- opts = dist.get_option_dict('easy_install')
- keep = (
- 'find_links',
- 'site_dirs',
- 'index_url',
- 'optimize',
- 'site_dirs',
- 'allow_hosts',
- )
- for key in list(opts):
- if key not in keep:
- del opts[key] # don't use any other settings
- if self.dependency_links:
- links = self.dependency_links[:]
- if 'find_links' in opts:
- links = opts['find_links'][1].split() + links
- opts['find_links'] = ('setup', links)
- if self.allow_hosts:
- opts['allow_hosts'] = ('test', self.allow_hosts)
- if self.index_url:
- opts['index_url'] = ('test', self.index_url)
- install_dir_func = getattr(self, 'get_egg_cache_dir', _os.getcwd)
- install_dir = install_dir_func()
- cmd = easy_install(
- dist,
- args=["x"],
- install_dir=install_dir,
- exclude_scripts=True,
- always_copy=False,
- build_directory=None,
- editable=False,
- upgrade=False,
- multi_version=True,
- no_report=True,
- user=False,
- )
- cmd.ensure_finalized()
- return cmd.easy_install(req)
+ opts = super().get_option_dict(command)
+ if command == 'easy_install':
+ if self.allow_hosts:
+ opts['allow_hosts'] = ('test', self.allow_hosts)
+ if self.index_url:
+ opts['index_url'] = ('test', self.index_url)
+ return opts
class PyTest(orig.test): |
@benoit-pierre I think this is probably a good idea, but I suspect it's a pretty major breaking change. How about instead of a hard requirement on That should move the majority of people over to |
Wow. This is simply amazing. Thanks for working on this issue. I had forgotten setuptools had a I'm +0 on Paul's suggestion. It seems sound to provide as smooth a transition as possible, just as long as it doesn't scuttle this effort. |
This change is also intended as a stepping stone for further trimming down the easy_install code, keeping an easy_install code path when pip is not available would prevent that. |
I agree that the end goal of this should definitely be removing If at all possible I'd like there to be a notice period so that we can ease people into this new world and find any weird problems that arise. People use |
How long would that be? Does that include the removal of the top-level |
A few months, probably. I imagine the top-level easy_install script can be moved to another library ("easy_install" probably) to provide that functionality while still allowing setuptools versions to advance without it. |
5c464fd
to
dded913
Compare
4b2f938
to
b8101f0
Compare
OK, so now |
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.
Looks good to me.
@benoit-pierre @jaraco Are you sure that this doesn't remove the
The thing is, I think this will cause huge problems, because when I do AFAICT invoking |
The easy_install script is removed, the setuptools command is still there. |
OK, that explains the discrepancy. I really think we need to restore a deprecated stub ASAP. There's still a lot of examples out there suggesting |
As for getting the system version instead, how is that different from what can happen with any other Python script, like people calling the wrong pip because they have not updated their PATH to include ~/.local/bin. |
So we'll never remove the easy_install script? |
Probably correct. Note that when I removed We really can't be going 0-60 like this. A lot of people don't know what is and isn't deprecated because we're not great about messaging and documentation. I suggest a 9-12 month period of deprecation where #! python
raise RuntimeError("easy_install has been removed in favor of pip.") |
Good points. Happy to take it slow as long as things can keep moving. |
See #1909. |
The changelogs from 41.6.0 are here: https://setuptools.readthedocs.io/en/latest/history.html#v42-0-2 Of most note are the changes to setuptools to use pip when present to implement `setup_requires`. The way we invoke pip in pex/pip.py is compatible with this new feature; so we get more successful wheel builds as a result. See: pypa/setuptools#1830
The changelogs from 41.6.0 are here: https://setuptools.readthedocs.io/en/latest/history.html#v42-0-2 Of most note are the changes to setuptools to use pip when present to implement `setup_requires`. The way we invoke pip in pex/pip.py is compatible with this new feature; so we get more successful wheel builds as a result. See: pypa/setuptools#1830
Summary of changes
Drop the easy_install script and setuptools command. Re-implement
fetch_build_egg
to use pip for fetching/building a wheel of the requirement.Pros:
python_requires
, better support for wheels (proper handling of priority with respect to PEP 425 tags)Cons:
allow_hosts
easy_install option (there's no corresponding pip option we can use to implement it,index_url
/find_links
are still honored)Note: pip environment variables are honored (and take precedence over easy_install options).
The next step would be to drop the develop/install commands support for installing dependencies, trim down easy_install/develop options (the develop command class share all the easy_install supported options): keeping only the bare minimum (including keeping the ones used by pip). See WIP.
Pull Request Checklist