You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Provide compiler-only PUDU adapters for transformation and plating so assembly/transformation/plating stages can produce deterministic in-memory JSON without importing automation libraries.
Add a minimal protocol-artifact boundary so file output is opt-in and deterministic, and ensure Opentrons simulation is explicitly opt-in and lazily imported.
Preserve the compiler-first constraint: no PUDU, Opentrons, SynBioHub, or SBOLInventory imports at core import time and no simulation by default.
Description
Added PUDU adapters that emit in-memory JSON: transformation_to_pudu_json and transformations_to_pudu_json in src/buildcompiler/adapters/pudu/transformation_json.py, and plating_to_pudu_json in src/buildcompiler/adapters/pudu/plating_json.py, both producing deterministic payloads.
Added protocol artifact boundary ProtocolArtifact and maybe_write_protocol_artifacts in src/buildcompiler/adapters/protocols.py which only writes files when options.mode is MANUAL/AUTOMATED and options.results_dir is provided; otherwise artifacts remain in-memory.
Added Opentrons simulation boundary OpentronsSimulationAdapter, SimulationResult, and OptionalAutomationDependencyError in src/buildcompiler/adapters/opentrons/simulation.py that skips importing opentrons when ProtocolOptions.simulate is False and lazily imports (raising a clear error if missing) when True.
Updated lightweight exports to avoid optional side effects in src/buildcompiler/adapters/__init__.py, src/buildcompiler/adapters/pudu/__init__.py, and src/buildcompiler/adapters/opentrons/__init__.py and added focused unit tests for the adapters and boundaries.
Unit tests run: pytest tests/unit/adapters passed and full targeted run pytest tests/unit/api tests/unit/execution tests/unit/adapters passed (all tests in those suites passed).
Lint/format: running ruff format on the modified files and scoped ruff check on adapter files/tests passed; a repository-wide ruff check . surfaced unrelated legacy lint issues outside this change.
Environment/network note: uv run pytest ... (virtualenv creation) failed because fetching the optional SBOLInventory git dependency failed due to a network/Git access error (git clone returned CONNECT tunnel 403); this prevented creating the ephemeral env with optional extras, but local pytest runs for the added tests completed successfully.
Preserve raw text artifacts instead of JSON-encoding them
Handle string payloads separately before writing: maybe_write_protocol_artifacts currently runs json.dumps(...) for every artifact, so text artifacts (for example protocol scripts or markdown content) are written with extra quotes and escape sequences, which makes them unusable as direct protocol files when protocol output is enabled. This regression is triggered whenever a caller passes a str payload in payloads.
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
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.
Motivation
Description
transformation_to_pudu_jsonandtransformations_to_pudu_jsoninsrc/buildcompiler/adapters/pudu/transformation_json.py, andplating_to_pudu_jsoninsrc/buildcompiler/adapters/pudu/plating_json.py, both producing deterministic payloads.ProtocolArtifactandmaybe_write_protocol_artifactsinsrc/buildcompiler/adapters/protocols.pywhich only writes files whenoptions.modeisMANUAL/AUTOMATEDandoptions.results_diris provided; otherwise artifacts remain in-memory.OpentronsSimulationAdapter,SimulationResult, andOptionalAutomationDependencyErrorinsrc/buildcompiler/adapters/opentrons/simulation.pythat skips importingopentronswhenProtocolOptions.simulateis False and lazily imports (raising a clear error if missing) when True.src/buildcompiler/adapters/__init__.py,src/buildcompiler/adapters/pudu/__init__.py, andsrc/buildcompiler/adapters/opentrons/__init__.pyand added focused unit tests for the adapters and boundaries.Testing
python -c "from buildcompiler.api import BuildOptions, ProtocolMode",python -c "from buildcompiler.execution import BuildContext, FullBuildExecutor", andpython -c "from buildcompiler.adapters.pudu import assembly_route_to_pudu_json, transformation_to_pudu_json, plating_to_pudu_json", andpython -c "from buildcompiler.adapters.opentrons import OpentronsSimulationAdapter"all passed.pytest tests/unit/adapterspassed and full targeted runpytest tests/unit/api tests/unit/execution tests/unit/adapterspassed (all tests in those suites passed).ruff formaton the modified files and scopedruff checkon adapter files/tests passed; a repository-wideruff check .surfaced unrelated legacy lint issues outside this change.uv run pytest ...(virtualenv creation) failed because fetching the optionalSBOLInventorygit dependency failed due to a network/Git access error (git clone returned CONNECT tunnel 403); this prevented creating the ephemeral env with optional extras, but localpytestruns for the added tests completed successfully.Codex Task