Contributing
We welcome contributions to scHopfield! This guide will help you get started.
Ways to Contribute
Report bugs and request features via GitHub Issues
Improve documentation
Add new analysis functions
Contribute example notebooks
Optimize performance
Fix bugs
Getting Started
Development Setup
Fork the repository on GitHub
Clone your fork:
git clone https://github.com/YOUR_USERNAME/scHopfield.git
cd scHopfield
Install in development mode with dev dependencies:
pip install -e ".[dev]"
Create a new branch for your changes:
git checkout -b my-feature-branch
Code Guidelines
Style
Follow PEP 8 style guidelines
Use meaningful variable and function names
Maximum line length: 100 characters
Use type hints where appropriate
We use Black for code formatting:
black scHopfield/
Documentation
All functions must have numpy-style docstrings:
def my_function(adata, param1, param2='default'):
"""
Brief description of function.
Detailed description if needed.
Parameters
----------
adata : AnnData
Annotated data object
param1 : type
Description of param1
param2 : str, optional (default: 'default')
Description of param2
Returns
-------
type or None
Description of return value
"""
pass
Testing
Add tests for new functions:
# tests/test_my_module.py
import pytest
import scHopfield as sch
def test_my_function():
# Test implementation
assert result == expected
Run tests with:
pytest tests/
Pull Request Process
Update Documentation
Add docstrings to new functions
Update user guide if needed
Add to API reference
Add Tests
Write unit tests for new functionality
Ensure all tests pass
Update Changelog
Add entry to
docs/changelog.rst
Submit Pull Request
Push to your fork
Open a pull request to
mainbranchDescribe your changes clearly
Reference any related issues
Code Review
Address reviewer feedback
Update as needed
Commit Messages
Use clear, descriptive commit messages:
Add network centrality computation using igraph
- Implement compute_network_centrality() function
- Add support for multiple centrality metrics
- Include igraph as optional dependency
- Add tests and documentation
Avoid:
fix bug
update code
changes
Code Organization
The package structure:
scHopfield/
├── preprocessing/ # Data preprocessing
├── inference/ # Network inference
├── tools/ # Analysis tools
│ ├── energy.py
│ ├── networks.py
│ ├── jacobian.py
│ └── ...
├── plotting/ # Visualization
├── dynamics/ # ODE simulation
└── _utils/ # Internal utilities
Adding New Features
Analysis Functions
Add function to appropriate module in
tools/Update
tools/__init__.pyto export itAdd docstring with Parameters and Returns
Add to API documentation in
docs/api/tools.rstAdd example to user guide
Plotting Functions
Add function to appropriate module in
plotting/Update
plotting/__init__.pyto export itAdd docstring with complete parameter descriptions
Add to API documentation in
docs/api/plotting.rstFollow existing plotting patterns (return figure/axes)
Reporting Bugs
When reporting bugs, include:
scHopfield version:
import scHopfield as sch print(sch.__version__)
Python version:
python --versionMinimal reproducible example
Error message (full traceback)
Expected behavior
Feature Requests
For feature requests:
Check if similar feature already exists
Describe the use case clearly
Provide example API design if possible
Explain why it would be useful
Questions?
GitHub Issues: https://github.com/Bernaljp/scHopfield/issues
GitHub Discussions: https://github.com/Bernaljp/scHopfield/discussions
Thank you for contributing!