Thank you for contributing to cpm. This guide explains how to set up your environment, make changes, and submit a pull request.
- Python
>=3.12 pipgit
- Fork the repository and clone your fork.
- Create and activate a virtual environment.
- Install the package in editable mode:
pip install -e .- (Optional, for docs work) Install docs dependencies:
pip install -r docs/requirements.txt- Create a branch from
main. - Make focused changes with clear commit history. See commit message conventions below.
- Run tests locally before opening a pull request.
- Update documentation and changelog when relevant.
- Open a Pull Request on GitHub.
- Fork the repository.
- (optional) Create a branch from
main. - Make focused changes with clear commit history. See commit message conventions below.
- Run tests locally before opening a pull request.
- Update documentation and changelog when relevant.
- Open a Pull Request on GitHub.
Start your branch name with one of:
feature/for adding, refactoring, or removing a featurebugfix/for fixing a bughotfix/for urgent, temporary, or process-exception changestest/for experiments and test-related workdocs/for adding documentation or examples.
Example:
feature/add-hierarchical-export
- Format Python code with Black.
- Keep code readable and focused; avoid unrelated refactors in the same PR.
- Use NumPy-style docstrings where applicable.
- Keep public API changes backward-compatible where possible.
Run the test suite from the repository root:
pytestIf you changed specific functionality, also run targeted tests first (for example, under test/models/ or test/optimisation/).
Documentation lives in docstrings and Markdown files under docs/.
For local docs preview:
mkdocs build
mkdocs serveThen open http://127.0.0.1:8000/.
Please follow Conventional Commits.
Examples:
feat(models): add drift-bias parameterfix(optimisation): handle empty boundsdocs(api): clarify hierarchical fitting inputs
When opening a PR:
- Keep the PR scope small and focused.
- Include a clear description of what changed and why.
- Link related issues.
- Add/update tests for behavior changes.
- Update docs when user-facing behavior changes.
Before requesting review, verify:
- Tests pass locally.
- Docs build if docs were changed.
- No unrelated files are included.
If you run into issues at any point, please reach out. We are happy to help with anything.
For faster support, please include:
- What you were trying to do
- The exact error message or traceback
- Your Python version and operating system
- Steps to reproduce the issue
Best ways to get help:
- Open a GitHub issue for bugs, setup problems, or unclear behavior
- Open a draft PR if you want feedback while you are still working
- Ask your question directly in the PR conversation if it is related to your change
If you are preparing a release artifact:
python setup.py sdist bdist_wheelPublishing to PyPI is maintainer-only and typically done with:
twine upload dist/*If you run into issues at any point, please reach out. We are happy to help with anything.
For faster support, please include:
- What you were trying to do
- The exact error message or traceback
- Your Python version and operating system
- Steps to reproduce the issue
Best ways to get help:
- Open a GitHub issue for bugs, setup problems, or unclear behavior
- Open a draft PR if you want feedback while you are still working
- Ask your question directly in the PR conversation if it is related to your change