Skip to content

Fix dependencies #42

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 30 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
ff9972c
refactor how mcp generates the http_tool_function so arguments will work
Mar 30, 2025
d229da9
code cleanups
Mar 31, 2025
80a860e
fix problem with post requests
Mar 31, 2025
060d9c2
ruff & mypy
Mar 31, 2025
e47767d
bugfix
Mar 31, 2025
2eceae9
add readme notice
Apr 6, 2025
8534d2a
version 0.1.5
Apr 6, 2025
a8a5aad
change to 0.1.5
Apr 6, 2025
2fa55cf
skip handle_mcp_connection_mcp_get when creating tools
Apr 1, 2025
60664fc
remove this skip from tests as no longer needed
Apr 1, 2025
83312f7
move the mounting to happen after the tool creation so handle_mcp_con…
Apr 6, 2025
6f297dd
version prep
Apr 6, 2025
b35f479
fix syntaxerror
Apr 6, 2025
4ccc3d3
version prep
Apr 6, 2025
95500ec
.
Apr 6, 2025
0f79a11
add keyword
shahar4499 Apr 7, 2025
cf3b318
add pre-commit dev dependency
shahar4499 Apr 7, 2025
739769b
add pre-commit config
shahar4499 Apr 7, 2025
072d9ef
improve contibution guide
shahar4499 Apr 7, 2025
c4f224e
remove redundant stuff from gitignore
shahar4499 Apr 7, 2025
dc50bce
add .python-version file
shahar4499 Apr 7, 2025
5430dbe
add empty mypy config
shahar4499 Apr 7, 2025
e72393e
add dependabot
shahar4499 Apr 7, 2025
98698de
update .python-version to favour 3.12. Project still supports 3.10, 3…
shahar4499 Apr 7, 2025
95e6402
add initial pytest config with low coverage until we add more tests
shahar4499 Apr 7, 2025
a20ad94
add ci and release
shahar4499 Apr 7, 2025
61f105b
add CI and codecov badges to readme
shahar4499 Apr 7, 2025
8eb78ba
modern python packaging - remove setup.py and have single source of t…
shahar4499 Apr 7, 2025
4476629
remove inspect-mate dependency
Apr 9, 2025
a263b9c
uv sync
Apr 9, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
open-pull-requests-limit: 10
labels:
- "dependencies"
- "github-actions"

- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "weekly"
open-pull-requests-limit: 10
labels:
- "dependencies"
- "python"
87 changes: 87 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: CI

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
ruff:
name: Ruff
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v5
with:
version: "0.6.12"
enable-cache: true
cache-dependency-glob: "uv.lock"

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version-file: ".python-version"

- name: Install dependencies
run: uv sync --all-extras --dev

- name: Lint with Ruff
run: uv run ruff check .

mypy:
name: MyPy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v5
with:
version: "0.6.12"
enable-cache: true
cache-dependency-glob: "uv.lock"

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version-file: ".python-version"

- name: Install dependencies
run: uv sync --all-extras --dev

- name: Type check with MyPy
run: uv run mypy .

test:
name: Test Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v5
with:
version: "0.6.12"
python-version: ${{ matrix.python-version }}
enable-cache: true
cache-dependency-glob: "uv.lock"

- name: Install dependencies
run: uv sync --all-extras --dev

- name: Run tests
run: uv run pytest --cov=fastapi_mcp --cov-report=xml

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false
38 changes: 38 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Release

on:
release:
types: [created]

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install uv
uses: astral-sh/setup-uv@v5
with:
version: "0.6.12"
enable-cache: true

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version-file: ".python-version"

- name: Install build dependencies
run: |
uv sync --all-extras --dev
uv pip install build twine

- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
uv run python -m build
uv run twine check dist/*
uv run twine upload dist/*
24 changes: 0 additions & 24 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -82,30 +82,6 @@ target/
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
.pdm.toml
.pdm-python
.pdm-build/

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

Expand Down
14 changes: 14 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: check-yaml
- id: check-added-large-files

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.9.10
hooks:
- id: ruff
args: [--fix]
- id: ruff-format
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.12
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,21 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.1.7]

### Fixed
- [Issue #34](https://github.com/tadata-org/fastapi_mcp/issues/34): Fix syntax error.

## [0.1.6]

### Fixed
- [Issue #23](https://github.com/tadata-org/fastapi_mcp/issues/23): Hide handle_mcp_connection tool.

## [0.1.5]

### Fixed
- [Issue #25](https://github.com/tadata-org/fastapi_mcp/issues/25): Dynamically creating tools function so tools are useable.

## [0.1.4]

### Fixed
Expand Down
122 changes: 83 additions & 39 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,67 +1,114 @@
# Contributing to FastAPI-MCP

First off, thank you for considering contributing to FastAPI-MCP!
First off, thank you for considering contributing to FastAPI-MCP!

## Development Setup

1. Make sure you have Python 3.10+ installed
2. Install [uv](https://docs.astral.sh/uv/getting-started/installation/) (recommended) or pip
3. Fork the repository
4. Clone your fork
1. Make sure you have Python 3.10+ installed
2. Install [uv](https://docs.astral.sh/uv/getting-started/installation/) package manager
3. Fork the repository
4. Clone your fork

```bash
# Clone your fork
git clone https://github.com/YOUR-USERNAME/fastapi_mcp.git
cd fastapi-mcp
```bash
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
```
# Add the upstream remote
git remote add upstream https://github.com/tadata-org/fastapi_mcp.git
```

5. Set up the development environment:
5. Set up the development environment:

```bash
# Create a virtual environment with uv (recommended)
uv venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
```bash
uv sync
```

# Install development dependencies with uv
uv sync --extra dev
That's it! The `uv sync` command will automatically create and use a virtual environment.

# Alternatively, using pip
# python -m venv venv
# source venv/bin/activate # On Windows: venv\Scripts\activate
# pip install -e ".[dev]"
```
6. Install pre-commit hooks:

```bash
uv run pre-commit install
uv run pre-commit run
```

Pre-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:

1. **With the virtual environment activated**:
```bash
source .venv/bin/activate # On Windows: .venv\Scripts\activate

# Then run commands directly
pytest
mypy .
ruff check .
```

2. **Without activating the virtual environment**:
```bash
# 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 run` prefix. If you haven't activated your virtual environment, remember to prepend `uv run` to all python-related commands and tools.

### Adding Dependencies

When adding new dependencies to the library:

1. **Runtime dependencies** - packages needed to run the application:
```bash
uv add new-package
```

2. **Development dependencies** - packages needed for development, testing, or CI:
```bash
uv add --group dev new-package
```

After adding dependencies, make sure to:
1. Test that everything works with the new package
2. Commit both `pyproject.toml` and `uv.lock` files:
```bash
git add pyproject.toml uv.lock
git commit -m "Add new-package dependency"
```

## Development Process

1. Fork the repository and set the upstream remote
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
3. Make your changes
4. Run type checking (`uv run mypy .`)
5. Run the tests (`uv run pytest`)
6. Format your code (`uv run ruff check .` and `uv run ruff format .`)
4. Run type checking (`mypy .`)
5. Run the tests (`pytest`)
6. Format your code (`ruff check .` and `ruff format .`). Not needed if pre-commit is installed, as it will run it for you.
7. Commit your changes (`git commit -m 'Add some amazing feature'`)
8. Push to the branch (`git push origin feature/amazing-feature`)
9. Open a Pull Request on [the project repository](https://github.com/tadata-org/fastapi_mcp/)
9. Open a Pull Request. Make sure the Pull Request's base branch is [the original repository's](https://github.com/tadata-org/fastapi_mcp/) `main` branch.

## Code Style

We use the following tools to ensure code quality:

- **ruff** for linting
- **ruff** for linting and formatting
- **mypy** for type checking

Please make sure your code passes all checks before submitting a pull request:

```bash
# Using uv
uv run ruff check .
uv run mypy .

# Or directly if tools are installed
# Check code formatting and style
ruff check .
ruff format .

# Check types
mypy .
```

Expand All @@ -70,10 +117,7 @@ mypy .
We use pytest for testing. Please write tests for any new features and ensure all tests pass:

```bash
# Using uv
uv run pytest

# Or directly
# Run all tests
pytest
```

Expand All @@ -96,4 +140,4 @@ Please note we have a code of conduct, please follow it in all your interactions

## Questions?

Don't hesitate to open an issue if you have any questions about contributing to FastAPI-MCP.
Don't hesitate to open an issue if you have any questions about contributing to FastAPI-MCP.
Loading