This guide is for contributors extending DifferentialLab internals or adding new problem modules.
Use the project-local virtual environment .venv.
Windows:
bin\setup.bat --dev
.venv\Scripts\activateLinux/macOS:
./bin/setup.sh --dev
source .venv/bin/activateManual equivalent:
pip install -e ".[dev]"Optional docs toolchain:
pip install -e ".[docs]"src/config: constants, paths,.envschema, and equation catalogssrc/solver: parsers, validators, numerical solvers, notation, and statisticssrc/frontend: Tkinter dialogs, theme, embedded plots, and UI helperssrc/plotting: Matplotlib plotting and animation metadata helperssrc/transforms: function parser and transform enginesrc/complex_problems: plugin subsystem for specialized modelssrc/pipeline.py: orchestration for the standard solve flowsrc/utils: logging, exports, exceptions, update checks, and shared expression parsingtests: pytest suitedocs: Sphinx + MyST documentation
- Include typing in function definitions.
- Keep compute kernels independent from UI code.
- Prefer typed dataclasses for solver outputs.
- Validate user input before solver invocation.
- Reuse helpers in
complex_problems/commoninstead of duplicating dialog logic. - Reuse
frontend.ui_dialogs.solve_sessionfor retained standard-workflow state andfrontend.ui_dialogs.symbol_palettefor supported expression insertion. - Keep plugin defaults computationally reasonable for interactive use.
- Keep public-facing docs aligned with
pyproject.toml,ENV_SCHEMA, and the plugin registry.
- Use readable mathematical notation in labels when it improves clarity.
- If a Unicode subscript is unavailable for a symbol, use
base_subscriptfallback style, for exampleN_thetaorN_phi. - Prefer non-selectable labels for static help/description text.
- Keep copy-oriented text areas only where users intentionally need to paste symbols or expressions.
- Create a package under
src/complex_problems/<plugin_id>/. - Implement:
problem.pywith descriptor andopen_dialogui.pyfor inputssolver.pyfor numericsresult_dialog.pyfor plotsmodel.pyfor physical/math helpers when useful
- Export public pieces in the package
__init__.py. - Register the module in
src/complex_problems/problem_registry.py. - Add tests:
- solver behavior
- registry dispatch
- UI construction when practical
- Update docs:
docs/complex-problems.mddocs/api/complex_problems.rstCHANGELOG.md
From an activated .venv:
ruff check . --fix
ruff format .
pytest
pyrightRun pyright when it is installed in your environment. For focused work, run
the nearest tests first, then the broader set.
Useful focused commands:
pytest tests/test_complex_problems_registry.py
pytest tests/test_membrane_2d_solver.py
pytest tests/test_nonlinear_waves_solver.py
pytest tests/test_schrodinger_td_solver.py
pytest tests/test_antenna_radiation_solver.py
pytest tests/test_aerodynamics_2d_solver.py
pytest tests/test_aerodynamics_3d.py
pytest tests/test_gravitational_n_body.py
pytest tests/test_fput_experiment.py
pytest tests/test_pipe_flow_solver.py
pytest tests/test_advanced_config_dialog_ui.py
pytest tests/test_complex_problem_result_dialog_ui.pypython -m sphinx -W --keep-going -b html docs docs/_build/htmlFor Windows:
python -m sphinx -W --keep-going -b html docs docs/_build/htmlDocumentation should be updated when a change affects:
- user-visible behavior
- configuration keys or defaults
- supported equations, plugins, transforms, or exports
- public modules covered by API docs
- setup, run, test, or release workflow
- Version updated where required.
CHANGELOG.mdentry added.- Relevant docs updated.
- Tests pass in the expected scope.
ruff check . --fixandruff format .have been run.pyrightpasses before merge or push when it is available.- New plugin appears in the registry, guide page, and API docs.