Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extend plugin discovery to also include entry-points.
This effectively implements a mix of option 2 and option 3 from https://packaging.python.org/en/latest/guides/creating-and-discovering-plugins/ as a pragmatic way to cover all packaging cases. The namespace/path based iteration works for situations where code has not been packaged and is present on the PYTHONPATH, whereas the advertised entry-points work around setuptools/pkgutil issues that make it impossible to reliably iterate over installed modules in certain scenarios (noted for editable installs which use a custom finder that does not implement iter_modules()). A plugin entry-point can be advertised in setup.py (or equivalent pyproject.toml) with something like: ``` entry_points={ "jax_plugins": [ "openxla-cpu = jax_plugins.openxla_cpu", ], } ```
- Loading branch information