Skip to content

feat: load a plugin entrypoint as a package - #100

Merged
SizzleUnrlsd merged 3 commits into
mainfrom
feat/plugin-packages
Sep 21, 2026
Merged

SizzleUnrlsd merged 3 commits into
mainfrom
feat/plugin-packages

Conversation

@SizzleUnrlsd

Copy link
Copy Markdown
Contributor

Closes #93.

What

_import_entrypoint loaded the single <module>.py next to plugin.toml, never registered it in sys.modules and gave it no search location, so a plugin could not split its symbol tables across files.

  • entrypoint.module may now name a package, <module>/__init__.py: it is loaded with submodule_search_locations and registered in sys.modules under its path-derived name before exec_module, so relative imports resolve.
  • A plain <module>.py loads exactly as before.
  • Two plugins with the same module name do not collide: the unique name derived from the path stays.

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 named sample.

Full suite: 891 passed. ruff check and mypy src clean.

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.

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
@SizzleUnrlsd
SizzleUnrlsd merged commit 1e0a383 into main Sep 21, 2026
10 checks passed
@SizzleUnrlsd
SizzleUnrlsd deleted the feat/plugin-packages branch September 21, 2026 23:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Plugin API: load a plugin as a package with several modules

1 participant