Skip to content

[SPRINT-02-01] Add local SBOL document indexing entry point #88

@Gonza10V

Description

@Gonza10V

Parent sprint: #87
Depends on: none
Recommended order: 1
Codex-ready: yes

Goal

Add a first-class local SBOL indexing entry point so BuildCompiler can index already-loaded sbol2.Document objects without requiring SynBioHub registry credentials, auth token, or network access.

Background

The current BuildCompiler.__init__ takes collections, sbh_registry, auth_token, and sbol_doc, creates a sbol2.PartShop, and immediately calls _index_collections(collections). _index_collections treats every collection item as a URI and calls self.sbh.pull(uri, self.sbol_doc). This makes local/offline SBOL collection debugging difficult and hides whether a collection was actually indexed from local data.

Scope

Implement one of these equivalent APIs, choosing the smallest compatible change:

BuildCompiler.from_local_documents(
    collection_docs: list[sbol2.Document],
    design_doc: sbol2.Document | None = None,
)

or:

compiler = BuildCompiler(... minimal args ...)
compiler.index_document(collection_doc)

Preferred direction:

  • Keep existing constructor behavior working if tests or notebooks rely on it.
  • Add a new factory/classmethod for local documents rather than breaking current users.
  • Reuse the same indexing logic that SynBioHub-pulled documents will use in later issues.
  • Avoid any SynBioHub calls in local mode.

Non-goals

  • Do not implement a full clean-architecture rewrite.
  • Do not implement new route selection, assembly, or protocol behavior.
  • Do not require PUDU, Opentrons, or SBOLInventory.

Acceptance criteria

  • Local sbol2.Document objects can be indexed without constructing a real sbol2.PartShop or calling pull.
  • The local entry point populates the same runtime state used today: indexed_plasmids, indexed_backbones, restriction_enzyme_implementations, and ligase_implementations.
  • The local entry point can accept at least one collection document and a design/main document.
  • Existing constructor behavior is not broken.
  • At least one smoke test proves local indexing uses no network or SynBioHub pull.

Verification

Run:

pytest tests/unit tests/integration -k "local and index"
ruff check .

Adjust test paths if the repository currently uses a different layout.

Codex implementation notes

  • This is a seam-creation issue. Keep it minimal.
  • If the current constructor is too rigid, add a private alternate constructor/helper rather than rewriting the class.
  • Prefer explicit names like from_local_documents and index_document over hidden behavior.
  • Make any test fixture tiny; do not require live SynBioHub access.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions