Contributions to pymupdf4llm-mcp are welcome and greatly appreciated. This page walks through setting up a local development environment, making changes, and submitting a pull request so your work can be included in the project.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/pymupdf/pymupdf4llm-mcp/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites
Before you begin, make sure you have the following installed:- Python 3.10 or later — the project targets Python 3.10–3.13
- uv — fast Python package and project manager (installation guide)
- Git
Setup
Install the virtual environment and pre-commit hooks
Run the The pre-commit hooks run ruff and other formatters automatically on every
install target to create the virtual environment with uv and register the pre-commit hooks:git commit.Make your changes
Edit the source code and add corresponding tests in the
tests/ directory. Every new behaviour or bug fix should be covered by at least one test case.Run the quality check suite
Before committing, verify that linting, formatting, and dependency checks all pass:This runs the following in order:
- Lock file consistency —
uv lock --lockedconfirmsuv.lockmatchespyproject.toml - Pre-commit linters — runs ruff (lint + format) and other hooks across all files
- Dependency audit —
deptry .checks for obsolete or missing dependencies
Available Make Targets
TheMakefile provides the following targets:
| Target | Description |
|---|---|
make install | Create the virtual environment and install pre-commit hooks |
make check | Run linters, format checks, and dependency audit |
make test | Run tests with pytest and generate a coverage report |
make snapshot | Update inline snapshots after intentional output changes |
make build | Build the wheel distribution |
make publish | Publish the built distribution to PyPI |
make build-and-publish | Build the wheel and publish it to PyPI in one step |
The project uses
inline-snapshot for snapshot testing. If you make an intentional change to the Markdown output produced by the server, run make snapshot to update the stored snapshots before committing. See Testing for more details.Code Quality
The project enforces consistent style through ruff:- Linter: ruff with a broad rule set (pyflakes, pyupgrade, bugbear, bandit, isort, and more)
- Formatter:
ruff formatwith preview mode enabled - Line length: 120 characters
- Target version: Python 3.9+
git commit, so most style issues are caught before they reach CI.
Pull Request Guidelines
Please check the following before opening a pull request:- Include tests for any new functionality or bug fix
- Update documentation if the change affects behaviour visible to users
- Pass
make check— all linters and the dependency audit must succeed - Pass
make test— all tests must pass with no unexpected snapshot differences