Contributing to changes-roller¶
Thank you for your interest in contributing! This guide will help you get started.
Table of Contents¶
Code of Conduct¶
This project follows the Contributor Covenant Code of Conduct. By participating, you are expected to uphold this code.
Quick Start¶
# 1. Fork and clone
git clone https://github.com/YOUR-USERNAME/changes-roller.git
cd changes-roller
# 2. Set up environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -e ".[dev,test,docs]"
# 3. Install pre-commit hooks
pre-commit install
pre-commit install --hook-type commit-msg
# 4. Create a branch and make changes
git checkout -b feature/my-feature
# 5. Run tests
pytest
# 6. Commit (pre-commit hooks run automatically)
git add .
git commit -m "feat: description of changes"
# 7. Push and create PR
git push origin feature/my-feature
Development Setup¶
Prerequisites¶
Python 3.10 or higher
Git command-line client
pip package manager
Initial Setup¶
# Clone your fork
git clone https://github.com/YOUR-USERNAME/changes-roller.git
cd changes-roller
# Create and activate virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install in development mode with all dependencies
pip install -e ".[dev,test,docs]"
# Install pre-commit hooks
pre-commit install
pre-commit install --hook-type commit-msg
Verify Installation¶
# Run the CLI
roller --help
# Run tests
pytest
# Verify pre-commit hooks
pre-commit run --all-files
Code Quality¶
This project uses automated tools to maintain code quality.
Tools¶
Ruff - Linting and formatting
MyPy - Strict type checking
Bandit - Security scanning
Pytest - Testing
Pre-commit Hooks¶
Pre-commit hooks run automatically before each commit to:
Format code (Ruff)
Lint code (Ruff)
Type check (MyPy)
Security scan (Bandit)
Validate files (YAML, TOML, whitespace, etc.)
Enforce conventional commit messages
Usage:
# Hooks run automatically on commit
git commit -m "feat: add new feature"
# Run manually on all files
pre-commit run --all-files
# Run specific hook
pre-commit run ruff
# Skip hooks (not recommended)
git commit --no-verify
If hooks modify files:
Pre-commit auto-fixes issues (formatting, whitespace)
Review the changes:
git diffStage the fixes:
git add .Commit again:
git commit -m "feat: add new feature"
Commit Message Format¶
This project uses Conventional Commits.
Format:
<type>(<optional scope>): <description>
[optional body]
[optional footer]
Types:
feat:- New feature (MINOR version bump)fix:- Bug fix (PATCH version bump)docs:- Documentation changesstyle:- Code style changes (formatting)refactor:- Code refactoringtest:- Adding or updating testschore:- Maintenance tasksperf:- Performance improvementsci:- CI/CD changes
Examples:
git commit -m "feat: add support for custom git branches"
git commit -m "fix: handle edge case in path resolution"
git commit -m "docs: update installation instructions"
Breaking changes:
git commit -m "feat!: redesign CLI interface
BREAKING CHANGE: The --output flag has been renamed to --destination"
Code Style Guidelines¶
Follow PEP 8 (enforced by Ruff)
Maximum line length: 88 characters
Use type hints for all function signatures
Write docstrings for public modules, classes, and functions
Keep functions focused and small
Manual Quality Checks¶
# Format code
ruff format .
# Lint code
ruff check .
ruff check --fix . # Auto-fix issues
# Type check
mypy roller/
# Security scan
bandit -c pyproject.toml -r roller/
# Run all checks
pre-commit run --all-files
Testing¶
All code changes must include appropriate tests.
Running Tests¶
# Run all tests
pytest
# Run with coverage
pytest --cov=roller --cov-report=term-missing
# Run only unit tests
pytest -m unit
# Run only integration tests
pytest -m integration
# Run specific test file
pytest tests/test_cli.py
# Run with verbose output
pytest -v
# Run specific test
pytest tests/test_cli.py::test_init_command
Writing Tests¶
Place tests in
tests/directoryName test files
test_*.pyName test functions
test_*Use fixtures from
conftest.pyMock external dependencies (git commands, file operations)
Aim for high code coverage
Test Organization¶
Unit tests: Test individual functions and classes in isolation
Integration tests: Test multiple components working together
Use markers:
@pytest.mark.unitor@pytest.mark.integration
Requirements¶
All new features must include tests
Bug fixes should include regression tests
Tests must pass before submitting a PR
Maintain or improve code coverage
Documentation¶
We use Sphinx to generate documentation hosted on ReadTheDocs.
Building Documentation Locally¶
# Install documentation dependencies
pip install -e ".[docs]"
# Build HTML documentation
cd docs
sphinx-build -b html . _build/html
# View documentation
# Open docs/_build/html/index.html in your browser
# Serve with live reload (optional)
python -m http.server --directory _build/html 8000
# Then open http://localhost:8000
# Clean build artifacts
make clean # or rm -rf _build
Documentation Guidelines¶
Use Markdown (
.md) for most pagesFollow existing structure and style
Include code examples where appropriate
Update docs when adding features or changing behavior
Preview docs locally before submitting
ReadTheDocs Integration¶
Documentation builds automatically on every commit to main
PR previews are available for documentation changes
View live docs at: https://changes-roller.readthedocs.io
Submitting Changes¶
Before Submitting¶
Ensure tests pass:
pytestRun quality checks:
pre-commit run --all-filesUpdate documentation if needed
Use conventional commit messages
Pull Request Process¶
Create a feature branch from
main:git checkout -b feature/your-feature-name
Make your changes following the code standards
Commit with conventional commits:
git add . git commit -m "feat: description of changes" # Pre-commit hooks run automatically
Push to your fork:
git push origin feature/your-feature-name
Open a Pull Request on GitHub:
Provide a clear title and description
Reference any related issues
Explain what changed and why
Include testing instructions if applicable
Pull Request Guidelines¶
Keep PRs focused on a single feature or fix
Write clear commit messages
Update tests and documentation
Respond to review feedback promptly
Ensure CI checks pass
Continuous Integration¶
All PRs automatically run:
Code Quality (~2 min):
Ruff formatting and linting
File validation (YAML, TOML, whitespace)
Prettier (Markdown, JSON)
Type Checking (~2 min):
MyPy strict type checking
Tests (~5-10 min):
Tests on Python 3.10, 3.11, 3.12, 3.13
Tests on Linux, macOS, Windows
Coverage reporting (Codecov)
Security (~2 min):
Bandit code security scan
pip-audit dependency vulnerabilities
Dependency Review for PRs
All checks must pass before merging.
If CI fails:
Click “Details” next to the failed check to view logs
Fix issues locally:
pre-commit run --all-filesandpytestPush fixes to your branch (CI will re-run automatically)
Issue Reporting¶
Creating Issues¶
Use the appropriate issue template:
Bug Report - Report bugs or unexpected behavior
Feature Request - Suggest new features or enhancements
Documentation - Suggest documentation improvements
Before Creating an Issue¶
Search existing issues to avoid duplicates
Check if issue is fixed in the latest version
Gather relevant information (version, platform, error messages)
Bug Reports Should Include¶
Clear description of the problem
Steps to reproduce
Expected vs actual behavior
Environment details (Python version, OS, changes-roller version)
Error messages and stack traces
Configuration files (if relevant)
Feature Requests Should Include¶
Clear description of desired functionality
Use cases and motivation
Proposed implementation approach
Impact on your workflow
Willingness to contribute
Questions and Discussions¶
For usage questions:
Check README and documentation first
Search closed issues for similar questions
Open a GitHub Discussion
For security issues, see SECURITY.md
For Maintainers¶
This project has automated versioning and releases.
For maintainers, see:
RELEASING.md - Version bumping and release process
.github/workflows/README.md - CI/CD pipeline details
Quick summary:
PRs are merged to main with conventional commit messages
When ready to release, run
cz bumpto calculate version and update filesPush the version tag:
git push --tagsGitHub Actions automatically builds and publishes to PyPI
GitHub Release is created automatically with release notes
For detailed instructions, see RELEASING.md.
Thank you for contributing to changes-roller!