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
13 changes: 12 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Dependabot keeps the pinned action SHAs in .github/workflows/ and the dev/runtime bounds in
# pyproject.toml current. Weekly, one PR per ecosystem at most, so a Monday brings at most two
# pyproject.toml current. Weekly, one PR per ecosystem at most, so a Monday brings at most three
# PRs to look at. The shared modules' runtime bounds (mcp, pyjwt, uvicorn) are mirrored in the
# siblings' pyproject.toml files: a bump here is a reminder to bump them there.
version: 2
Expand All @@ -12,6 +12,17 @@ updates:
groups:
actions:
patterns: ["*"]
# The hook revs in .pre-commit-config.yaml (SHA + "# frozen: vX" comment, both bumped).
# Local hooks are skipped, which is why the rendered-tests lint reuses ruff-pre-commit's hooks
# instead of pinning a second ruff in a local hook's additional_dependencies.
- package-ecosystem: pre-commit
directory: /
schedule:
interval: weekly
day: monday
groups:
hooks:
patterns: ["*"]
- package-ecosystem: pip
directory: /
schedule:
Expand Down
46 changes: 46 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# pre-commit install (once per clone; then every `git commit` runs these on the staged files)
# pre-commit run --all-files (the whole tree, as CI does)
#
# Revs are commit SHAs, not tags (a tag can be moved); the comment is the tag the SHA was taken
# from. Dependabot (.github/dependabot.yml, ecosystem pre-commit) bumps both together.
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: 3e8a8703264a2f4a69428a0aa4dcb512790b2c8c # frozen: v6.0.0
hooks:
- id: check-toml
- id: check-yaml
- id: check-merge-conflict
- id: end-of-file-fixer
- id: trailing-whitespace

# Before the ruff hooks below that lint tests/: hooks run in the order listed here.
- repo: local
hooks:
- id: render-shared-tests
name: render the shared tests into tests/
# The rendered copies are gitignored here, so writing them never dirties the commit.
entry: python scripts/sync_shared.py --source . --package mcp_shared
language: python
pass_filenames: false
files: ^(templates/|shared\.toml$|scripts/sync_shared\.py$|pyproject\.toml$)

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: c0f278f1254ccc8fb09676bcdb8d847e7db493e5 # frozen: v0.17.4
hooks:
- id: ruff-check
- id: ruff-format
# The rendered tests, as every sibling lints them. `ruff .` skips them (gitignored here),
# which is how a long template line once failed all nine siblings' CI (#25). Same ruff,
# same rev as above: these are the same hooks with different arguments.
- id: ruff-check
alias: ruff-check-rendered-tests
name: ruff check (rendered tests)
args: [--no-respect-gitignore, tests]
pass_filenames: false
files: ^(templates/|shared\.toml$|scripts/sync_shared\.py$|pyproject\.toml$)
- id: ruff-format
alias: ruff-format-rendered-tests
name: ruff format --check (rendered tests)
args: [--check, --no-respect-gitignore, tests]
pass_filenames: false
files: ^(templates/|shared\.toml$|scripts/sync_shared\.py$|pyproject\.toml$)
1 change: 1 addition & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ software/systems engineer: be technical and concrete, with specific examples.
- `ruff check .`: lint
- `ruff format --check .`: check formatting
- `mypy`: type-check
- `pre-commit install`: once per clone; commits then render and lint the templates as a sibling would

## Workflows

Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@ Choices worth knowing about, and why:

## Workflows

**Pre-commit:** run `pre-commit install` once per clone (it comes with `pip install -e ".[dev]"`); each commit then renders the test templates and lints them as the siblings will, which plain `ruff check .` can't (the rendered copies are gitignored here).

### Upgrading from format 1

If a sibling has a format 1 lockfile:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ dependencies = [
Homepage = "https://github.com/SDNick484/mcp-server-shared"

[project.optional-dependencies]
dev = ["pytest>=8", "pytest-cov>=5", "anyio>=4", "hypothesis>=6", "ruff>=0.6", "mypy>=1.11", "httpx2"]
dev = ["pytest>=8", "pytest-cov>=5", "anyio>=4", "hypothesis>=6", "ruff>=0.6", "mypy>=1.11", "httpx2", "pre-commit>=4"]

[tool.setuptools.packages.find]
where = ["src"]
Expand Down
Loading