Skip to content

fix: register every plugin module in sys.modules before it runs - #107

Merged
SizzleUnrlsd merged 2 commits into
mainfrom
fix/register-plugin-modules
Sep 22, 2026
Merged

SizzleUnrlsd merged 2 commits into
mainfrom
fix/register-plugin-modules

Conversation

@SizzleUnrlsd

Copy link
Copy Markdown
Contributor

Closes #105.

_import_entrypoint registered a plugin module in sys.modules only when it was a package (#93). dataclasses resolves postponed annotations through sys.modules[cls.__module__], so a single-file plugin could not define a @dataclass under from __future__ import annotations.

Every plugin module is now registered under its path-derived name before exec_module.

Test: a single-file plugin defining a frozen dataclass with postponed annotations loads. Full suite 900 passed; ruff and mypy clean.

Only packages were registered, so dataclasses could not resolve the
postponed annotations of a class defined in a single-file plugin.

Closes #105
@SizzleUnrlsd SizzleUnrlsd self-assigned this Sep 22, 2026
@SizzleUnrlsd
SizzleUnrlsd merged commit 76e1cd2 into main Sep 22, 2026
10 checks passed
@SizzleUnrlsd
SizzleUnrlsd deleted the fix/register-plugin-modules branch September 22, 2026 13:51
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: register single-file plugin modules in sys.modules

1 participant