Welcome Contributors!
Thank you for considering contributing to FKApi! This guide will help you get started with development and explain our contribution process.Prerequisites
Before you begin, ensure you have the following installed:- Python 3.10+: Download Python
- PostgreSQL 12+: Download PostgreSQL (or SQLite for development)
- Redis 6+: Download Redis (optional for caching)
- Git: Download Git
Development Setup
1. Fork and Clone
2. Create Virtual Environment
3. Install Dependencies
4. Configure Environment
Create a.env file in the project root:
5. Set Up Database
6. Install Pre-commit Hooks
7. Verify Installation
Project Structure
Development Workflow
Creating a Branch
Making Changes
- Write Code: Make your changes following our code style guidelines
- Write Tests: Add tests for new functionality in
fkapi/core/tests/ - Run Tests: Ensure all tests pass (
pytest) - Check Code Quality: Run linting (
ruff check .) - Update Documentation: Update relevant docs if needed
Running Tests Locally
Code Quality Checks
Committing Changes
- Use present tense (“Add feature” not “Added feature”)
- Be descriptive but concise
- Reference issue numbers when applicable (#123)
- Examples:
Add bulk kits endpoint for multiple kit retrievalFix cache invalidation for club updatesUpdate API documentation for user collection endpoint
Pull Request Process
1. Push Your Changes
2. Create Pull Request
- Go to the FKApi repository
- Click “New Pull Request”
- Select your fork and branch
- Fill out the PR template:
3. Code Review
- Respond to feedback from maintainers
- Make requested changes by pushing new commits
- Keep the conversation constructive and respectful
4. After Approval
- Maintainers will merge your PR
- You can delete your feature branch
- Update your fork’s main branch
Common Development Tasks
Adding a New API Endpoint
- Add endpoint in
fkapi/fkapi/api.py:
- Add tests in
fkapi/core/tests/test_api.py - Update API documentation
Adding a New Model
- Define model in
fkapi/core/models.py - Create migration:
python manage.py makemigrations - Run migration:
python manage.py migrate - Add to admin:
fkapi/core/admin.py - Add tests:
fkapi/core/tests/test_models.py
Adding Cache Invalidation
- Add signal handler in
fkapi/core/cache_utils.py - Connect signal in model or apps.py
- Test cache invalidation works correctly
Creating Management Commands
- Create file in
fkapi/core/management/commands/ - Inherit from
BaseCommand - Implement
handle()method - Add tests
What to Contribute
Good First Issues
- Bug fixes
- Documentation improvements
- Test coverage improvements
- Code quality improvements
Feature Contributions
- New API endpoints
- Enhanced search/filtering
- Performance optimizations
- New management commands
Not Accepting
- Breaking changes without discussion
- Changes to scraping logic that violate robots.txt
- Features that significantly increase complexity
Getting Help
- Questions: Open a GitHub Discussion
- Bugs: Open an issue with detailed reproduction steps
- Features: Open an issue to discuss before implementing
- Documentation: Check the
/docsdirectory - Code Review: Review existing PRs to learn patterns
Code of Conduct
- Be respectful and inclusive
- Provide constructive feedback
- Focus on the code, not the person
- Follow open source best practices
Additional Resources
Thank you for contributing to FKApi! Your contributions help make this project better for everyone.