Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions .github/workflows/run-static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
exit 1
fi
echo "✅ Lockfile is up to date"
- name: Run pre-commit
run: uv run pre-commit run --all-files
- name: Run prek
uses: j178/prek-action@v1
env:
SKIP: no-commit-to-branch
14 changes: 7 additions & 7 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ FastMCP is a comprehensive Python framework (Python ≥3.10) for building Model

```bash
uv sync # Install dependencies
uv run pre-commit run --all-files # Ruff + Prettier + ty
uv run prek run --all-files # Ruff + Prettier + ty
uv run pytest # Run full test suite
```

Expand Down Expand Up @@ -100,12 +100,12 @@ async with Client(transport=StreamableHttpTransport(server_url)) as client:

### Git & CI

- Pre-commit hooks are required (run automatically on commits)
- Never amend commits to fix pre-commit failures
- Prek hooks are required (run automatically on commits)
- Never amend commits to fix prek failures
- Apply PR labels: bugs/breaking/enhancements/features
- Improvements = enhancements (not features) unless specified
- **NEVER** force-push on collaborative repos
- **ALWAYS** run pre-commit before PRs
- **ALWAYS** run prek before PRs

### Commit Messages and Agent Attribution

Expand Down Expand Up @@ -217,7 +217,7 @@ If something needs work, your review should help it get there through specific,

Before approving, verify:

- [ ] All required development workflow steps completed (uv sync, pre-commit, pytest)
- [ ] All required development workflow steps completed (uv sync, prek, pytest)
- [ ] Changes align with repository patterns and conventions
- [ ] API changes are documented and backwards-compatible where possible
- [ ] Error handling follows project patterns (specific exception types)
Expand All @@ -237,7 +237,7 @@ uv sync # Installs all deps including dev tools

- **Linting**: `uv run ruff check` (or with `--fix`)
- **Type Checking**: `uv run ty check`
- **All Checks**: `uv run pre-commit run --all-files`
- **All Checks**: `uv run prek run --all-files`

### Testing

Expand All @@ -260,6 +260,6 @@ uv sync # Installs all deps including dev tools
### Build Issues (Common Solutions)

1. **Dependencies**: Always `uv sync` first
2. **Pre-commit fails**: Run `uv run pre-commit run --all-files` to see failures
2. **Prek fails**: Run `uv run prek run --all-files` to see failures
3. **Type errors**: Use `uv run ty check` directly, check `pyproject.toml` config
4. **Test timeouts**: Default 5s - optimize or mark as integration tests
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -481,28 +481,28 @@ uv run pytest --cov=src --cov=examples --cov-report=html

### Static Checks

FastMCP uses `pre-commit` for code formatting, linting, and type-checking. All PRs must pass these checks (they run automatically in CI).
FastMCP uses `prek` for code formatting, linting, and type-checking. All PRs must pass these checks (they run automatically in CI).

Install the hooks locally:

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

The hooks will now run automatically on `git commit`. You can also run them manually at any time:

```bash
pre-commit run --all-files
prek run --all-files
# or via uv
uv run pre-commit run --all-files
uv run prek run --all-files
```

### Pull Requests

1. Fork the repository on GitHub.
2. Create a feature branch from `main`.
3. Make your changes, including tests and documentation updates.
4. Ensure tests and pre-commit hooks pass.
4. Ensure tests and prek hooks pass.
5. Commit your changes and push to your fork.
6. Open a pull request against the `main` branch of `jlowin/fastmcp`.

Expand Down
18 changes: 9 additions & 9 deletions docs/development/contributing.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ cd fastmcp
# Install all dependencies including dev tools
uv sync

# Install pre-commit hooks
uv run pre-commit install
# Install prek hooks
uv run prek install
```

In addition, some development commands require [just](https://github.com/casey/just) to be installed.

Pre-commit hooks will run automatically on every commit to catch issues before they reach CI. If you see failures, fix them before committing - never commit broken code expecting to fix it later.
Prek hooks will run automatically on every commit to catch issues before they reach CI. If you see failures, fix them before committing - never commit broken code expecting to fix it later.

### Development Standards

Expand Down Expand Up @@ -100,19 +100,19 @@ The focus is on idiomatic, high-quality Python. FastMCP uses patterns like `NotS

**Breaking established patterns** confuses readers. If you must deviate, discuss in the issue first.

### Pre-Commit Checks
### Prek Checks

```bash
# Runs automatically on commit, or manually:
uv run pre-commit run --all-files
uv run prek run --all-files
```
Comment thread
zzstoatzz marked this conversation as resolved.

This runs three critical tools:
- **Ruff**: Linting and formatting
- **ty**: Static type checking
- **Pytest**: Core test suite
- **Prettier**: Code formatting
- **ty**: Static type checking

CI will reject PRs that fail these checks. Always run them locally first.
Pytest runs separately as a distinct workflow step after prek checks pass. CI will reject PRs that fail these checks. Always run them locally first.

### Testing

Expand Down Expand Up @@ -155,7 +155,7 @@ just api-ref-all

#### Before Submitting

1. **Run all checks**: `uv run pre-commit run --all-files && uv run pytest`
1. **Run all checks**: `uv run prek run --all-files && uv run pytest`
2. **Keep scope small**: One feature or fix per PR
3. **Write clear description**: Your PR description becomes permanent documentation
4. **Update docs**: Include documentation for API changes
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ dev = [
"inline-snapshot[dirty-equals]>=0.27.2",
"ipython>=8.12.3",
"pdbpp>=0.10.3",
"pre-commit",
"psutil",
"pyinstrument>=5.0.2",
"pyperclip>=1.9.0",
Expand All @@ -73,6 +72,7 @@ dev = [
"pytest-xdist>=3.6.1",
"ruff",
"ty>=0.0.1a19",
"prek>=0.2.12",
]

[project.scripts]
Expand Down
95 changes: 23 additions & 72 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading