Thank you for your interest in contributing to BrainPy! We welcome contributions from the community and are grateful for your support in making BrainPy better.
- Code of Conduct
- How Can I Contribute?
- Development Setup
- Contribution Workflow
- Coding Guidelines
- Testing
- Documentation
- Community
This project and everyone participating in it is governed by our Code of Conduct. By participating, you are expected to uphold this code. Please report unacceptable behavior to brainpy@foxmail.com.
Before creating bug reports, please check existing issues to avoid duplicates. When creating a bug report, include:
- Clear title and description
- Steps to reproduce the problem
- Expected vs actual behavior
- BrainPy version and environment details (Python version, OS, JAX version)
- Code samples or test cases that demonstrate the issue
- Error messages and stack traces
Submit bug reports via GitHub Issues.
Enhancement suggestions are tracked as GitHub issues. When creating an enhancement suggestion, include:
- Clear use case - explain the problem you're trying to solve
- Proposed solution - describe how you envision the feature working
- Alternative approaches you've considered
- Impact - who would benefit and how
We welcome code contributions! This includes:
- Bug fixes
- New features
- Performance improvements
- Documentation improvements
- Test coverage improvements
- Python 3.10 or higher
- Git
- pip or conda
-
Fork the repository on GitHub
-
Clone your fork locally:
git clone https://github.com/YOUR_USERNAME/BrainPy.git cd BrainPy -
Create a virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install development dependencies:
pip install -e ".[dev,cpu]" # Use [dev,cuda12] for CUDA support
-
Set up pre-commit hooks (if available):
pre-commit install
Create a new branch for your work:
git checkout -b feature/your-feature-name
# or
git checkout -b fix/issue-number-descriptionBranch naming conventions:
feature/- new featuresfix/- bug fixesdocs/- documentation changesrefactor/- code refactoringtest/- test improvements
- Write clean, readable code
- Follow the coding guidelines below
- Add tests for new functionality
- Update documentation as needed
- Keep commits focused and atomic
Run the test suite:
pytest tests/Run specific tests:
pytest tests/test_specific.py -vWrite clear, descriptive commit messages:
git commit -m "Fix issue with delayed connection handling (#123)
- Add validation for delay parameters
- Update tests to cover edge cases
- Fix documentation example
"git push origin feature/your-feature-nameThen create a pull request on GitHub with:
- Clear title describing the change
- Description explaining what and why
- Reference to related issues (e.g., "Fixes #123")
- Test results or screenshots if applicable
- Follow PEP 8 style guide
- Use 2 or 4 spaces for indentation (be consistent with surrounding code)
- Maximum line length: 100-120 characters
- Use descriptive variable and function names
- Keep functions focused and single-purpose
- Use type hints where appropriate
- Add docstrings for public APIs (follow NumPy docstring format)
- Avoid unnecessary complexity
def simulate_network(network, duration, dt=0.1):
"""Simulate a neural network for a specified duration.
Parameters
----------
network : Network
The neural network to simulate
duration : float
Total simulation time in milliseconds
dt : float, optional
Time step in milliseconds (default: 0.1)
Returns
-------
results : dict
Simulation results containing spike times and state variables
Examples
--------
>>> net = Network()
>>> results = simulate_network(net, duration=1000.0)
"""
pass- Place tests in the
tests/directory - Use descriptive test function names:
test_feature_does_what_expected - Test edge cases and error conditions
- Use fixtures for common setups
Aim for high test coverage on new code:
pytest --cov=brainpy tests/- Update relevant documentation when changing features
- Add examples for new functionality
- Keep the API reference up to date
- Fix typos and improve clarity
For comprehensive contribution guidelines, see our detailed documentation.
- Documentation: https://brainpy.readthedocs.io/
- GitHub Discussions: https://github.com/brainpy/BrainPy/discussions
- Issues: https://github.com/brainpy/BrainPy/issues
Contributors are recognized in:
- Release notes
- Contributors file
- Project documentation
Thank you for contributing to BrainPy! Your efforts help make computational neuroscience more accessible and powerful for everyone.