Skip to content

Add optional lazy plugin loading driven by entry points - #327

Merged
graepaul merged 7 commits into
developmentfrom
feature/lazyloader-dev
Oct 30, 2026
Merged

graepaul merged 7 commits into
developmentfrom
feature/lazyloader-dev

Conversation

@graepaul

@graepaul graepaul commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Adds an opt-in lazy plugin loading mode plugins no longer import every pluginmodule at startup. The default (eager) behaviour is unchanged.

Enable with node-scraper --lazy-load ... or NODESCRAPER_LAZY_LOAD=1.

Lazy plugin registry (pluginregistry.py)

  • New PluginRegistry(lazy_load=...) option and LazyPluginMapping. mapping[name], get(name) and name in mapping import just that plugin.

CLI

  • New --lazy-load flag. run-plugins subparsers are built only for the plugins named on the command line,
    and --help still builds all of them s

Test plan

  • Full unit suite passes with NODESCRAPER_LAZY_LOAD=1 and without it
  • `node-scraper --lazy-load run-plud

graepaul and others added 5 commits October 27, 2026 10:23
PluginRegistry imported every plugin module at startup (~260 plugin modules,
~2.4s) even when a run uses one or two plugins. Add an opt-in lazy mode
(--lazy-load, NODESCRAPER_LAZY_LOAD=1, or PluginRegistry(lazy_load=True)) that
indexes plugin names from source without importing and resolves a plugin class
on first access, i.e. when PluginExecutor runs it. Eager loading stays the default.

- LazyPluginMapping: dict-like name->class mapping; broken plugins are logged
  and treated as missing instead of aborting the registry.
- ConfigRegistry can defer entry-point recipes (lazy_entry_point_configs) so
  AllIbPlugins no longer resolves every plugin at startup.
- In lazy mode the CLI builds per-plugin subparsers only for plugins named on
  the command line.
- Centralize registry creation: cli.main() builds the single registry and
  installs it with set_default_registry(); PluginDiscovery and the
  PluginExecutor fallback use default_registry() instead of building their own.
- Add scripts/memray to compare memory use of the eager and lazy paths.

Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added documentation Improvements or additions to documentation framework labels Oct 28, 2026
@github-actions github-actions Bot added the tests label Oct 30, 2026
@graepaul
graepaul merged commit 76eff90 into development Oct 30, 2026
7 checks passed
@graepaul
graepaul deleted the feature/lazyloader-dev branch October 30, 2026 18:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation framework tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants