Skip to content

refactor(seqopt): make SeqOpt core (lazy ShapModel); only mode='impact' needs pro#279

Merged
breimanntools merged 2 commits into
masterfrom
refactor/seqopt-core-lazy-shap
Jun 26, 2026
Merged

refactor(seqopt): make SeqOpt core (lazy ShapModel); only mode='impact' needs pro#279
breimanntools merged 2 commits into
masterfrom
refactor/seqopt-core-lazy-shap

Conversation

@breimanntools

Copy link
Copy Markdown
Owner

Summary

Make SeqOpt a core class — only the SHAP-guided mode="impact" needs aaanalysis[pro].

The EA machinery (NSGA-II, all operators), SeqOptPlot, and mode="importance" are pure-Python and need nothing pro; only mode="impact" uses SHAP. So:

  • Lazy ShapModel import inside the impact path → SeqOpt is importable in a base install. Constructing mode="impact" without shap raises a friendly aaanalysis[pro] install hint.
  • Moved SeqOpt/SeqOptPlot + _backend/seqopt/ from protein_design_pro/ into the core protein_design/ subpackage; removed the now-empty protein_design_pro package.
  • __init__.py: pro try/except gate → core exports of SeqOpt/SeqOptPlot.
  • Updated: DEDICATED_OWNERS, test imports (+ tests dir → seqopt_tests, shap-guard only the impact tests), the comparison script, the [pro] markers, ADR-0043 (D1 amended), CONTEXT.md, the release note, and the docstring-guide table — all to "core; mode="impact" needs pro".

Verification

Verified with shap blocked (simulated base install): import works, mode="importance" runs, mode="impact" raises the pro hint — with a regression test. 96 SeqOpt tests + 268 in the broad gate; docstrings 0 defects; merged current with master.

(Why: the convention test test_docstring_contracts requires every *_pro symbol to be [pro], so a core class can't live in a _pro package — hence the move.)

🤖 Generated with Claude Code

breimanntools and others added 2 commits June 26, 2026 04:51
…t' needs pro

SeqOpt's EA machinery, plots, and mode='importance' are all pure-Python and need nothing
pro; only the SHAP-guided mode='impact' needs shap. So:
- Import ShapModel lazily inside the impact path; SeqOpt is now importable in a base
  install. Constructing mode='impact' without shap raises a friendly aaanalysis[pro] hint.
- Move SeqOpt/SeqOptPlot + _backend/seqopt/ from protein_design_pro/ into the core
  protein_design/ subpackage; remove the now-empty protein_design_pro package.
- __init__.py: replace the pro try/except gate with core exports of SeqOpt/SeqOptPlot.
- DEDICATED_OWNERS, test imports (+ rename tests dir -> seqopt_tests, shap-guard only the
  impact tests), comparison script, [pro] markers, ADR-0043 (D1 amended), CONTEXT,
  release notes and the docstring-guide table all updated to 'core; impact needs pro'.

Verified: SeqOpt imports + mode='importance' runs with shap blocked; mode='impact' raises
the pro hint. 96 SeqOpt tests + 0 docstring defects.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@breimanntools breimanntools left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks fine

@codecov

codecov Bot commented Jun 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.13%. Comparing base (ae64fe2) to head (2a6a6f5).
⚠️ Report is 3 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #279      +/-   ##
==========================================
- Coverage   96.13%   96.13%   -0.01%     
==========================================
  Files         176      175       -1     
  Lines       16827    16823       -4     
  Branches     2877     2877              
==========================================
- Hits        16176    16172       -4     
  Misses        366      366              
  Partials      285      285              
Files with missing lines Coverage Δ
aaanalysis/__init__.py 97.01% <100.00%> (-0.32%) ⬇️
aaanalysis/protein_design/__init__.py 100.00% <100.00%> (ø)
...aanalysis/protein_design/_backend/seqopt/genome.py 82.60% <ø> (ø)
...analysis/protein_design/_backend/seqopt/metrics.py 89.74% <ø> (ø)
aaanalysis/protein_design/_backend/seqopt/nsga2.py 95.53% <ø> (ø)
...analysis/protein_design/_backend/seqopt/penalty.py 92.85% <ø> (ø)
aaanalysis/protein_design/_backend/seqopt/run.py 94.02% <ø> (ø)
aaanalysis/protein_design/_seqopt.py 89.07% <100.00%> (ø)
aaanalysis/protein_design/_seqopt_plot.py 92.04% <ø> (ø)
Components Coverage Δ
cpp_core 94.95% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@breimanntools breimanntools merged commit b0ab09d into master Jun 26, 2026
17 checks passed
@breimanntools breimanntools deleted the refactor/seqopt-core-lazy-shap branch June 26, 2026 04:22
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