molplotly is a single-module package (~520 lines) that adds interactive molecule hover tooltips to plotly figures using RDKit and Dash. The core idea is solid but the package is broken on PyPI, relies on a deprecated dependency (JupyterDash), has fragile packaging, minimal tests, and several unaddressed user issues.
- Why:
JupyterDashis deprecated and causes doubled plots + port errors on Dash >= 2.10 (issue #31). This is the #1 breakage. - What: Adopt the approach from PR #32 (open since Dec 2023, never reviewed) — replace
jupyter-dashimports with standarddash.Dash. Modern Dash (>=2.11) natively supports Jupyter withoutJupyterDash. - Files:
molplotly/main.py,tests/test_add_molecules.py
- Why:
setup.pyis legacy,setup_pip.pyuses the removeddistutils, and the current PyPI release (1.1.8) has mismatched version metadata making it uninstallable (issue #35). - What:
- Create
pyproject.tomlwith all metadata, dependencies, and build config - Delete
setup.pyandsetup_pip.py - Set a correct, bumped version (e.g. 2.0.0 given the breaking
JupyterDashremoval) - Pin minimum dependency versions sensibly:
dash>=2.11.0,plotly>=5.0.0,rdkit,pandas - Remove
jupyter-dash,werkzeug,ipykernel,nbformatfrom required deps (no longer needed without JupyterDash; Dash pulls in werkzeug transitively)
- Create
- Files: new
pyproject.toml, deletesetup.py, deletesetup_pip.py
- Why: CI uses Python 3.8 (EOL),
rdkit-pypi(renamed), andactions/setup-python@v2(outdated). - What:
- Bump to Python 3.10+ (or test matrix 3.10/3.11/3.12)
- Use
actions/checkout@v4,actions/setup-python@v5 - Remove miniconda setup (rdkit installs fine via pip now)
- Install via
pip install .[test](which will use pyproject.toml)
- Files:
.github/workflows/test.yml
- Bare except (line ~369): Catch specific
ExceptionorValueErrorinstead of bareexcept: - Unused imports / dead code: Audit and remove
- Type hints: Add missing type hints to
test_groups,find_correct_column_order,find_grouping - Docstrings: Add/improve docstrings for the public
add_moleculesfunction and helpers - Files:
molplotly/main.py
- Why:
from .main import *exports everything including internal helpers - What: Define
__all__to only exportadd_molecules(the public API), or use explicit imports - Files:
molplotly/__init__.py
- Use
importlib.metadatato expose__version__from the installed package metadata (single source of truth frompyproject.toml) - Files:
molplotly/__init__.py
- Why: Currently 1 test that only checks
isinstance(app, JupyterDash)— no functional validation - What: Add tests for:
- Basic scatter plot with molecules
- Color column grouping
- Symbol column grouping
- Facet column support
- Multiple SMILES columns
- Reaction SMILES drawing
- Edge cases: missing SMILES, invalid SMILES, empty dataframe
- Caption formatting functions
- The
find_groupinglogic (unit test the helper directly)
- Files:
tests/test_add_molecules.py(or split into multiple test files)
- Update installation instructions
- Note the
JupyterDash→Dashmigration (breaking change for users who import JupyterDash type) - Update the "known issues" section (remove stale items, add current limitations)
- Update badges if any
- Why: Shows version 1.1.1 and date 2022-03-01, both stale
- What: Bump version and date to match the new release
- Verify notebooks still run with the updated code
- Remove/fix any
JupyterDash-specific patterns
These are lower priority but worth tracking:
| Issue | Description | Effort |
|---|---|---|
| #34 | Streamlit integration | Medium — would need a different rendering approach |
| #29 | Embed in existing Dash app | Medium — return a Dash component instead of a full app |
| #26 | Support for stacked bar charts / graph_objects | Small-Medium |
| #4 | Export as standalone HTML | Hard — fundamental limitation of needing a Dash server |
| #20 | Usage question (resolved) | Can be closed |
| #21 | make_subplots support | Medium |
- Phase 1.1 — Replace JupyterDash (unblocks everything)
- Phase 1.2 — pyproject.toml migration (fixes packaging)
- Phase 2.1-2.3 — Code cleanup (while we're in the code)
- Phase 1.3 — Update CI (validates the above changes)
- Phase 3 — Expand tests
- Phase 4 — Docs & metadata
- Phase 5 — Feature work (separate PRs)
Phases 1-4 could reasonably be done as a single "v2.0.0" release given the breaking JupyterDash change.