Contribute
Guidelines for contributing to SpinalfMRIprep development.
Getting Started
Development Setup
# Clone the repository
git clone https://github.com/SpinalfMRIprep/SpinalfMRIprep.git
cd SpinalfMRIprep
# Install in development mode
pip install poetry
poetry install
# Install pre-commit hooks
poetry run pre-commit install
Run Tests
# Run all tests
poetry run pytest
# Run specific test file
poetry run pytest tests/test_S1_input_verify.py
# Run with coverage
poetry run pytest --cov=spinalfmriprep
Development Workflow
Branch Naming
| Type | Format | Example |
|---|---|---|
| Feature | feat/short-description | feat/add-motion-correction |
| Bug fix | fix/short-description | fix/segmentation-crash |
| Docs | docs/short-description | docs/update-tutorial |
Commit Messages
Follow Conventional Commits:
feat: add slice-timing correction to S4
fix: handle missing JSON sidecar gracefully
docs: expand S1 method specification
test: add integration test for multi-session
Pull Request Process
- Create a feature branch from
main - Make your changes with tests
- Run
poetry run pytestto ensure tests pass - Run
poetry run pre-commit run --all-files - Open a PR with clear description
- Address review feedback
- Squash and merge when approved
Code Style
Python
- Follow PEP 8
- Use type hints
- Docstrings in Google style
- Maximum line length: 100 characters
Pre-commit Hooks
The repository uses pre-commit for automated checks:
ruff- Linting and formattingmypy- Type checkingpytest- Test execution
Adding a New Step
To add a new processing step (e.g., S12):
-
Create the module:
src/spinalfmriprep/S12_new_step.py -
Implement required functions:
-
Add CLI integration: Update
src/spinalfmriprep/cli.py -
Add tests: Create
tests/test_S12_new_step.py -
Add documentation: Create
docs/methods/S12_new_step.md -
Update navigation: Add to
mkdocs.yml
Reporting Issues
Bug Reports
Please include:
- SpinalfMRIprep version (
poetry run spinalfmriprep --version) - Operating system
- Container runtime and version
- Minimal reproducible example
- Full error traceback
Feature Requests
Open a GitHub issue with:
- Use case description
- Proposed solution
- Alternatives considered
Contact
- GitHub Issues: SpinalfMRIprep/SpinalfMRIprep
- Discussions: Use GitHub Discussions for questions
Thank you for contributing to SpinalfMRIprep!