Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

BuildCompiler

BuildCompiler is a Python compiler pipeline for synthetic biology build planning. It takes abstract SBOL designs and indexed biological inventory, then produces an executable build plan across domestication, MoClo assembly level 1, MoClo assembly level 2, transformation, and plating.

This repository is being refactored around a clean architecture. The existing codebase is useful as working evidence, especially the level-1 assembly path and SBOL digestion/ligation behavior, but the new implementation should not preserve old APIs, old import paths, or legacy module boundaries except the root package name buildcompiler.

Why this exists

Designing a genetic construct is easier than building it in the lab. BuildCompiler should bridge that gap by compiling:

abstract SBOL design + inventory -> build plan -> SBOL build artifacts -> PUDU JSON -> optional manual/OT-2 protocols

The compiler should answer:

  • Can this design be built from current inventory?
  • Which plasmids, backbones, and reagents are required?
  • Which missing engineered regions need level-1 assembly?
  • Which missing promoter/RBS/CDS/terminator parts need domestication?
  • Which route minimizes new build work?
  • Which transformations and plating layouts follow from successful products?
  • What actions should a user take next when a build is blocked?

Core capabilities for v1

  • Classify SBOL abstract designs into level-2, level-1, domestication, or unsupported work.
  • Plan and execute a bounded full-build dependency loop.
  • Support partial success: build what can be built, report what is missing, and retry after generated products are indexed.
  • Optimize level-2 routes by searching feasible engineered-region orders and minimizing new level-1 plasmids.
  • Optimize level-1 routes by minimizing new domestications.
  • Produce cumulative and per-stage SBOL build artifacts.
  • Produce in-memory PUDU-compatible JSON intermediates in compiler-only mode.
  • Chain successful assembly/domestication products to transformation and plating, deduplicated by product identity.
  • Return structured statuses, missing inputs, required approvals, warnings, summaries, and optional detailed reports.
  • Keep PUDU protocol generation and Opentrons simulation optional.

Non-goals for v1

  • Do not preserve legacy APIs or compatibility wrappers.
  • Do not implement DNA extraction as a real stage; reserve extracted as a future material state.
  • Do not run PUDU or Opentrons simulation by default.
  • Do not make the build graph the scheduler in v1; it is reporting-only.
  • Do not support variable-length level-1 constructs in v1.
  • Do not silently approve sequence edits, reagent purchase, large combinatorial expansion, or large level-2 order search.

Architecture at a glance

BuildCompiler should be organized as a compiler pipeline:

api -> planning -> execution -> stages -> sbol/inventory/adapters -> reporting

Recommended package layout:

src/buildcompiler/
  __init__.py

  api/
    __init__.py
    compiler.py
    options.py

  domain/
    __init__.py
    build_request.py
    build_result.py
    missing_input.py
    material_state.py
    plasmid.py
    reagent.py
    design.py
    approvals.py
    warnings.py

  planning/
    __init__.py
    classifier.py
    combinatorial.py
    full_build_planner.py
    validation.py

  execution/
    __init__.py
    context.py
    full_build_executor.py
    worklist.py
    stage_runner.py
    indexing.py

  stages/
    __init__.py
    domestication.py
    assembly_lvl1.py
    assembly_lvl2.py
    transformation.py
    plating.py

  sbol/
    __init__.py
    assembly.py
    domestication.py
    transformation.py
    documents.py
    identities.py
    resolver.py
    validation.py
    constants.py

  inventory/
    __init__.py
    synbiohub.py
    collection_indexer.py
    plasmid_index.py
    backbone_index.py
    reagent_index.py
    product_index.py
    compatibility.py
    selector.py

  adapters/
    __init__.py
    pudu/
      __init__.py
      assembly_json.py
      transformation_json.py
      plating_json.py
      protocol_generation.py
    opentrons/
      __init__.py
      simulation.py

  reporting/
    __init__.py
    build_graph.py
    summaries.py
    reports.py
    serialization.py

  errors.py
  logging.py

Public API target

Keep the import root buildcompiler.

Primary usage should be stateful and object-based:

from buildcompiler.api import BuildCompiler

compiler = BuildCompiler.from_synbiohub(
    collections=collections,
    sbh_registry=sbh_registry,
    auth_token=auth_token,
    sbol_doc=sbol_doc,
)

plan = compiler.plan(abstract_designs)
result = compiler.execute(plan)

A convenience wrapper may exist:

from buildcompiler.api import full_build

result = full_build(
    abstract_designs=abstract_designs,
    collections=collections,
    sbh_registry=sbh_registry,
    auth_token=auth_token,
    sbol_doc=sbol_doc,
)

BuildCompiler.__init__ should stay lightweight and dependency-injected. Automatic SynBioHub collection indexing belongs in BuildCompiler.from_synbiohub(...).

Local development

Recommended local workflow:

uv sync --all-groups
uv run ruff check .
uv run ruff format --check .
uv run pytest

If uv is not available, use a normal virtual environment and install editable dependencies:

python -m venv .venv
source .venv/bin/activate
python -m pip install -U pip
python -m pip install -e '.[test]'
python -m pip install ruff
ruff check .
ruff format --check .
pytest

Automation-specific tests should be optional:

python -m pip install -e '.[automation,test]'
pytest tests/automation

Container workflow

A Docker Compose workflow is recommended for reliable Codex and contributor development, but it does not need to block the first implementation PR.

Target commands after Docker support exists:

docker compose build
docker compose run --rm app ruff check .
docker compose run --rm app ruff format --check .
docker compose run --rm app pytest

Core CI should not require PUDU or Opentrons. Those dependencies are optional and should live behind optional test jobs or manual workflows.

Testing and quality checks

Default CI should run:

ruff check .
ruff format --check .
pytest tests/unit tests/stages tests/integration

Testing priorities:

  1. Domain dataclasses and status semantics.
  2. Planning and design classification.
  3. Inventory indexing and compatibility selection.
  4. Level-1 and level-2 route optimizers.
  5. Domestication sequence-edit approval behavior.
  6. Full-build bounded retry loop with mocked stages.
  7. SBOL assembly service port using existing fixtures.
  8. Transformation and plating deduplication.
  9. Summary/report/graph generation.
  10. Optional PUDU/Opentrons adapter smoke tests.

How ChatGPT and Codex should use these docs

  • PRODUCT.md defines the product intent, v1 scope, and non-goals.
  • ARCHITECTURE.md defines module boundaries and implementation contracts.
  • AGENT.md defines how Codex should take tasks, report progress, and escalate decisions.
  • ADR-001.md records the clean-architecture rewrite decision and its tradeoffs. Codex should treat these files as the source of truth for implementation unless the user or ChatGPT explicitly revises them.

Running tests locally:

Run these bash commands to establish your SynBioHub account for collection access. These are saved in GitHub secrets for the automated test suite.

export SBH_USERNAME=your_username

export SBH_PASSWORD=your_password

Then run the tests with:

uv run python -m unittest discover -s tests

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

synbio_buildcompiler-0.0.1a2.tar.gz (110.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

synbio_buildcompiler-0.0.1a2-py3-none-any.whl (115.2 kB view details)

Uploaded Python 3

File details

Details for the file synbio_buildcompiler-0.0.1a2.tar.gz.

File metadata

  • Download URL: synbio_buildcompiler-0.0.1a2.tar.gz
  • Upload date:
  • Size: 110.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.16

File hashes

Hashes for synbio_buildcompiler-0.0.1a2.tar.gz
Algorithm Hash digest
SHA256 0190dd3d2cf6bcbfa0af4b33bb63821aa551c77422727f56fbcfdef265daa3ea
MD5 3da52d91d563c6ec7816360d930e0f36
BLAKE2b-256 7d4d1584bf2bd58de7c0df2ce2585db4dcd544b52f009645b503b12c1205a9ca

See more details on using hashes here.

File details

Details for the file synbio_buildcompiler-0.0.1a2-py3-none-any.whl.

File metadata

File hashes

Hashes for synbio_buildcompiler-0.0.1a2-py3-none-any.whl
Algorithm Hash digest
SHA256 6998c766cb0f1c63881bdb5068453e5709db261b08e4d6727d8723cb7155fbec
MD5 ad55d45942831c8f9b2e107d7c06c1f1
BLAKE2b-256 dc3a3a314955590b1cd59076d2c4e43d3a67f0212ddf9696474f2df24ed1553d

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.0.1a2 This release

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page