Thanks for taking the time to contribute. The goal of this guide is to make it easy for you to get started, whether you are reporting a bug, improving the documentation, or proposing new features.
Participation in the BrainState community is governed by our CODE_OF_CONDUCT.md. By contributing you agree to uphold those standards.
- Report bugs or request features through https://github.com/chaobrain/brainstate/issues.
- Improve documentation, tutorials, and examples.
- Share benchmarks or reproducible research artefacts that highlight how BrainState is used.
- Review pull requests and help triage incoming issues.
If you are unsure about the best way to help, feel free to start a discussion in an issue outlining your idea.
- Fork the repository and clone your fork:
git clone https://github.com/<your-user>/brainstate.git cd brainstate
- Create and activate a virtual environment:
python -m venv .venv # Windows .venv\Scripts\activate # macOS/Linux source .venv/bin/activate
- Upgrade pip tooling and install the project in editable mode with the test dependencies:
python -m pip install -U pip setuptools wheel pip install -e ".[testing]" - (Optional) Install documentation requirements if you plan to build the docs:
pip install -r requirements-doc.txt
- Install pre-commit to run the project linters automatically:
Run
pip install pre-commit pre-commit install
pre-commit run --all-filesbefore pushing to ensure your changes satisfy the configured checks. - Python code should follow the standards enforced by
flake8and the rest of the tooling in.pre-commit-config.yaml. - Keep imports tidy and prefer explicit typing when it clarifies intent.
Run the full test suite with:
pytestAdd or update tests whenever you fix a bug or add functionality. Tests should pass before you submit a pull request.
- Include a clear description of the change and the motivation behind it.
- Reference the related issue when applicable (e.g. "Closes #123").
- Update or add documentation and examples when behaviour changes.
- Update
changelog.mdwhen the change impacts users. - Ensure
pre-commit run --all-filesandpytestsucceed locally. - Keep each pull request focused; large refactors should be discussed in advance.
Documentation lives in the docs/ directory and is built with Sphinx. After installing the documentation requirements you can build the HTML site locally with:
sphinx-build -b html docs docs/_build/htmlOpen docs/_build/html/index.html in your browser to review the result.
If you have questions or want early feedback on substantial changes, open a draft pull request or start a discussion on the issue tracker. We are happy to help you land your contribution.