Skip to content

Ignore imported initializer classes in script discovery#1509

Open
biefan wants to merge 1 commit intoAzure:mainfrom
biefan:ignore-imported-script-initializers
Open

Ignore imported initializer classes in script discovery#1509
biefan wants to merge 1 commit intoAzure:mainfrom
biefan:ignore-imported-script-initializers

Conversation

@biefan
Copy link
Contributor

@biefan biefan commented Mar 17, 2026

Summary

  • only instantiate initializer subclasses that are defined in the loaded script module itself
  • keep imported helper initializers available for reuse without auto-registering them as script initializers
  • add a regression test covering imported and local initializer classes in the same script

Problem

_load_initializers_from_scripts() currently instantiates every PyRITInitializer subclass found in a script module namespace, including classes that were only imported into that script. That makes script discovery load more initializers than the user actually defined in the file they passed in.

Validation

  • .venv/bin/pytest tests/unit/setup/test_initialization.py -q
  • .venv/bin/ruff check pyrit/setup/initialization.py tests/unit/setup/test_initialization.py

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