ChemPy is a free, open-source Python toolkit for chemistry, chemical engineering, and materials science applications.
- π Documentation - Full documentation and API reference
- π Issue Tracker - Report bugs and request features
- π Contributing - How to contribute to ChemPy
- π Changelog - Version history and release notes
- π Security - Security policy and vulnerability reporting
- π§ TODO - Future improvements and known issues
- π¨βπ» Developer Docs - Development guides and technical documentation
- Python 3.13 support: Updated and tested on latest Python.
- Open Babel 3.x integration: Modern molecular format handling.
- Type hints (PEP 561): Full type annotation coverage with
py.typed. - Test suite: All tests passing; legacy and modern suites maintained.
- Code quality:
black,isort,flake8, and mypy checks. - GitHub Actions CI/CD: Automated linting and testing across Python 3.8β3.13.
- NumPy compatibility: Addressed array-to-scalar deprecations.
- Modern packaging: PEP 517/518 with
pyproject.toml.
Windows: Experimental. Unit tests are not run on Windows in CI due to persistent failures and lack of a Windows development environment. Use at your own risk.
If you are able to help improve Windows compatibility, contributions and fixes are very welcome!
macOS and Linux: Fully supported and tested in CI.
Note: Features such as SMILES parsing and certain rotor-counting utilities depend on Open Babel. On macOS/Linux, install openbabel-wheel to enable these features. Windows support for Open Babel is currently experimental.
Install via pip:
pip install chempyOr install from source with development dependencies:
git clone https://github.com/elkins/ChemPy.git
cd ChemPy
pip install -e ".[dev]"
make build# Install with all development tools
pip install -e ".[dev,docs]"
# Install pre-commit hooks for automatic quality checks
pre-commit install
# Build Cython extensions for performance
make build# Run all tests
make test
# Run with coverage report
make test-cov
# Run tests in parallel
make test-fast
# Run specific test file
pytest unittest/moleculeTest.py -vChemPy includes a small benchmark suite using pytest-benchmark to track performance of key hot-paths (SMILES parsing, rotor counting, density-of-states ILT, etc.).
Run locally:
pytest unittest/benchmarksTest.py --benchmark-onlyCompare two runs (e.g., branch vs. main):
# On main
pytest unittest/benchmarksTest.py --benchmark-only --benchmark-save=main
# On your branch
pytest unittest/benchmarksTest.py --benchmark-only --benchmark-save=feature
# Compare
pytest unittest/benchmarksTest.py --benchmark-only --benchmark-compareCI runs a quick benchmark job on Ubuntu/Python 3.12 and uploads JSON results as an artifact for trend tracking.
Latest CI benchmark artifacts (master):
Open the most recent run, then download the artifact named benchmark-results-<OS>-py312.
# Format code automatically
make format
# Check code style
make lint
# Type checking
make type-check
# All quality checks
make checkmake docs
cd documentation
open build/html/index.htmlchempy/
βββ constants.py # Physical constants (SI units)
βββ element.py # Element properties and data
βββ molecule.py # Molecular structure representation
βββ reaction.py # Chemical reactions
βββ kinetics.py # Reaction kinetics modeling
βββ thermo.py # Thermodynamic calculations
βββ species.py # Chemical species definitions
βββ geometry.py # Geometric calculations
βββ graph.py # Graph-based molecular analysis
βββ pattern.py # Pattern matching for molecules
βββ states.py # Physical/chemical state variables
βββ py.typed # PEP 561 type hint marker
βββ ext/ # Extensions
βββ molecule_draw.py # Molecular visualization
βββ thermo_converter.py # Thermodynamics converters
tests/ # Modern test directory
unittest/ # Legacy test suite
docs/ # Documentation
documentation/ # Sphinx documentation source
The Sphinx docs homepage includes a Codecov badge; see documentation/build/html/index.html after building.
The contents page also shows the badge for quick visibility.
- Purpose: Run lint (
flake8) and tests (pytest) without pushing. - Trigger: Go to
Actionsβ selectLint & TestβRun workflow. - Branch: Choose a branch and optionally a specific commit SHA.
- Outputs: See job logs; test results appear inline in the workflow run.
If you use ChemPy in your research, please cite:
@software{chempy2024,
title={ChemPy: A Chemistry Toolkit for Python},
author={Allen, Joshua W.},
year={2024},
url={https://github.com/elkins/ChemPy}
}See the Developer Documentation for detailed troubleshooting, including:
- Coverage uploads and Codecov configuration
- Type checking with mypy
- Lint and formatting tools
- CI debugging
ChemPy is licensed under the MIT License - see LICENSE for details.
- RMG - Reaction Mechanism Generator
- Cantera - Chemical kinetics and thermodynamics
- OpenBabel - Molecular structures and formats
- GAMESS - Quantum chemistry
For questions and discussions:
- Open an issue
- Read the documentation
- Browse existing issues or propose enhancements via the Issue Tracker
ChemPy was originally developed by Joshua W. Allen and is maintained by the open-source community.
Made with β€οΈ for the chemistry community