takluyver / entrypoints

Discover and load entry points from installed packages
https://entrypoints.readthedocs.io/
MIT License
74 stars 28 forks source link

Fix repr of EntryPoint #36

Closed pelson closed 4 years ago

pelson commented 5 years ago

I noticed that __repr__ of an entrypoint was missing the extras section.

With this change:

$ python -m entrypoints
[EntryPoint('py.test', 'pytest', 'main', extras=None, distro=Distribution('pytest', '5.1.2')),
 EntryPoint('pytest', 'pytest', 'main', extras=None, distro=Distribution('pytest', '5.1.2')),
 EntryPoint('wheel', 'wheel.cli', 'main', extras=None, distro=Distribution('wheel', '0.33.4-py3.7')),
 EntryPoint('easy_install', 'setuptools.command.easy_install', 'main', extras=None, distro=Distribution('setuptools', '41.0.1-py3.7')),
 EntryPoint('pip', 'pip._internal', 'main', extras=None, distro=Distribution('pip', '19.2.2-py3.7')),
 EntryPoint('pip3', 'pip._internal', 'main', extras=None, distro=Distribution('pip', '19.2.2-py3.7')),
 EntryPoint('pip3.7', 'pip._internal', 'main', extras=None, distro=Distribution('pip', '19.2.2-py3.7'))]
takluyver commented 4 years ago

Thanks, sorry I overlooked this.

I consider extras on entry points deprecated and best avoided by new code (and I'm not alone in this - e.g. see this distutils-sig thread. They were connected to of setuptools' idea of dynamically reconfiguring sys.path to make different packages importable, which has been superseded by environment systems.

Combined with the fact that I know of very few things using them, I probably left them out of the repr semi-deliberately. I'm open to showing them when they're used, but I'd prefer they stay hidden when extras=None.

pelson commented 4 years ago

That's reasonable. It's probably not worth the effort & extra maintenance to show extras only when they exist, so let's close this one out.