refactor: split modpods into package, remove dead weight, cut deps - #24
Merged
Conversation
- Split 3,369-line modpods.py monolith into 8-file package:
- transforms.py: TransformCache, transform_inputs, Bayesian helpers
- model.py: SINDY_delays_MI
- train.py: delay_io_train, _run_scipy_optimizer
- predict.py: delay_io_predict
- lti.py: lti_from_gamma, lti_system_gen
- topology.py: find_topology_no_geo, infer_causative_topology
- metrics.py: compute_basic_metrics (deduplicated from model.py/predict.py)
- __init__.py: explicit public API re-exports
- Delete dead weight:
- modpods_backup.py (2,685 lines, never imported)
- 16 loose PNG/SVG/TMP test artifacts
- ~150 lines of commented-out code blocks
- deprecated find_topology() wrapper
- Cut dependencies:
- Removed cvxpy (pysindy constrained SR3 works without it)
- Removed statsmodels, dill, pystorms, pyswmm (zero imports)
- Core install shrinks from 12 to 7 direct deps
- Extract duplicated metric computation (MAE, RMSE, NSE, alpha, beta)
into compute_basic_metrics() in modpods/metrics.py
- Speed up tests:
- Reduced max_iter in optimization fixtures from 20 to 10
- Reduced max_iter in lti_system_gen test from 10 to 5
- Reduced max_iter in forcing_coef_constraints test from 10 to 5
- Replace transform_inputs_correctness FFT convolution with
known-good literal array (n=20 instead of n=100)
- Lint/typecheck clean: ruff passes, mypy passes
- Public API unchanged: import modpods; dir(modpods) identical
- 23/23 non-slow tests pass; full suite passes including slow
pysindy.optimizers._constrained_sr3 imports cvxpy as cp at module load time, so removing cvxpy from pyproject.toml/requirements.txt causes import failures in CI even though modpods.py never directly imports cvxpy. Add it back.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Split 3,369-line modpods.py monolith into 8-file package:
Delete dead weight:
Cut dependencies:
Extract duplicated metric computation (MAE, RMSE, NSE, alpha, beta) into compute_basic_metrics() in modpods/metrics.py
Speed up tests:
Lint/typecheck clean: ruff passes, mypy passes
Public API unchanged: import modpods; dir(modpods) identical
23/23 non-slow tests pass; full suite passes including slow