Skip to content

Feature/plugin registry cache adjustments#241

Open
graepaul wants to merge 4 commits into
developmentfrom
feature/plugin_registry_cache_adjustments
Open

Feature/plugin registry cache adjustments#241
graepaul wants to merge 4 commits into
developmentfrom
feature/plugin_registry_cache_adjustments

Conversation

@graepaul

Copy link
Copy Markdown
Collaborator

Summary

Refactors the plugin discovery system from standalone functions to a class-based PluginDiscovery architecture with configurable caching and thread-safe class-level cache. Also adds extensive caching infrastructure to PluginRegistry.

Other minor plugin recipe adjustments as well.

Changes

PluginDiscovery Refactoring (nodescraper/pluginrecipe/discovery.py)

Breaking: Converted standalone functions to PluginDiscovery class methods:
<function_name>() → PluginDiscovery().<function_name>()

Has the ability to cache to reduce import times.

Removed from public API:

  • All standalone functions removed from nodescraper/pluginrecipe/init.py
  • Updated all internal callers to use PluginDiscovery() instances

PluginRegistry Caching (nodescraper/pluginregistry.py)

Added class-level caching infrastructure:

Thread-safe cache access with RLock and double-checked locking

load_plugins_from_entry_points() now returns a copy of cached plugins to prevent corruption

AnalyzerArgs

Changed model_config from dict to ConfigDict(extra="forbid") and removed exclude_none. Now exclude_none is done via
the @model_serializer, since pydantic doesn't support model config with exclude_none.
Fixed error message formatting (string interpolation to f-string)

PluginRunFlags Migration (nodescraper/pluginrecipe/pluginrecipe.py)

Converted from @DataClass(frozen=True) to Pydantic BaseModel with ConfigDict(frozen=True), to be more consistent since we use pydantic elsewhere.

Test Coverage

New: test/functional/test_discovery.py - Comprehensive functional tests for PluginDiscovery:

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.

1 participant