Skip to content

Commit 1043fca

Browse files
committed
initial commit
0 parents  commit 1043fca

48 files changed

Lines changed: 27666 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/publish.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
push:
5+
tags: ['v*']
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
with:
13+
fetch-depth: 0
14+
15+
- uses: actions/setup-python@v5
16+
with:
17+
python-version: '3.12'
18+
19+
- name: Install build
20+
run: pip install build
21+
22+
- name: Build sdist and wheel
23+
run: python -m build
24+
25+
- uses: actions/upload-artifact@v4
26+
with:
27+
name: dist
28+
path: dist/
29+
30+
publish:
31+
needs: build
32+
runs-on: ubuntu-latest
33+
environment: pypi
34+
permissions:
35+
id-token: write
36+
steps:
37+
- uses: actions/download-artifact@v4
38+
with:
39+
name: dist
40+
path: dist/
41+
42+
- uses: pypa/gh-action-pypi-publish@release/v1

.github/workflows/test.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- uses: prefix-dev/setup-pixi@v0.8.8
16+
with:
17+
pixi-version: latest
18+
19+
- name: Lint
20+
run: pixi run -e dev lint
21+
22+
- name: Check formatting
23+
run: pixi run -e dev format-check
24+
25+
- name: Type-check
26+
run: pixi run -e dev typecheck
27+
28+
- name: Run tests
29+
run: pixi run -e dev test

.gitignore

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Python
2+
__pycache__/
3+
*.py[codz]
4+
*.so
5+
6+
# Build / packaging
7+
build/
8+
dist/
9+
*.egg-info/
10+
src/smartreact/_version.py
11+
12+
# Testing / coverage
13+
.pytest_cache/
14+
.coverage
15+
htmlcov/
16+
coverage.xml
17+
18+
# Virtual environments
19+
.venv/
20+
.pixi/
21+
22+
# Jupyter
23+
.ipynb_checkpoints/
24+
25+
# Linting / type-checking
26+
.ruff_cache/
27+
.mypy_cache/
28+
29+
# Environment variables
30+
.env
31+
32+
# Local data (root-level only, not src/smartreact/data/)
33+
/data/
34+
35+
# SLURM (cluster-specific, not for publication)
36+
/slurm/
37+
38+
# VS Code settings
39+
.vscode/

AUTHORS.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Authors
2+
3+
`smartreact` is developed and maintained by:
4+
5+
- **Fabian Krüger** — package and code author, maintainer
6+
- **Thierry Kogej** — reaction template design, maintainer
7+
8+
## Contributors
9+
10+
We welcome contributions from the community. Contributors will be listed here.
11+
12+
<!--
13+
Example entry:
14+
- **Name** — contribution area (e.g., SMARTS templates, performance work, documentation)
15+
-->

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Changelog
2+
3+
## [1.0.0] 2026-06-08
4+
5+
### Added
6+
7+
- Initial release of smartreact

CONTRIBUTING.md

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
# Contributing to smartreact
2+
3+
Thanks for your interest in contributing! `smartreact` is an open scientific tool, and we welcome contributions from chemists, cheminformaticians, and software developers alike.
4+
5+
## Ways to contribute
6+
7+
- **Report bugs** — open a GitHub issue with a minimal reproducible example (input SMILES, expected vs. actual output, traceback).
8+
- **Suggest features** — open an issue describing the use case before sending a PR for larger changes.
9+
- **Contribute reaction templates** — see [Adding reaction templates](#adding-reaction-templates) below.
10+
- **Improve documentation** — fixes to the README, docstrings, or notebooks are always welcome.
11+
- **Fix bugs or add features** — see [Development workflow](#development-workflow).
12+
13+
## Development workflow
14+
15+
### 1. Set up the environment
16+
17+
This project uses [pixi](https://pixi.sh) for dependency management.
18+
19+
```bash
20+
git clone https://github.com/MolecularAI/smartreact.git
21+
cd smartreact
22+
pixi install -e dev
23+
```
24+
25+
The `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:
26+
27+
```bash
28+
pixi install -e notebook # dev + jupyter + ipywidgets for working with notebooks/
29+
pixi install -e casestudy # dev + scikit-learn, umap-learn, pyarrow, matplotlib for the case study
30+
```
31+
32+
All environments share a single dependency solve, so versions stay consistent across them.
33+
34+
### 2. Create a branch
35+
36+
```bash
37+
git checkout -b your-feature-name
38+
```
39+
40+
### 3. Make your changes
41+
42+
The 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.
43+
44+
### 4. Run tests, linting, and formatting
45+
46+
Run these in the `dev` environment:
47+
48+
```bash
49+
pixi run -e dev test # run the test suite
50+
pixi run -e dev lint # check for lint errors
51+
pixi run -e dev format # auto-format with ruff
52+
pixi run -e dev format-check # verify formatting without modifying files
53+
```
54+
55+
All of these must pass before opening a pull request.
56+
57+
### 5. Open a pull request
58+
59+
- Reference any related issue (e.g. `Fixes #42`).
60+
- Describe what changed and why.
61+
- Include tests for new behavior.
62+
- Keep PRs focused; split unrelated changes into separate PRs.
63+
64+
## Adding reaction templates
65+
66+
Reaction templates live in `src/smartreact/data/templates.txt` (TSV with columns `reaction_name`, `template_id`, `example`, `reaction_template`, `reactant_categories`).
67+
68+
When proposing a new template:
69+
70+
- Provide a clear `reaction_name` and a unique `template_id`.
71+
- Include an `example` reaction (SMILES `reactants>>product`) so the template's intended behavior is obvious.
72+
- Document the chemistry: cite a reference (paper, named reaction, etc.) in the PR description.
73+
- Ensure `reactant_categories` correctly references SMARTS-RX functional group keys defined in `src/smartreact/data/keys.txt`.
74+
- Add a test in `tests/` demonstrating the template fires on a known substrate pair and produces the expected product.
75+
76+
Template additions should be reviewed by a maintainer with chemistry expertise (currently Thierry Kogej).
77+
78+
## Code style
79+
80+
- Python 3.10+, ruff-formatted, line length 100.
81+
- Lint rules: `E, F, W, I, UP, B, SIM` (configured in `pyproject.toml`).
82+
- `smartreact` is treated as first-party for import sorting.
83+
- Prefer explicit, well-named functions over clever one-liners. Avoid unnecessary comments; let identifiers speak.
84+
85+
## Testing
86+
87+
- Tests live in `tests/` and use `pytest`.
88+
- New features should include unit tests; bug fixes should include a regression test.
89+
- Run a single test with: `pixi run -e dev test -- tests/test_enumerator.py::test_name`.
90+
91+
## Reporting security issues
92+
93+
Please do not report security vulnerabilities through public GitHub issues. Instead, contact the maintainers directly.
94+
95+
## Code of conduct
96+
97+
Be respectful and constructive. We aim for a welcoming environment for contributors of all backgrounds and experience levels.
98+
99+
## License
100+
101+
By contributing, you agree that your contributions will be licensed under the Apache License 2.0 (see `LICENSE`).

0 commit comments

Comments
 (0)