Repository navigation
feat: load a plugin entrypoint as a package - #100
Merged
Merged
Conversation
The loader accepted a single <module>.py next to the manifest and never registered it in sys.modules, so a plugin could not split its tables across files. A <module>/__init__.py is now loaded as a package with its directory as search location and registered under its path-derived name before it runs, which is what its relative imports resolve through. Closes #93
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #93.
What
_import_entrypointloaded the single<module>.pynext toplugin.toml, never registered it insys.modulesand gave it no search location, so a plugin could not split its symbol tables across files.entrypoint.modulemay now name a package,<module>/__init__.py: it is loaded withsubmodule_search_locationsand registered insys.modulesunder its path-derived name beforeexec_module, so relative imports resolve.<module>.pyloads exactly as before.Tests
test_loads_a_plugin_package_with_relative_imports— entrypoint importing.tables.celery.test_plugin_packages_with_the_same_module_name_do_not_collide— two packages both namedsample.Full suite: 891 passed.
ruff checkandmypy srcclean.Docs
Plugin guide describes the package layout; changelog entry under Unreleased.
Independent of #99; the Unreleased changelog section will need a trivial merge if both land.