MAINT: Evict I/O modules from pyrit.models into pyrit.memory.storage#1929
Merged
rlundeen2 merged 13 commits intoJun 6, 2026
Conversation
Move StorageIO/DiskStorageIO/AzureBlobStorageIO, the data-type serializers, and data_serializer_factory out of pyrit.models into a new pyrit.io package. Leave deprecation shims (removed_in 0.17.0) at the old pyrit.models locations and method-level shims (Seed.set_sha256_value_async, MessagePiece.set_sha256_values_async) that delegate to the new free functions in pyrit.io.serializers. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
romanlutz
reviewed
Jun 4, 2026
Relocate the storage/serialization layer from the top-level pyrit.io package into pyrit.memory.storage, resolving the naming collision with pyrit.output and reflecting that the serializers are a facade over CentralMemory (results_path / results_storage_io). Updates all importers, deprecation shims, and the import-boundary allowlist. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Re-export the storage IO classes and data-type serializers from the pyrit.memory package root so callers can use the shorthand (e.g. 'from pyrit.memory import AzureBlobStorageIO'). Update all external consumers to the shorthand. Internal pyrit.memory.* modules keep importing from pyrit.memory.storage directly to avoid an import cycle during package init, and the pyrit.common foundation-layer files keep the precise submodule import. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
romanlutz
reviewed
Jun 4, 2026
romanlutz
reviewed
Jun 4, 2026
romanlutz
reviewed
Jun 4, 2026
romanlutz
reviewed
Jun 4, 2026
romanlutz
reviewed
Jun 4, 2026
romanlutz
reviewed
Jun 4, 2026
romanlutz
reviewed
Jun 4, 2026
romanlutz
reviewed
Jun 4, 2026
romanlutz
approved these changes
Jun 4, 2026
Co-authored-by: Roman Lutz <romanlutz13@gmail.com>
Co-authored-by: Roman Lutz <romanlutz13@gmail.com>
Co-authored-by: Roman Lutz <romanlutz13@gmail.com>
Co-authored-by: Roman Lutz <romanlutz13@gmail.com>
…-pyrit-io # Conflicts: # pyrit/models/data_type_serializer.py # tests/unit/memory/storage/test_serializers.py
…or cycles - display_response: consolidate to single 'from pyrit.memory import' shorthand - chat_message_normalizer/openai_chat_target: revert cycle-inducing package-root self-imports to direct submodule imports - test_import_boundary: update KNOWN_COMMON_VIOLATIONS allowlist to match shortened pyrit.memory imports Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…-pyrit-io # Conflicts: # pyrit/models/data_type_serializer.py # pyrit/models/storage_io.py
- Apply ruff UP007/UP045 (Optional/Union -> X | None) to the relocated serializers.py and storage.py to match the repo-wide modernization (origin/main microsoft#1884) - Add ty pragma for azure readall() str|bytes stub mismatch surfaced by the post-merge ty hardening (microsoft#1931) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
These 6 type errors are pre-existing on main (third-party stub and SQLAlchemy Base typing mismatches from the recent dep audit, microsoft#1931). They were ungated on main because that PR did not touch these files; relocating their imports to pyrit.memory newly subjects them to the per-file ty gate. Add minimal pragmas consistent with the existing codebase convention: - sqlite_memory/azure_sql_memory: session.get(type(entry), entry.id) - sqlite_memory: MemoryExporter.export_data(list(data), ...) - add_image_text_converter: ImageFont.truetype(str | None, ...) - openai_tts_target: AsyncSpeech.create response_format/speed - azure_content_filter_scorer: ContentSafetyClient credential Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
Move StorageIO/DiskStorageIO/AzureBlobStorageIO, the data-type serializers, and data_serializer_factory out of pyrit.models into a new pyrit.io package. Leave deprecation shims (removed_in 0.17.0) at the old pyrit.models locations and method-level shims (Seed.set_sha256_value_async, MessagePiece.set_sha256_values_async) that delegate to the new free functions in pyrit.memory.storage.
Phase 9 of pyrit.models refactor here: https://gist.github.com/rlundeen2/3e8daa8e12a11b4b6e52587b3c9b1dca