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
EntryPoints compatibility #323
Conversation
it doesn't, this only reintroduces deprecated apis with no replacement |
I'm sorry. I thought the replacement was pretty obvious from the deprecation warnings. Here's how one can adapt to the future behavior for index access: importlib_metadata bugfix/300-entry-points-by-index $ .tox/python/bin/python -Wd -c "import importlib_metadata as md; print(md.distribution('pip').entry_points[0])"
EntryPoint(name='pip', value='pip._internal.cli.main:main', group='console_scripts')
<string>:1: DeprecationWarning: Accessing entry points by index is deprecated. Cast to tuple if needed.
importlib_metadata bugfix/300-entry-points-by-index $ .tox/python/bin/python -Wd -c "import importlib_metadata as md; print(tuple(md.distribution('pip').entry_points)[0])"
EntryPoint(name='pip', value='pip._internal.cli.main:main', group='console_scripts') And for sorting:
Historically, I've put replacements like this in the changelog. Would that suffice? |
both of those are significantly worse than the apis being replaced, O(1) -> O(n) copy + O(n) space + O(1), in-place sort to O(N) space |
Acknowledged, the performance is sub-optimal. In my experience, the cost of O(n) operations is often negligible for n < 10000. I'm unsure if the added cost here is a practical concern or not, but I suspect it's a bearable cost. I do wish to reduce the dependence on mutable types, but leave open the possibility of a downstream consumer owning that behavior if they wish. I'd ultimately like to make For now, I propose to either (a) accept the performance penalty where practical, or (b) devise alternative approaches for these specialized use cases outside of the default interface. It may make sense for |
the performance regression here is unacceptable. it causes code to be 10-100x slower please actually consider feedback before paving over it -- you're not being empathetic to my asks |
As described in #300, there are use-cases for the result of Distribution.entry_points that expect a mutable, list-like object with index access. These changes re-enable those behaviors while also publishing a Deprecation warning when mutable operations are enacted.