[FR] Allow ignoring ImportError (or making it non-fatal) for setuptools plugins
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.9k
- Forks
- 1.4k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 1
Description
What's the problem this feature will solve?
The current setup for setuptools plugins can be challenging for us in Gentoo because setuptools will try to load all plugins even if no package is known to need it yet.
Modelling the relationship between setuptools, its plugins, and plugin dependencies is non-trivial. setuptools doesn't depend on the plugins, but if a plugin is installed, it has to always be in a usable state and setuptools effectively starts to depend on it.
In Gentoo, Python is "slotted" so it can be installed in parallel with other versions of Python. This is applied to Python libraries too. When migrating between Python versions, we sometimes have a problem.
For example, setuptools, setuptools-rust, and semantic_version might be installed for Python 3.11. When moving to Python 3.12, setuptools must be installed first. If semantic_version is rebuilt for Python 3.12, temporarily breaking setuptools-rust, any package which tries to use setuptools will be broken because of the temporarily-broken plugin, even if that package doesn't use setuptools-rust.
We suspect it could manifest with pip too given pip either didn't in the past or doesn't enforce dependency constraints, possibly by upgrading a dependency of a plugin to an incompatible version.
Describe the solution you'd like
It would help us enormously if setuptools either default-ignored ImportError on plugins and warned on it instead, or allowed controlling this via e.g. an environment variable.
Alternative Solutions
- We have considered making setuptools depend on all plugin providers in Gentoo but this would pull in many dependencies and be rather unwieldy. It also wouldn't work if users package their own plugins.
Additional context
This came up downstream in Gentoo at https://bugs.gentoo.org/933553 (and in the past at https://bugs.gentoo.org/663324).
Code of Conduct
- I agree to follow the PSF Code of Conduct
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No source files, tests, or plugin-loading entry points are named in the issue. First trace how setuptools discovers and imports plugins, then reproduce the broken-plugin scenario and resolve whether completion means warning by default or an opt-in environment setting, with tests covering the chosen behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- build-system
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100