Thanks for your interest in contributing! smartreact is an open scientific tool, and we welcome contributions from chemists, cheminformaticians, and software developers alike.
- Report bugs — open a GitHub issue with a minimal reproducible example (input SMILES, expected vs. actual output, traceback).
- Suggest features — open an issue describing the use case before sending a PR for larger changes.
- Contribute reaction templates — see Adding reaction templates below.
- Improve documentation — fixes to the README, docstrings, or notebooks are always welcome.
- Fix bugs or add features — see Development workflow.
This project uses pixi for dependency management.
git clone https://github.com/MolecularAI/smartreact.git
cd smartreact
pixi install -e devThe dev environment adds pytest and ruff on top of the runtime dependencies. (The default environment installs only what end users get.) Other environments are available when needed:
pixi install -e notebook # dev + jupyter + ipywidgets for working with notebooks/
pixi install -e casestudy # dev + scikit-learn, umap-learn, pyarrow, matplotlib for the case studyAll environments share a single dependency solve, so versions stay consistent across them.
git checkout -b your-feature-nameThe pipeline is SMILES → SMARTS-RX classification → template matching → RDKit reaction → products. The core modules live in src/smartreact/ — see the README.md for an overview.
Run these in the dev environment:
pixi run -e dev test # run the test suite
pixi run -e dev lint # check for lint errors
pixi run -e dev format # auto-format with ruff
pixi run -e dev format-check # verify formatting without modifying filesAll of these must pass before opening a pull request.
- Reference any related issue (e.g.
Fixes #42). - Describe what changed and why.
- Include tests for new behavior.
- Keep PRs focused; split unrelated changes into separate PRs.
Reaction templates live in src/smartreact/data/templates.txt (TSV with columns reaction_name, template_id, example, reaction_template, reactant_categories).
When proposing a new template:
- Provide a clear
reaction_nameand a uniquetemplate_id. - Include an
examplereaction (SMILESreactants>>product) so the template's intended behavior is obvious. - Document the chemistry: cite a reference (paper, named reaction, etc.) in the PR description.
- Ensure
reactant_categoriescorrectly references SMARTS-RX functional group keys defined insrc/smartreact/data/keys.txt. - Add a test in
tests/demonstrating the template fires on a known substrate pair and produces the expected product.
Template additions should be reviewed by a maintainer with chemistry expertise (currently Thierry Kogej).
- Python 3.10+, ruff-formatted, line length 100.
- Lint rules:
E, F, W, I, UP, B, SIM(configured inpyproject.toml). smartreactis treated as first-party for import sorting.- Prefer explicit, well-named functions over clever one-liners. Avoid unnecessary comments; let identifiers speak.
- Tests live in
tests/and usepytest. - New features should include unit tests; bug fixes should include a regression test.
- Run a single test with:
pixi run -e dev test -- tests/test_enumerator.py::test_name.
Please do not report security vulnerabilities through public GitHub issues. Instead, contact the maintainers directly.
Be respectful and constructive. We aim for a welcoming environment for contributors of all backgrounds and experience levels.
By contributing, you agree that your contributions will be licensed under the Apache License 2.0 (see LICENSE).