Skip to content

API coherence: WorkflowResult return type, public-surface hygiene, config de-dup - #106

Merged
isayev merged 2 commits into
mainfrom
refactor/api-coherence
Jun 13, 2026
Merged

API coherence: WorkflowResult return type, public-surface hygiene, config de-dup#106
isayev merged 2 commits into
mainfrom
refactor/api-coherence

Conversation

@isayev

@isayev isayev commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

The deferred API-coherence work from the CLI review. Two independent reviews (architecture + correctness) verified the change set is backwards-compatible and ship-able; the one actionable finding (defensive count read in run.py) was applied.

main() returns a WorkflowResult

A str subclass whose value is the output SDF path — a verified drop-in for the previous return (isinstance(str), Path(), open(), ==, hashing, pickling, json.dumps all behave identically) — that also exposes n_molecules/n_conformers, computed lazily and cached. The CLI reads these off the result instead of re-opening the SDF; count_from_output now delegates to a single-source core count_output.

Public-surface hygiene

  • get_stable_tautomers/select_tautomers promoted into Auto3D.__all__; added a self-describing generate_conformers alias for main() (main stays exported); lazy __getattr__ refactored into one name -> (module, attr) table.
  • Module-level __all__ added to SPE.py, ASE/geometry.py, ASE/thermo.py, tautomer.py.

Config coherence

  • Replaced hardcoded opt_tol/opt_steps/batchsize_atoms literals in opt_geometry/calc_thermo with the DEFAULT_* constants (same values; thermo's 2e-4 becomes DEFAULT_THERMO_CONVERGENCE_THRESHOLD).
  • Added a test asserting CLIConfig covers every public Auto3DOptions field, so the config layers can't silently drift.

All values preserved (no behavior change). Fast gate: 671 passed (+8 new tests); ruff clean on src/. CHANGELOG updated.

Still deferred (CLI/feature, not API coherence): registry-aware models (models test <engine>), wiring progress.py's live display into the run loop.

isayev added 2 commits June 13, 2026 01:54
main() now returns a WorkflowResult -- a str subclass whose value is the output
SDF path (a drop-in for the path string it returned before: isinstance(str),
Path(), open(), ==, hashing, pickling all behave identically) that also exposes
n_molecules / n_conformers, computed lazily from the output and cached. The CLI
run command reads those counts off the result instead of re-opening the SDF, and
cli.results.count_from_output now delegates to the single-source core
Auto3D.results.count_output. Backwards-compatible.
- Promote get_stable_tautomers/select_tautomers into the public API
  (Auto3D.__all__) and add a self-describing generate_conformers alias for
  main(); refactor the lazy __getattr__ into a single name->(module,attr) table.
- Add module-level __all__ to SPE.py, ASE/geometry.py, ASE/thermo.py, and
  tautomer.py to pin each module's exported surface.
- Replace hardcoded opt_tol/opt_steps/batchsize_atoms literals in
  opt_geometry/calc_thermo with the DEFAULT_* constants (same values; the
  thermo-specific 2e-4 tolerance becomes DEFAULT_THERMO_CONVERGENCE_THRESHOLD),
  and add a test asserting CLIConfig covers every public Auto3DOptions field so
  the config layers cannot silently drift.
@isayev
isayev merged commit 289463a into main Jun 13, 2026
8 of 9 checks passed
@isayev
isayev deleted the refactor/api-coherence branch June 13, 2026 06:00
isayev added a commit that referenced this pull request Jul 11, 2026
API coherence: WorkflowResult return type, public-surface hygiene, config de-dup
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