Skip to content

Commit a956401

Browse files
Merge branch 'main' into feat/oidc-fallback
2 parents 526dbd6 + ee54acb commit a956401

File tree

77 files changed

+3578
-2010
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+3578
-2010
lines changed

.github/workflows/shared.yml

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ name: Shared Checks
33
on:
44
workflow_call:
55

6+
permissions:
7+
contents: read
8+
69
jobs:
710
pre-commit:
811
runs-on: ubuntu-latest
@@ -26,6 +29,7 @@ jobs:
2629
test:
2730
runs-on: ${{ matrix.os }}
2831
timeout-minutes: 10
32+
continue-on-error: true
2933
strategy:
3034
matrix:
3135
python-version: ["3.10", "3.11", "3.12", "3.13"]
@@ -45,4 +49,26 @@ jobs:
4549

4650
- name: Run pytest
4751
run: uv run --frozen --no-sync pytest
48-
continue-on-error: true
52+
53+
# This must run last as it modifies the environment!
54+
- name: Run pytest with lowest versions
55+
run: |
56+
uv sync --all-extras --upgrade
57+
uv run --no-sync pytest
58+
env:
59+
UV_RESOLUTION: lowest-direct
60+
readme-snippets:
61+
runs-on: ubuntu-latest
62+
steps:
63+
- uses: actions/checkout@v4
64+
65+
- uses: astral-sh/setup-uv@v5
66+
with:
67+
enable-cache: true
68+
version: 0.7.2
69+
70+
- name: Install dependencies
71+
run: uv sync --frozen --all-extras --python 3.10
72+
73+
- name: Check README snippets are up to date
74+
run: uv run --frozen scripts/update_readme_snippets.py --check

.pre-commit-config.yaml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,20 @@ repos:
77
- id: prettier
88
types_or: [yaml, json5]
99

10+
- repo: https://github.com/igorshubovych/markdownlint-cli
11+
rev: v0.45.0
12+
hooks:
13+
- id: markdownlint
14+
args:
15+
[
16+
"--fix",
17+
"--config",
18+
"pyproject.toml",
19+
"--configPointer",
20+
"/tool/markdown/lint",
21+
]
22+
types: [markdown]
23+
1024
- repo: local
1125
hooks:
1226
- id: ruff-format
@@ -23,10 +37,10 @@ repos:
2337
types: [python]
2438
language: system
2539
pass_filenames: false
40+
exclude: ^README\.md$
2641
- id: pyright
2742
name: pyright
2843
entry: uv run pyright
29-
args: [src]
3044
language: system
3145
types: [python]
3246
pass_filenames: false
@@ -36,3 +50,9 @@ repos:
3650
language: system
3751
files: ^(pyproject\.toml|uv\.lock)$
3852
pass_filenames: false
53+
- id: readme-snippets
54+
name: Check README snippets are up to date
55+
entry: uv run scripts/update_readme_snippets.py --check
56+
language: system
57+
files: ^(README\.md|examples/.*\.py|scripts/update_readme_snippets\.py)$
58+
pass_filenames: false

CLAUDE.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ This document contains critical information about working with this codebase. Fo
1616
- Public APIs must have docstrings
1717
- Functions must be focused and small
1818
- Follow existing patterns exactly
19-
- Line length: 88 chars maximum
19+
- Line length: 120 chars maximum
2020

2121
3. Testing Requirements
2222
- Framework: `uv run --frozen pytest`
@@ -26,15 +26,19 @@ This document contains critical information about working with this codebase. Fo
2626
- Bug fixes require regression tests
2727

2828
- For commits fixing bugs or adding features based on user reports add:
29+
2930
```bash
3031
git commit --trailer "Reported-by:<name>"
3132
```
33+
3234
Where `<name>` is the name of the user.
3335

3436
- For commits related to a Github issue, add
37+
3538
```bash
3639
git commit --trailer "Github-Issue:#<number>"
3740
```
41+
3842
- NEVER ever mention a `co-authored-by` or similar aspects. In particular, never
3943
mention the tool used to create the commit message or PR.
4044

@@ -116,3 +120,15 @@ This document contains critical information about working with this codebase. Fo
116120
- Follow existing patterns
117121
- Document public APIs
118122
- Test thoroughly
123+
124+
## Exception Handling
125+
126+
- **Always use `logger.exception()` instead of `logger.error()` when catching exceptions**
127+
- Don't include the exception in the message: `logger.exception("Failed")` not `logger.exception(f"Failed: {e}")`
128+
- **Catch specific exceptions** where possible:
129+
- File ops: `except (OSError, PermissionError):`
130+
- JSON: `except json.JSONDecodeError:`
131+
- Network: `except (ConnectionError, TimeoutError):`
132+
- **Only catch `Exception` for**:
133+
- Top-level handlers that must not crash
134+
- Cleanup blocks (log at debug level)

CODE_OF_CONDUCT.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ representative at an online or offline event.
6060

6161
Instances of abusive, harassing, or otherwise unacceptable behavior may be
6262
reported to the community leaders responsible for enforcement at
63-
63+
6464
All complaints will be reviewed and investigated promptly and fairly.
6565

6666
All community leaders are obligated to respect the privacy and security of the
@@ -116,13 +116,13 @@ the community.
116116

117117
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118118
version 2.0, available at
119-
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
119+
<https://www.contributor-covenant.org/version/2/0/code_of_conduct.html>.
120120

121121
Community Impact Guidelines were inspired by [Mozilla's code of conduct
122122
enforcement ladder](https://github.com/mozilla/diversity).
123123

124124
[homepage]: https://www.contributor-covenant.org
125125

126126
For answers to common questions about this code of conduct, see the FAQ at
127-
https://www.contributor-covenant.org/faq. Translations are available at
128-
https://www.contributor-covenant.org/translations.
127+
<https://www.contributor-covenant.org/faq>. Translations are available at
128+
<https://www.contributor-covenant.org/translations>.

CONTRIBUTING.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Thank you for your interest in contributing to the MCP Python SDK! This document
99
3. Fork the repository
1010
4. Clone your fork: `git clone https://github.com/YOUR-USERNAME/python-sdk.git`
1111
5. Install dependencies:
12+
1213
```bash
1314
uv sync --frozen --all-extras --dev
1415
```
@@ -25,22 +26,31 @@ uv sync --frozen --all-extras --dev
2526
3. Make your changes
2627

2728
4. Ensure tests pass:
28-
```bash
29+
30+
```bash
2931
uv run pytest
3032
```
3133

3234
5. Run type checking:
35+
3336
```bash
3437
uv run pyright
3538
```
3639

3740
6. Run linting:
41+
3842
```bash
3943
uv run ruff check .
4044
uv run ruff format .
4145
```
4246

43-
7. Submit a pull request to the same branch you branched from
47+
7. Update README snippets if you modified example code:
48+
49+
```bash
50+
uv run scripts/update_readme_snippets.py
51+
```
52+
53+
8. Submit a pull request to the same branch you branched from
4454

4555
## Code Style
4656

0 commit comments

Comments
 (0)