Contributing¶
Any and all contributions and involvement with the project is welcome. The easiest way to begin contributing is to check out the open issues on GitHub.
Documentation¶
The documentation is built using mkdocs. All documentation is in markdown format, and can be found in ./docs/
To preview documentation locally:
mkdocs serve
Then visit http://127.0.0.1:8000 in your browser.
Contributing Code¶
Step 1: Prerequisites¶
fastapi-tasks uses uv for dependency management.
Please install uv before continuing.
Minimum supported Python version is 3.10.
Step 2: Clone the Repository¶
git clone https://github.com/uriyyo/fastapi-tasks
cd fastapi-tasks
Step 3: Install Dependencies¶
To install all dependencies, run:
uv sync --dev
To install docs requirements, run:
uv pip install -r docs_requirements.txt
Step 4: Make Your Changes¶
If you want to add a new feature, please create an issue first and describe your idea.
For bug fixes, please include: - A description of the bug - Steps to reproduce - Expected behavior - Actual behavior
Step 5: Run Pre-commit Hooks¶
Before creating a commit, run pre-commit hooks:
uv run pre-commit run --all-files
You can also install pre-commit hooks to run automatically before each commit:
uv run pre-commit install
Step 6: Run Tests¶
To run tests:
uv run pytest tests
To run tests with coverage:
uv run pytest tests --cov=fastapi_tasks
Step 7: Update Documentation¶
If you added new features or changed behavior:
- Update relevant documentation in
docs/ - Add examples if appropriate
- Preview changes with
mkdocs serve
Step 8: Create a Pull Request¶
After you have done all changes, create a pull request:
- Push your changes to a fork
- Open a pull request against the
mainbranch - Describe your changes
- Link any related issues
- Wait for review
Code Style¶
We use: - Black for code formatting - isort for import sorting - mypy for type checking - ruff for linting
Pre-commit hooks will enforce these automatically.
Writing Tests¶
All new features should include tests:
import pytest
from fastapi import FastAPI
from httpx import AsyncClient
from fastapi_tasks import Tasks, add_tasks
pytestmark = pytest.mark.asyncio
async def test_my_feature(app: FastAPI, client: AsyncClient) -> None:
"""Test description"""
# Define task
async def my_task() -> None:
pass
# Define endpoint
@app.post("/test")
async def test_endpoint(tasks: Tasks) -> dict:
tasks.schedule(my_task)
return {"status": "ok"}
# Make request
response = await client.post("/test")
# Assert
assert response.status_code == 200
assert response.json() == {"status": "ok"}
Documentation Standards¶
When writing documentation:
- Be clear and concise - Short sentences, simple words
- Provide examples - Show code, not just descriptions
- Use proper formatting - Code blocks, tables, lists
- Add warnings/tips - Use admonitions for important info
- Link related pages - Help users navigate
- Test your examples - Make sure code actually works
Example documentation structure:
# Feature Name
Brief description of the feature.
## Basic Usage
```python
# Simple example
from fastapi_tasks import Tasks
tasks.schedule(my_function)
Advanced Usage¶
More complex examples...
Reporting Bugs¶
If you find a bug:
- Check if it's already reported in GitHub Issues
- If not, create a new issue with:
- Python version
fastapi-tasksversion- Minimal code to reproduce
- Expected vs actual behavior
- Full error traceback
Feature Requests¶
For feature requests:
- Open an issue describing the feature
- Explain the use case
- Provide examples if possible
- Discuss before implementing
Questions?¶
If you have questions:
- Check the FAQ
- Read the documentation
- Ask in GitHub Discussions
Thank you for contributing! 🎉