3.9 KiB
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 package manager
-
Fork the repository
-
Clone your fork
git clone https://github.com/YOUR-USERNAME/fastapi_mcp.git cd fastapi-mcp # Add the upstream remote git remote add upstream https://github.com/tadata-org/fastapi_mcp.git -
Set up the development environment:
uv syncThat's it! The
uv synccommand will automatically create and use a virtual environment. -
Install pre-commit hooks:
uv run pre-commit install uv run pre-commit runPre-commit hooks will automatically run checks (like ruff, formatting, etc.) when you make a commit, ensuring your code follows our style guidelines.
Running Commands
You have two options for running commands:
-
With the virtual environment activated:
source .venv/bin/activate # On Windows: .venv\Scripts\activate # Then run commands directly pytest mypy . ruff check . -
Without activating the virtual environment:
# Use uv run prefix for all commands uv run pytest uv run mypy . uv run ruff check .
Both approaches work - use whichever is more convenient for you.
Note: For simplicity, commands in this guide are mostly written without the
uv runprefix. If you haven't activated your virtual environment, remember to prependuv runto all python-related commands and tools.
Adding Dependencies
When adding new dependencies to the library:
-
Runtime dependencies - packages needed to run the application:
uv add new-package -
Development dependencies - packages needed for development, testing, or CI:
uv add --group dev new-package
After adding dependencies, make sure to:
- Test that everything works with the new package
- Commit both
pyproject.tomlanduv.lockfiles:git add pyproject.toml uv.lock git commit -m "Add new-package dependency"
Development Process
- Fork the repository and set the upstream remote
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Run type checking (
mypy .) - Run the tests (
pytest) - Format your code (
ruff check .andruff format .). Not needed if pre-commit is installed, as it will run it for you. - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request. Make sure the Pull Request's base branch is the original repository's
mainbranch.
Code Style
We use the following tools to ensure code quality:
- ruff for linting and formatting
- mypy for type checking
Please make sure 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 tests pass:
# Run all tests
pytest
Pull Request Process
- Ensure your code follows the style guidelines of the project
- Update the README.md with details of changes if applicable
- The versioning scheme we use is SemVer
- Include a descriptive commit message
- Your pull request will be merged once it's reviewed and approved
Code of Conduct
Please note we have a code of conduct, please follow it in all your interactions with the project.
- Be respectful and inclusive
- Be collaborative
- When disagreeing, try to understand why
- A diverse community is a strong community
Questions?
Don't hesitate to open an issue if you have any questions about contributing to FastAPI-MCP.