[ISSUE-02] Implement domain enums and result dataclasses#69
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c843d6418d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| id: str | ||
| stage: BuildStage | ||
| source_identity: str | ||
| source_display_id: str | None |
There was a problem hiding this comment.
Preserve advertised Python compatibility in domain contracts
The project metadata still advertises requires-python = ">=3.7", but this new contract class uses 3.10-only annotation syntax (str | None) without postponed annotation evaluation, so importing buildcompiler.domain will fail on supported interpreters (3.7–3.9) at class-definition time. This turns a previously importable package namespace into an import-time error for those environments; either add compatibility-friendly annotations (Optional[...], etc. or from __future__ import annotations) or bump the declared minimum Python version.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
@codex Good catch, lets change the declared minimum Python version to 3.10 onwards
There was a problem hiding this comment.
Summary
- Updated the project metadata to declare Python 3.10+ support by changing
requires-pythonfrom>=3.7to>=3.10inpyproject.toml, matching the 3.10-style type-union syntax already present in the domain contracts. - Committed the change on the current branch (
e994682) and created a follow-up PR with title[ISSUE-02 follow-up] Bump declared Python minimum to 3.10.
Testing
- ✅
python -m py_compile src/buildcompiler/domain/build_request.py - ✅
git diff -- pyproject.toml(verified only the Python version metadata line changed)
|
Closes #54 |
Motivation
full_buildclean-architecture refactor so planner/executor/stages/inventory/reporting can depend on pure enums and dataclasses rather than runtime or automation-specific objects.ARCHITECTURE.mdguidance: use SBOL identity strings in contracts, represent expected blockers and approvals as structured data, and avoid coupling domain imports to PUDU/Opentrons/SynBioHub/SBOLInventory.Description
BuildStage,StageStatus,BuildStatus,MaterialState, andDesignKindinsrc/buildcompiler/domain/.ApprovalStatusandRequiredApproval.BuildRequest,MissingBuildInput(withMissingKind),BuildWarning,IndexedPlasmid,IndexedBackbone,IndexedReagent,StageResult, andFullBuildResultusing safe mutable defaults (field(default_factory=...)) and conservativeAnytyping for not-yet-implemented neighboring contracts or raw SBOL fields.src/buildcompiler/domain/__init__.pyfor lightweight imports.src/buildcompiler/domain/build_stage.py:BuildStagesrc/buildcompiler/domain/status.py:StageStatus,BuildStatussrc/buildcompiler/domain/material_state.py:MaterialStatesrc/buildcompiler/domain/design.py:DesignKindsrc/buildcompiler/domain/build_request.py:BuildRequestsrc/buildcompiler/domain/missing_input.py:MissingBuildInput,MissingKindsrc/buildcompiler/domain/approvals.py:ApprovalStatus,RequiredApprovalsrc/buildcompiler/domain/warnings.py:BuildWarningsrc/buildcompiler/domain/plasmid.py:IndexedPlasmid,IndexedBackbonesrc/buildcompiler/domain/reagent.py:IndexedReagentsrc/buildcompiler/domain/build_result.py:StageResult,FullBuildResultsrc/buildcompiler/domain/__init__.py: exportsAny) forplan,graph,summary, andreportinFullBuildResultto be defined by later milestones.Testing
PYTHONPATH=src python -c "from buildcompiler.domain.build_result import StageResult"succeeded andPYTHONPATH=src python -c "import buildcompiler.domain"succeeded.PYTHONPATH=src pytest tests/unit/domainran and passed: 3 tests passed.tests/unit/domain/test_contracts.pywhich covers enum values, BLOCKED vs FATAL semantics forMissingBuildInput.required_stage, and mutable-default isolation forBuildRequest,StageResult,RequiredApproval, andBuildWarning.uv run ruff check .reported pre-existing repository-wide lint issues unrelated to this change; these are outside the scope of this PR and not introduced by the new domain contracts.uv run pytestin the project virtualenv attempted to fetch an optional git dependency (SBOLInventory) and failed due to network/Git fetch error (HTTP CONNECT 403), so theuv-driven virtualenv install path is blocked by network access; the smallest reproducible test command to run locally later isPYTHONPATH=src pytest tests/unit/domain.Codex Task