|
| 1 | +# Contributing to reproschema-protocol-cookiecutter |
| 2 | + |
| 3 | +Thank you for your interest in contributing to the ReproSchema Protocol Cookiecutter! This document provides guidelines and instructions for contributing. |
| 4 | + |
| 5 | +## Getting Started |
| 6 | + |
| 7 | +1. Fork the repository |
| 8 | +2. Clone your fork: `git clone https://github.com/YOUR-USERNAME/reproschema-protocol-cookiecutter.git` |
| 9 | +3. Create a new branch: `git checkout -b feature/your-feature-name` |
| 10 | +4. Make your changes |
| 11 | +5. Test your changes (see Testing section) |
| 12 | +6. Commit your changes using conventional commits |
| 13 | +7. Push to your fork and submit a pull request |
| 14 | + |
| 15 | +## Development Setup |
| 16 | + |
| 17 | +### Prerequisites |
| 18 | + |
| 19 | +- Python 3.8+ |
| 20 | +- Node.js 20+ (for testing GitHub Pages deployment) |
| 21 | +- Git |
| 22 | + |
| 23 | +### Installing Dependencies |
| 24 | + |
| 25 | +```bash |
| 26 | +pip install -r requirements.txt |
| 27 | +``` |
| 28 | + |
| 29 | +### Pre-commit Hooks |
| 30 | + |
| 31 | +We use pre-commit hooks to ensure code quality: |
| 32 | + |
| 33 | +```bash |
| 34 | +pre-commit install |
| 35 | +``` |
| 36 | + |
| 37 | +## Testing |
| 38 | + |
| 39 | +### Running Tests Locally |
| 40 | + |
| 41 | +```bash |
| 42 | +# Test the cookiecutter template generation |
| 43 | +python test_cookiecutter.py |
| 44 | + |
| 45 | +# Or use the micromamba environment |
| 46 | +./run_in_env.sh python test_cookiecutter.py |
| 47 | +``` |
| 48 | + |
| 49 | +### Testing Your Changes |
| 50 | + |
| 51 | +1. Generate a test protocol: |
| 52 | + ```bash |
| 53 | + cookiecutter . --no-input -o test-output |
| 54 | + ``` |
| 55 | + |
| 56 | +2. Validate the generated schemas: |
| 57 | + ```bash |
| 58 | + cd test-output/my-reproschema-protocol |
| 59 | + reproschema validate my_reproschema_protocol/my_reproschema_protocol_schema |
| 60 | + ``` |
| 61 | + |
| 62 | +## Code Style |
| 63 | + |
| 64 | +- Python code follows PEP 8 |
| 65 | +- Use meaningful variable and function names |
| 66 | +- Add docstrings to functions |
| 67 | +- Keep functions focused and small |
| 68 | + |
| 69 | +## Commit Messages |
| 70 | + |
| 71 | +We follow the [Conventional Commits](https://www.conventionalcommits.org/) specification: |
| 72 | + |
| 73 | +- `feat:` New features |
| 74 | +- `fix:` Bug fixes |
| 75 | +- `docs:` Documentation changes |
| 76 | +- `chore:` Maintenance tasks |
| 77 | +- `test:` Test additions or modifications |
| 78 | + |
| 79 | +Example: |
| 80 | +``` |
| 81 | +feat: add support for custom activity types |
| 82 | +
|
| 83 | +- Allow users to define custom activity schemas |
| 84 | +- Update documentation with examples |
| 85 | +- Add tests for custom activities |
| 86 | +``` |
| 87 | + |
| 88 | +## Pull Request Process |
| 89 | + |
| 90 | +1. Ensure all tests pass |
| 91 | +2. Update documentation if needed |
| 92 | +3. Update CHANGELOG.md with your changes under "Unreleased" |
| 93 | +4. Fill out the PR template completely |
| 94 | +5. Request review from maintainers |
| 95 | + |
| 96 | +## Release Process |
| 97 | + |
| 98 | +Releases are managed by maintainers using the GitHub Actions release workflow: |
| 99 | + |
| 100 | +### Creating a Release |
| 101 | + |
| 102 | +1. Go to Actions → Release workflow |
| 103 | +2. Click "Run workflow" |
| 104 | +3. Enter the new version (e.g., 1.0.1) |
| 105 | +4. Select release type (patch/minor/major) |
| 106 | +5. The workflow will: |
| 107 | + - Update version in pyproject.toml and cookiecutter.json |
| 108 | + - Create a git tag |
| 109 | + - Generate release notes |
| 110 | + - Create a GitHub release |
| 111 | + |
| 112 | +### Version Guidelines |
| 113 | + |
| 114 | +- **Major** (X.0.0): Breaking changes to template structure or output |
| 115 | +- **Minor** (1.X.0): New features, activities, or capabilities |
| 116 | +- **Patch** (1.0.X): Bug fixes, documentation updates |
| 117 | + |
| 118 | +### Post-Release |
| 119 | + |
| 120 | +After a release, update CHANGELOG.md: |
| 121 | +1. Move items from "Unreleased" to the new version section |
| 122 | +2. Add comparison link at the bottom |
| 123 | + |
| 124 | +## Schema Updates |
| 125 | + |
| 126 | +When updating ReproSchema versions or structures: |
| 127 | + |
| 128 | +1. Use `update_schema_version.py` to update all schemas consistently |
| 129 | +2. Test that all schemas validate with the new version |
| 130 | +3. Update documentation to reflect changes |
| 131 | + |
| 132 | +## Adding New Activities |
| 133 | + |
| 134 | +To add a new activity type: |
| 135 | + |
| 136 | +1. Create the activity folder in `{{cookiecutter.protocol_name}}/activities/` |
| 137 | +2. Add the activity schema and item schemas |
| 138 | +3. Update `hooks/pre_gen_project.py` to include the new activity option |
| 139 | +4. Add tests for the new activity |
| 140 | +5. Update documentation |
| 141 | + |
| 142 | +## Questions? |
| 143 | + |
| 144 | +Feel free to: |
| 145 | +- Open an issue for bugs or feature requests |
| 146 | +- Start a discussion for questions |
| 147 | +- Join the ReproNim community channels |
| 148 | + |
| 149 | +Thank you for contributing! |
0 commit comments