Skip to content

Migrate synthesis-method registry to shared synthesis-methods package#8

Closed
micah-olivas wants to merge 1 commit into
mainfrom
worktree-migrate-synthesis-methods-pkg
Closed

Migrate synthesis-method registry to shared synthesis-methods package#8
micah-olivas wants to merge 1 commit into
mainfrom
worktree-migrate-synthesis-methods-pkg

Conversation

@micah-olivas

Copy link
Copy Markdown
Contributor

What

Migrates uSort-M off its own copy of the synthesis-method registry and onto the standalone synthesis-methods package (private repo micah-olivas/synthesis-methods, also consumed by library_designer), so method definitions live in one place. Cost computation stays in uSort-M. No cost math or pricing numbers change.

Changes

  • src/usortm/costs/method_loader.py — now a thin shell that re-exports the registry (METHODS_DIR, SynthesisMethod, load_method, load_all_methods, find_methods) from synthesis_methods, and keeps compute_cost + the four _compute_* helpers unchanged (uSort-M–specific).
  • pyproject.toml — adds the synthesis-methods dependency; drops the now-unused tomli backport (TOML parsing lives in the package now).
  • Deletes src/usortm/costs/methods/ — the 8 method TOMLs + sources/ (the package owns them; 559 deletions).

Back-compat

Every existing from usortm.costs.method_loader import … keeps working via the re-export — consumers (cost_functions.py, cli/plan.py, cli/estimate.py, docs/generate_cost_data.py, tests/test_method_loader.py) are untouched.

Verification

  • Import check → load_all_methods() returns 8 methods.
  • Cost regression: compute_cost across every method × a (count × length) grid — output byte-identical pre/post (sha256 match).
  • pytest tests/test_method_loader.py → 11 passed; full suite → 140 passed.
  • estimate --json (library 500 × 300 bp, seeded sim) → byte-identical JSON pre/post.

Dev setup

The package is private/unpublished, so install it editable alongside uSort-M:

pip install -e ../synthesis-methods   # first, so pip sees the requirement satisfied
pip install -e .

Switch the pyproject entry to a git/index source once synthesis-methods is public. Going forward, edit method TOMLs only in the synthesis-methods repo.

The SynthesisMethod model, TOML loader, and the 8 method .toml definitions
have moved to the standalone synthesis-methods package (shared with
library_designer). usortm.costs.method_loader now re-exports the registry
(METHODS_DIR, SynthesisMethod, load_method, load_all_methods, find_methods)
from that package and keeps only cost computation (compute_cost and the four
_compute_* helpers), which is uSort-M specific. No cost math or pricing
numbers change.

- pyproject: add synthesis-methods dependency; drop the now-unused tomli
  backport (TOML parsing now lives in the package)
- delete vendored src/usortm/costs/methods/ (8 TOMLs + sources/)

Back-compat: all existing usortm.costs.method_loader imports still resolve.
Full test suite (140) passes; the cost fingerprint across every method and
the `estimate --json` output are byte-identical pre/post migration.
@micah-olivas
micah-olivas deleted the worktree-migrate-synthesis-methods-pkg branch July 23, 2026 17:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant