perf: lazy-load plotting functions, drop unused seaborn dependency#2
Merged
Conversation
selectsim/__init__.py eagerly imported selectsim.plotting at package import time, which pulls in matplotlib and scipy (used nowhere outside plotting.py) even for callers who only call selectX() and never plot anything. Plotting functions (obs_exp_scatter, ridge_plot_ed, oncoprint, etc.) are now resolved lazily on first access via a PEP 562 module __getattr__ instead -- same ss.<name> usage, just deferred. Measured: `import selectsim` dropped from ~1.5s to ~0.6s. Also drops the seaborn dependency: it was listed in pyproject.toml and mentioned in a couple of docstrings, but grep confirms it was never actually imported or used anywhere in the codebase. Updated the introduction tutorial's Session info cell to match (it printed seaborn.__version__). Bumped to 0.3.1; full test suite (148 tests) and the tutorial notebook both verified passing after the change. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018g7ADBXHN2yWDkf2NPyNm3
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.
selectsim/init.py eagerly imported selectsim.plotting at package import time, which pulls in matplotlib and scipy (used nowhere outside plotting.py) even for callers who only call selectX() and never plot anything. Plotting functions (obs_exp_scatter, ridge_plot_ed, oncoprint, etc.) are now resolved lazily on first access via a PEP 562 module getattr instead -- same ss. usage, just deferred. Measured:
import selectsimdropped from ~1.5s to ~0.6s.Also drops the seaborn dependency: it was listed in pyproject.toml and mentioned in a couple of docstrings, but grep confirms it was never actually imported or used anywhere in the codebase. Updated the introduction tutorial's Session info cell to match (it printed seaborn.version).
Bumped to 0.3.1; full test suite (148 tests) and the tutorial notebook both verified as passing after the change.