Skip to main content

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:

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

This will automatically run code quality checks before each commit.

7. Verify Installation

Project Structure

Development Workflow

Creating a Branch

Making Changes

  1. Write Code: Make your changes following our code style guidelines
  2. Write Tests: Add tests for new functionality in fkapi/core/tests/
  3. Run Tests: Ensure all tests pass (pytest)
  4. Check Code Quality: Run linting (ruff check .)
  5. Update Documentation: Update relevant docs if needed

Running Tests Locally

Code Quality Checks

These checks will also run automatically via pre-commit hooks.

Committing Changes

Commit Message Guidelines:
  • 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 retrieval
    • Fix cache invalidation for club updates
    • Update API documentation for user collection endpoint

Pull Request Process

1. Push Your Changes

2. Create Pull Request

  1. Go to the FKApi repository
  2. Click “New Pull Request”
  3. Select your fork and branch
  4. 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

  1. Add endpoint in fkapi/fkapi/api.py:
  1. Add tests in fkapi/core/tests/test_api.py
  2. Update API documentation

Adding a New Model

  1. Define model in fkapi/core/models.py
  2. Create migration: python manage.py makemigrations
  3. Run migration: python manage.py migrate
  4. Add to admin: fkapi/core/admin.py
  5. Add tests: fkapi/core/tests/test_models.py

Adding Cache Invalidation

  1. Add signal handler in fkapi/core/cache_utils.py
  2. Connect signal in model or apps.py
  3. Test cache invalidation works correctly

Creating Management Commands

  1. Create file in fkapi/core/management/commands/
  2. Inherit from BaseCommand
  3. Implement handle() method
  4. 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 /docs directory
  • 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.