Thank you for your interest in contributing to flacfetch! This document provides guidelines and instructions for contributing.
- Clone the repository:
git clone https://github.com/nomadkaraoke/flacfetch.git
cd flacfetch- Create a virtual environment and install development dependencies:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -e ".[dev]"- Install git hooks (recommended):
./.githooks/install.shThis installs a pre-commit hook that automatically runs ruff linting and fixes issues before each commit.
- Run tests to verify your setup:
pytest# Run all tests
pytest
# Run with coverage
pytest --cov=flacfetch --cov-report=term-missing
# Run only unit tests (fast)
pytest -m "not integration"
# Run specific test file
pytest tests/test_matching.pyWe use several tools to maintain code quality:
The pre-commit hook automatically runs ruff before each commit:
- Auto-fixes issues when possible (formatting, import sorting, etc.)
- Prevents commits if there are unfixable linting errors
- Install with:
./.githooks/install.sh
# Lint code
ruff check flacfetch/
# Auto-fix linting issues
ruff check --fix flacfetch/
# Type checking
mypy flacfetch/- Create a new branch for your feature or bugfix:
git checkout -b feature/your-feature-name-
Make your changes and add tests
-
Run the test suite:
pytest- Commit your changes with clear commit messages:
git commit -m "Add feature: description of your changes"- Push to your fork and create a pull request
Releases are automated through GitHub Actions. To create a new release:
-
Update the version number in two places:
flacfetch/__init__.py- update__version__pyproject.toml- updateversion
-
Commit the version bump:
git add flacfetch/__init__.py pyproject.toml
git commit -m "Bump version to X.Y.Z"
git push origin main- Create and push a git tag:
git tag -a vX.Y.Z -m "Release version X.Y.Z"
git push origin vX.Y.Z- GitHub Actions will automatically:
- Create a GitHub Release with release notes
- Build the package
- Publish to PyPI (requires PyPI trusted publisher configured)
We follow Semantic Versioning:
- MAJOR version for incompatible API changes
- MINOR version for new functionality in a backwards compatible manner
- PATCH version for backwards compatible bug fixes
To enable automatic PyPI publishing:
- Go to PyPI and create an account
- Go to your PyPI account settings → Publishing → Add a new pending publisher
- Configure:
- PyPI Project Name:
flacfetch - Owner:
nomadkaraoke - Repository name:
flacfetch - Workflow name:
publish.yml - Environment name:
pypi
- PyPI Project Name:
After the first manual release, subsequent releases will be automatic.
- Follow PEP 8 guidelines
- Use type hints where possible
- Write docstrings for public functions and classes
- Keep functions focused and single-purpose
- Add tests for new functionality
- Include tests for new features
- Update documentation as needed
- Keep PRs focused on a single feature or fix
- Write clear commit messages
- Ensure all tests pass
- Update CHANGELOG if significant changes
Feel free to open an issue for questions or discussions about contributing!