Comments (7)
If all you are doing is listing and loading entry points:
# Replace this
from pkg_resources import iter_entry_points
# with This
from entrypoints import get_group_all
The entry points have a .name
and .load()
which was enough for me. Bonus points it ran in about 40% of the pkg_resources API.
from click-plugins.
For anyone still reading this thread and using the solution posted by @AndrewHoos, since entrypoints
is now in maintenance-only mode it is better to replace from entrypoints import get_group_all
with from importlib_metadata import entry_points
and then replace get_group_all("foo")
with entry_points(group="foo")
from click-plugins.
@AndrewHoos This is helpful information – thanks.
I'll try and spend some time on this in the near future. I did make an attempt several months ago but hit some potential issues and murkiness in my understanding of how entrypoints work. I do think this is worth addressing if possible.
from click-plugins.
Related: pypa/setuptools#1826
Possible fixes would be using:
- importlib-metadata : include:https://importlib-metadata.readthedocs.io/en/latest/
- entrypoints: https://github.com/takluyver/entrypoints
from click-plugins.
So far, the solution that @AndrewHoos proposed with entrypoints
works great. Are you open to update the documentation with this solution?
from click-plugins.
Is there any news on progress on this issue (or associated PR #32)?
We've recently updated to Celery 5.2.3 (which uses this click-plugins
package) and are running into this problem (although in our case it's a clash with setuptools since Celery decided to tightly pin it)
Warning: entry point could not be loaded. Contact its author for help.
2022-01-10T11:33:01.647435486Z
2022-01-10T11:33:01.647436986Z
2022-01-10T11:33:01.647438630Z Traceback (most recent call last):
2022-01-10T11:33:01.647440188Z File "/usr/local/lib/python3.10/site-packages/click_plugins/core.py", line 37, in decorator
2022-01-10T11:33:01.647456725Z group.add_command(entry_point.load())
2022-01-10T11:33:01.647458198Z File "/usr/local/lib/python3.10/site-packages/pkg_resources/__init__.py", line 2449, in load
2022-01-10T11:33:01.647459768Z self.require(*args, **kwargs)
2022-01-10T11:33:01.647461372Z File "/usr/local/lib/python3.10/site-packages/pkg_resources/__init__.py", line 2472, in require
2022-01-10T11:33:01.647462998Z items = working_set.resolve(reqs, env, installer, extras=self.extras)
2022-01-10T11:33:01.647464519Z File "/usr/local/lib/python3.10/site-packages/pkg_resources/__init__.py", line 777, in resolve
2022-01-10T11:33:01.647473224Z raise VersionConflict(dist, req).with_context(dependent_req)
2022-01-10T11:33:01.647474930Z pkg_resources.ContextualVersionConflict: (setuptools 57.5.0 (/usr/local/lib/python3.10/site-packages), Requirement.parse('setuptools<59.7.0,>=59.1.1'), {'celery'})
from click-plugins.
Thanks for the suggestion @tinosulzer, seems to work fine.
from click-plugins.
Related Issues (20)
- Port from PR
- Release 1.0.2 HOT 1
- Allow with_plugins() to accept a string
- Cleanup docs
- Using plugin alias that doesn't match click.group method name HOT 2
- test_group_chain fails with python-click 6.7+git20180829-1 HOT 4
- Release v1.0
- Release 1.0.4 HOT 1
- Investigate performance HOT 1
- List plugin commands in separate sections? HOT 1
- A broken command with arguments hides failure trace
- Replace existing command HOT 1
- Enable Travis-CI and coveralls.io HOT 5
- [ERROR] Package has no install method: python-click-plugins HOT 1
- click 8+ comapt new release HOT 2
- @with_plugins() causes a type error in PyCharm
- "show_envvar=True" inside plugins shows . used in environment variable name HOT 1
- Clarify `pkg_resources` vs `importlib_metadata`
- Release 1.0.1 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from click-plugins.