Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/examples/full_build.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Level-2 build example

import sbol2

from buildcompiler.buildcompiler import BuildCompiler
from buildcompiler import BuildCompiler

test_files = Path("tests/test_files")
collection_docs = []
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/offline_lvl1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ Example

import sbol2

from buildcompiler.abstract_translator import extract_toplevel_definition
from buildcompiler import BuildCompiler
from buildcompiler.adapters.pudu import write_assembly_pudu_input_json
from buildcompiler.buildcompiler import BuildCompiler
from buildcompiler.abstract_translator import extract_toplevel_definition

test_files = Path("tests/test_files")
collection_docs = []
Expand Down
5 changes: 3 additions & 2 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ MoClo assembly, transformation, and plating.

The repository currently exposes two useful layers:

* A legacy, artifact-producing compiler in :mod:`buildcompiler.buildcompiler`
that is used by the offline notebooks and PUDU examples.
* An artifact-producing compiler exported as :class:`buildcompiler.BuildCompiler`
that is used by the offline notebooks and PUDU examples. Its implementation
remains in :mod:`buildcompiler.buildcompiler` for compatibility.
* A newer modular API in :mod:`buildcompiler.api`, :mod:`buildcompiler.stages`,
:mod:`buildcompiler.planning`, and :mod:`buildcompiler.execution`.

Expand Down
2 changes: 1 addition & 1 deletion docs/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ Load the local fixture collections:

import sbol2

from buildcompiler import BuildCompiler
from buildcompiler.abstract_translator import extract_toplevel_definition
from buildcompiler.buildcompiler import BuildCompiler

repo = Path.cwd()
test_files = repo / "tests" / "test_files"
Expand Down
2 changes: 1 addition & 1 deletion notebooks/build_compiler_test.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"outputs": [],
"source": [
"import sbol2\n",
"from buildcompiler.buildcompiler import BuildCompiler\n",
"from buildcompiler import BuildCompiler\n",
"from buildcompiler.abstract_translator import extract_toplevel_definition"
]
},
Expand Down
3 changes: 2 additions & 1 deletion notebooks/buildcompiler_offline_quickstart.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
"\n",
"from buildcompiler.api import BuildCompiler as OrchestratedBuildCompiler\n",
"from buildcompiler.api import BuildOptions, domestication as run_domestication\n",
"from buildcompiler.buildcompiler import BuildCompiler, _extract_lvl2_TUs\n",
"from buildcompiler import BuildCompiler\n",
"from buildcompiler.buildcompiler import _extract_lvl2_TUs\n",
"from buildcompiler.abstract_translator import extract_toplevel_definition\n",
"from buildcompiler.adapters.pudu import domestication_artifacts_to_pudu_json, write_assembly_pudu_input_json\n",
"from buildcompiler.domain import BuildRequest, BuildStage, DesignKind, IndexedBackbone, IndexedPlasmid, IndexedReagent, MaterialState, StageStatus\n",
Expand Down
2 changes: 1 addition & 1 deletion notebooks/buildcompiler_transformation_quickstart.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"\n",
"from buildcompiler.abstract_translator import extract_toplevel_definition\n",
"from buildcompiler.adapters.pudu import plating_to_pudu_json, transformations_to_pudu_json, write_assembly_pudu_input_json\n",
"from buildcompiler.buildcompiler import BuildCompiler\n",
"from buildcompiler import BuildCompiler\n",
"\n",
"\n",
"def find_repo_root(start: Path) -> Path:\n",
Expand Down
2 changes: 1 addition & 1 deletion notebooks/comb_design.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"outputs": [],
"source": [
"import sbol2\n",
"from buildcompiler.buildcompiler import BuildCompiler"
"from buildcompiler import BuildCompiler"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion notebooks/full_build_quickstart.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"from pathlib import Path\n",
"import sbol2\n",
"\n",
"from buildcompiler.buildcompiler import BuildCompiler"
"from buildcompiler import BuildCompiler"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion notebooks/full_build_workflow_examples.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"import sbol2\n",
"\n",
"from buildcompiler.abstract_translator import extract_toplevel_definition\n",
"from buildcompiler.buildcompiler import BuildCompiler\n",
"from buildcompiler import BuildCompiler\n",
"from buildcompiler.constants import ENGINEERED_PLASMID"
]
},
Expand Down
2 changes: 1 addition & 1 deletion notebooks/impl_creation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"outputs": [],
"source": [
"import sbol2\n",
"from buildcompiler.buildcompiler import BuildCompiler"
"from buildcompiler import BuildCompiler"
]
},
{
Expand Down
25 changes: 18 additions & 7 deletions src/buildcompiler/__init__.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,23 @@
"""BuildCompiler public package exports."""

from typing import Any

from .sbol2build import * # noqa: F403
from .api import (
BuildCompiler,
BuildOptions,
assembly_lvl1,
assembly_lvl2,
domestication,
full_build,
transformation,
BuildOptions as BuildOptions,
assembly_lvl1 as assembly_lvl1,
assembly_lvl2 as assembly_lvl2,
domestication as domestication,
full_build as full_build,
transformation as transformation,
)


def __getattr__(name: str) -> Any:
"""Load the artifact-producing compiler only when it is requested."""
if name == "BuildCompiler":
from .buildcompiler import BuildCompiler

globals()[name] = BuildCompiler
return BuildCompiler
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
2 changes: 1 addition & 1 deletion tests/integration/test_legacy_offline_fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import sbol2

from buildcompiler.api import domestication
from buildcompiler.buildcompiler import BuildCompiler
from buildcompiler import BuildCompiler
from buildcompiler.domain import IndexedBackbone, IndexedReagent, StageStatus
from buildcompiler.inventory import Inventory

Expand Down
3 changes: 2 additions & 1 deletion tests/test_buildcompiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@

sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "../src")))

from buildcompiler.buildcompiler import BuildCompiler, _extract_lvl2_TUs
from buildcompiler import BuildCompiler
from buildcompiler.buildcompiler import _extract_lvl2_TUs

from buildcompiler.abstract_translator import extract_toplevel_definition, get_or_pull
from buildcompiler.api import domestication
Expand Down
2 changes: 1 addition & 1 deletion tests/test_buildcompiler_transformation.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "../src")))

from buildcompiler.abstract_translator import extract_toplevel_definition
from buildcompiler.buildcompiler import BuildCompiler
from buildcompiler import BuildCompiler
from buildcompiler.constants import ENGINEERED_PLASMID


Expand Down
2 changes: 1 addition & 1 deletion tests/test_full_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "../src")))

from buildcompiler.buildcompiler import BuildCompiler
from buildcompiler import BuildCompiler
from buildcompiler.plasmid import Plasmid
from buildcompiler.constants import ENGINEERED_PLASMID

Expand Down
2 changes: 1 addition & 1 deletion tests/test_plating.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "../src")))

from buildcompiler.buildcompiler import BuildCompiler
from buildcompiler import BuildCompiler
from buildcompiler.constants import ENGINEERED_PLASMID, ORGANISM_STRAIN
from buildcompiler.robotutils import generate_96_well_positions, normalize_plating_input

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/stages/test_assembly_lvl2.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ def test_assembly_lvl2_incomplete_region_order_blocks_as_hard_constraint():
def test_buildcompiler_assembly_lvl2_respects_supplied_backbone(monkeypatch):
from types import SimpleNamespace

from buildcompiler.buildcompiler import BuildCompiler
from buildcompiler import BuildCompiler
import buildcompiler.buildcompiler as buildcompiler_module

compiler = BuildCompiler.from_local_documents([])
Expand Down
7 changes: 4 additions & 3 deletions tests/unit/test_core_imports.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def test_core_imports_do_not_load_optional_automation_dependencies():
plating_to_pudu_json,
transformation_to_pudu_json,
)
from buildcompiler.api import BuildCompiler, BuildOptions
from buildcompiler.api import BuildCompiler as ApiBuildCompiler, BuildOptions
from buildcompiler import (
BuildCompiler as RootBuildCompiler,
assembly_lvl1,
Expand All @@ -17,12 +17,13 @@ def test_core_imports_do_not_load_optional_automation_dependencies():
full_build,
transformation,
)
from buildcompiler.buildcompiler import BuildCompiler as LegacyBuildCompiler
from buildcompiler.execution import FullBuildExecutor
from buildcompiler.reporting import BuildGraph, BuildReport, BuildSummary

assert buildcompiler
assert BuildCompiler
assert RootBuildCompiler is BuildCompiler
assert ApiBuildCompiler
assert RootBuildCompiler is LegacyBuildCompiler
assert BuildOptions
assert full_build
assert domestication
Expand Down
Loading