Contributing to FastAPI-MCP
First off, thank you for considering contributing to FastAPI-MCP!
Development Setup
- Make sure you have Python 3.10+ installed.
- Install uv, our recommended package manager.
- Fork the repository on GitHub.
-
Clone your fork locally:
git clone https://github.com/YOUR-USERNAME/fastapi_mcp.git cd fastapi-mcp # Add the original repository as the upstream remote git remote add upstream https://github.com/tadata-org/fastapi_mcp.git
-
Set up the development environment:
uv sync
This command automatically creates a virtual environment and installs all required dependencies from
uv.lock
. -
Install pre-commit hooks:
uv run pre-commit install uv run pre-commit run --all-files
Pre-commit hooks will automatically run checks (like ruff for formatting and linting) when you make a commit, ensuring your code adheres to our style guidelines.
Running Commands
You can run commands either by activating the virtual environment first or by using uv run
.
1. With the virtual environment activated:
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# Then run commands directly
pytest
mypy .
ruff check .
2. Without activating the virtual environment:
# Use the 'uv run' prefix
uv run pytest
uv run mypy .
uv run ruff check .
Development Process
- Create a feature branch from the
main
branch (git checkout -b feature/my-new-feature
). - Make your changes and add tests for them.
- Ensure all checks and tests pass:
- Run type checking:
uv run mypy .
- Run the tests:
uv run pytest
- Ensure code is formatted:
uv run ruff format .
anduv run ruff check .
(pre-commit hooks will handle this automatically).
- Run type checking:
- Commit your changes with a descriptive message (
git commit -m 'feat: Add some amazing feature'
). - Push your branch to your fork (
git push origin feature/my-new-feature
). - Open a Pull Request against the
main
branch of the originaltadata-org/fastapi_mcp
repository.
Code Style
We use the following tools to ensure code quality:
- Ruff: For both linting and formatting.
- MyPy: For static type checking.
Please ensure your code passes all checks before submitting a pull request.
# Check code formatting and style
ruff check .
ruff format .
# Check types
mypy .
Testing
We use pytest
for testing. Please write tests for any new features and ensure all existing tests pass.
# Run all tests
pytest
Pull Request Process
- Ensure your code follows the style guidelines.
- Update documentation (
README.md
, docstrings, etc.) if your changes affect it. - Make sure your pull request has a clear title and description.
- Your pull request will be reviewed and merged once it's approved.
Thank you for your contribution!