[FIX]: Avoid eager PyRIT imports during pytest startup - #173
Merged
Spencer Schoenberg (spencrr) merged 1 commit intoAug 24, 2026
Merged
Conversation
Spencer Schoenberg (spencrr)
requested review from
a team
and
a balanced review from Copilot
August 24, 2026 18:20
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Copilot started reviewing on behalf of
Spencer Schoenberg (spencrr)
August 24, 2026 18:21
View session
Contributor
There was a problem hiding this comment.
Pull request overview
Defers PyRIT-backed exports to reduce RAMPART pytest plugin startup time while preserving the public API.
Changes:
- Adds PEP 562 lazy loading and caching for heavy exports.
- Adds regression tests for lightweight startup and lazy resolution.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
rampart/__init__.py |
Lazily resolves PyRIT-backed exports. |
tests/unit/test_public_api.py |
Tests startup imports and export caching. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Nina Chikanov (nina-msft)
approved these changes
Aug 24, 2026
Spencer Schoenberg (spencrr)
merged commit Aug 24, 2026
68641d5
into
microsoft:main
14 checks passed
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Avoid eagerly importing PyRIT and Transformers when pytest loads the RAMPART plugin.
Performance:
Validation:
pre-commit run --all-filesBreaking changes
None.
Checklist
pre-commit run --all-filespasses