apitally-serverless 0.2.1__tar.gz → 0.2.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. apitally_serverless-0.2.2/.github/workflows/pi-comment.yaml +59 -0
  2. apitally_serverless-0.2.2/.github/workflows/pi-fix-ci.yaml +73 -0
  3. {apitally_serverless-0.2.1 → apitally_serverless-0.2.2}/.github/workflows/publish.yaml +3 -3
  4. apitally_serverless-0.2.2/.github/workflows/tests.yaml +121 -0
  5. apitally_serverless-0.2.2/.tool-versions +1 -0
  6. {apitally_serverless-0.2.1 → apitally_serverless-0.2.2}/PKG-INFO +5 -5
  7. {apitally_serverless-0.2.1 → apitally_serverless-0.2.2}/README.md +1 -1
  8. {apitally_serverless-0.2.1 → apitally_serverless-0.2.2}/apitally_serverless/starlette.py +1 -1
  9. {apitally_serverless-0.2.1 → apitally_serverless-0.2.2}/pyproject.toml +5 -5
  10. apitally_serverless-0.2.2/uv.lock +912 -0
  11. apitally_serverless-0.2.1/.github/workflows/tests.yaml +0 -82
  12. apitally_serverless-0.2.1/.tool-versions +0 -1
  13. apitally_serverless-0.2.1/uv.lock +0 -657
  14. {apitally_serverless-0.2.1 → apitally_serverless-0.2.2}/.editorconfig +0 -0
  15. {apitally_serverless-0.2.1 → apitally_serverless-0.2.2}/.gitignore +0 -0
  16. {apitally_serverless-0.2.1 → apitally_serverless-0.2.2}/LICENSE +0 -0
  17. {apitally_serverless-0.2.1 → apitally_serverless-0.2.2}/Makefile +0 -0
  18. {apitally_serverless-0.2.1 → apitally_serverless-0.2.2}/apitally_serverless/__init__.py +0 -0
  19. {apitally_serverless-0.2.1 → apitally_serverless-0.2.2}/apitally_serverless/common/__init__.py +0 -0
  20. {apitally_serverless-0.2.1 → apitally_serverless-0.2.2}/apitally_serverless/common/config.py +0 -0
  21. {apitally_serverless-0.2.1 → apitally_serverless-0.2.2}/apitally_serverless/common/consumers.py +0 -0
  22. {apitally_serverless-0.2.1 → apitally_serverless-0.2.2}/apitally_serverless/common/exceptions.py +0 -0
  23. {apitally_serverless-0.2.1 → apitally_serverless-0.2.2}/apitally_serverless/common/headers.py +0 -0
  24. {apitally_serverless-0.2.1 → apitally_serverless-0.2.2}/apitally_serverless/common/masking.py +0 -0
  25. {apitally_serverless-0.2.1 → apitally_serverless-0.2.2}/apitally_serverless/common/output.py +0 -0
  26. {apitally_serverless-0.2.1 → apitally_serverless-0.2.2}/apitally_serverless/fastapi.py +0 -0
  27. {apitally_serverless-0.2.1 → apitally_serverless-0.2.2}/apitally_serverless/py.typed +0 -0
  28. {apitally_serverless-0.2.1 → apitally_serverless-0.2.2}/renovate.json +0 -0
  29. {apitally_serverless-0.2.1 → apitally_serverless-0.2.2}/tests/__init__.py +0 -0
  30. {apitally_serverless-0.2.1 → apitally_serverless-0.2.2}/tests/conftest.py +0 -0
  31. {apitally_serverless-0.2.1 → apitally_serverless-0.2.2}/tests/test_common_consumers.py +0 -0
  32. {apitally_serverless-0.2.1 → apitally_serverless-0.2.2}/tests/test_common_exceptions.py +0 -0
  33. {apitally_serverless-0.2.1 → apitally_serverless-0.2.2}/tests/test_common_headers.py +0 -0
  34. {apitally_serverless-0.2.1 → apitally_serverless-0.2.2}/tests/test_common_masking.py +0 -0
  35. {apitally_serverless-0.2.1 → apitally_serverless-0.2.2}/tests/test_fastapi.py +0 -0
@@ -0,0 +1,59 @@
1
+ name: Pi Comment
2
+
3
+ on:
4
+ issue_comment:
5
+ types: [created]
6
+ pull_request_review:
7
+ types: [submitted]
8
+ pull_request_review_comment:
9
+ types: [created]
10
+
11
+ permissions:
12
+ actions: read
13
+ contents: read
14
+ issues: write
15
+ pull-requests: write
16
+
17
+ jobs:
18
+ pi:
19
+ if: |
20
+ github.actor == 'itssimon' &&
21
+ github.triggering_actor == 'itssimon' &&
22
+ (startsWith(github.event.comment.body, '/pi ') || startsWith(github.event.review.body, '/pi ')) &&
23
+ (github.event_name == 'issue_comment' || github.event.pull_request.head.repo.full_name == github.repository)
24
+ runs-on: ubuntu-latest
25
+ steps:
26
+ - name: Resolve checkout ref
27
+ id: context
28
+ env:
29
+ GH_TOKEN: ${{ github.token }}
30
+ EVENT_NAME: ${{ github.event_name }}
31
+ ISSUE_NUMBER: ${{ github.event.issue.number }}
32
+ ISSUE_PULL_REQUEST_URL: ${{ github.event.issue.pull_request.url }}
33
+ REVIEW_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
34
+ run: |
35
+ if [[ "$EVENT_NAME" == "issue_comment" && -n "$ISSUE_PULL_REQUEST_URL" ]]; then
36
+ read -r CHECKOUT_REF HEAD_REPOSITORY <<< "$(gh api "repos/$GITHUB_REPOSITORY/pulls/$ISSUE_NUMBER" --jq '[.head.sha, .head.repo.full_name] | @tsv')"
37
+ if [[ "$HEAD_REPOSITORY" != "$GITHUB_REPOSITORY" ]]; then
38
+ echo "::error::Cannot run Pi on a fork pull request"
39
+ exit 1
40
+ fi
41
+ elif [[ "$EVENT_NAME" != "issue_comment" ]]; then
42
+ CHECKOUT_REF="$REVIEW_HEAD_SHA"
43
+ fi
44
+ echo "checkout_ref=${CHECKOUT_REF:-}" >> "$GITHUB_OUTPUT"
45
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
46
+ with:
47
+ ref: ${{ steps.context.outputs.checkout_ref }}
48
+ fetch-depth: 0
49
+ token: ${{ secrets.PI_GITHUB_TOKEN }}
50
+ - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7
51
+ with:
52
+ node-version: "26"
53
+ - uses: shaftoe/pi-coding-agent-action@c9c89dcabbf612ab2a528acfad8785a8075e22f3 # v2.30.2
54
+ with:
55
+ github_token: ${{ github.token }}
56
+ provider: openrouter
57
+ model: anthropic/claude-sonnet-5.5
58
+ token: ${{ secrets.PI_OPENROUTER_API_KEY }}
59
+ thinking_level: high
@@ -0,0 +1,73 @@
1
+ name: Pi Fix CI
2
+ run-name: Pi Fix CI for run ${{ inputs.run_id }}
3
+
4
+ # Dispatched by the pi-fix-ci job in tests.yaml when CI fails on a Renovate PR
5
+ on:
6
+ workflow_dispatch:
7
+ inputs:
8
+ run_id:
9
+ description: ID of the failed Tests workflow run
10
+ required: true
11
+
12
+ permissions:
13
+ actions: read
14
+ contents: read
15
+ issues: write
16
+ pull-requests: write
17
+
18
+ jobs:
19
+ fix-ci:
20
+ runs-on: ubuntu-latest
21
+ steps:
22
+ - name: Look up pull request
23
+ id: pr
24
+ env:
25
+ GH_TOKEN: ${{ github.token }}
26
+ GH_REPO: ${{ github.repository }}
27
+ RUN_ID: ${{ inputs.run_id }}
28
+ run: |
29
+ branch=$(gh run view "$RUN_ID" --json headBranch --jq .headBranch)
30
+ echo "branch=$branch" >> "$GITHUB_OUTPUT"
31
+ echo "number=$(gh pr view "$branch" --json number --jq .number)" >> "$GITHUB_OUTPUT"
32
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
33
+ with:
34
+ ref: ${{ steps.pr.outputs.branch }}
35
+ fetch-depth: 0
36
+ token: ${{ secrets.PI_GITHUB_TOKEN }}
37
+ - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7
38
+ with:
39
+ node-version: "26"
40
+ - uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
41
+ with:
42
+ version: "0.13.7"
43
+ enable-cache: true
44
+ - name: Install Python
45
+ run: uv python install 3.14
46
+ - name: Install dependencies
47
+ run: uv sync --all-extras --frozen
48
+ # Logs are only available once the Tests run, which dispatched this workflow, has completed
49
+ - name: Capture failed CI logs
50
+ env:
51
+ GH_TOKEN: ${{ github.token }}
52
+ RUN_ID: ${{ inputs.run_id }}
53
+ run: |
54
+ gh run watch "$RUN_ID" > /dev/null
55
+ gh run view "$RUN_ID" --log-failed > "$RUNNER_TEMP/failed-ci.log"
56
+ - name: Investigate and fix CI failure
57
+ uses: shaftoe/pi-coding-agent-action@c9c89dcabbf612ab2a528acfad8785a8075e22f3 # v2.30.2
58
+ with:
59
+ github_token: ${{ github.token }}
60
+ provider: openrouter
61
+ model: anthropic/claude-sonnet-5.5
62
+ token: ${{ secrets.PI_OPENROUTER_API_KEY }}
63
+ thinking_level: high
64
+ update_comment: true
65
+ pr_number: ${{ steps.pr.outputs.number }}
66
+ prompt: |
67
+ Investigate failed CI run ${{ inputs.run_id }} for Renovate PR #${{ steps.pr.outputs.number }}. Inspect the PR diff and confirm the dependency update caused the failure. Read `${{ runner.temp }}/failed-ci.log`. Do not call `get_workflow_run_logs`.
68
+
69
+ Only make an obvious, minimal, mechanical change that preserves behavior, such as formatting, removing an obsolete suppression, correcting an import or annotation, or applying an unambiguous API signature change. Never change logic, test assertions, dependencies, lockfiles, configuration, generated files, schemas, migrations, workflows, or unrelated code.
70
+
71
+ Reproduce the failure and run the relevant failed CI command after editing. If it does not pass or cannot run reliably, restore your changes and do not push.
72
+
73
+ If the validated fix meets every condition, call update_pull_request once with commit message "Fix CI after dependency update". Otherwise, leave the working tree unchanged and concisely report the failed job, likely cause, reason automation was unsafe, and suggested manual action.
@@ -10,13 +10,13 @@ jobs:
10
10
  runs-on: ubuntu-latest
11
11
  environment: release
12
12
  steps:
13
- - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
13
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
14
14
  with:
15
15
  fetch-depth: 0
16
16
  - name: Install uv
17
- uses: astral-sh/setup-uv@11f9893b081a58869d3b5fccaea48c9e9e46f990 # v8.3.2
17
+ uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
18
18
  with:
19
- version: "0.11.28"
19
+ version: "0.13.7"
20
20
  enable-cache: true
21
21
  - name: Build package
22
22
  run: uv build
@@ -0,0 +1,121 @@
1
+ name: Tests
2
+ on:
3
+ push:
4
+ branches:
5
+ - main
6
+ pull_request:
7
+ workflow_dispatch:
8
+ concurrency:
9
+ group: ${{ github.workflow }}-${{ github.ref }}
10
+ cancel-in-progress: ${{ github.event_name == 'pull_request' }}
11
+
12
+ permissions:
13
+ contents: read
14
+ pull-requests: read
15
+
16
+ jobs:
17
+ changes:
18
+ runs-on: ubuntu-latest
19
+ outputs:
20
+ python: ${{ steps.filter.outputs.python }}
21
+ steps:
22
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
23
+ - uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d # v4.0.3
24
+ id: filter
25
+ with:
26
+ filters: |
27
+ python:
28
+ - ".github/workflows/tests.yaml"
29
+ - "Makefile"
30
+ - "apitally_serverless/**"
31
+ - "pyproject.toml"
32
+ - "tests/**"
33
+ - "uv.lock"
34
+
35
+ test-coverage:
36
+ needs: changes
37
+ if: needs.changes.outputs.python == 'true' || github.event_name == 'workflow_dispatch'
38
+ runs-on: ubuntu-latest
39
+ steps:
40
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
41
+ - name: Install uv
42
+ uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
43
+ with:
44
+ version: "0.13.7"
45
+ enable-cache: true
46
+ - name: Install Python
47
+ run: uv python install 3.14
48
+ - name: Install dependencies
49
+ run: uv sync --all-extras --frozen
50
+ - name: Run checks
51
+ run: uv run make check
52
+ - name: Run tests and create coverage report
53
+ run: uv run make test-coverage
54
+ - name: Upload coverage report to Codecov
55
+ uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7
56
+ with:
57
+ token: ${{ secrets.CODECOV_TOKEN }}
58
+
59
+ test-matrix:
60
+ needs: changes
61
+ if: needs.changes.outputs.python == 'true' || github.event_name == 'workflow_dispatch'
62
+ runs-on: ubuntu-latest
63
+ strategy:
64
+ fail-fast: false
65
+ matrix:
66
+ python: ["3.10", "3.11", "3.12", "3.13", "3.14"]
67
+ deps:
68
+ - fastapi starlette
69
+ - fastapi==0.116.1 starlette
70
+ steps:
71
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
72
+ - name: Install uv
73
+ uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
74
+ with:
75
+ version: "0.13.7"
76
+ enable-cache: true
77
+ - name: Install Python
78
+ run: uv python install ${{ matrix.python }}
79
+ - name: Build Python package wheel
80
+ run: uv build --wheel
81
+ - name: Install test dependencies
82
+ run: uv sync --no-install-project --only-group test --frozen
83
+ - name: Install app dependencies
84
+ run: uv pip install ${{ matrix.deps }} ./dist/apitally_serverless-*.whl
85
+ - name: Run tests
86
+ run: uv run make test
87
+
88
+ ci-gate:
89
+ needs:
90
+ - changes
91
+ - test-coverage
92
+ - test-matrix
93
+ if: always()
94
+ runs-on: ubuntu-latest
95
+ steps:
96
+ - name: All checks passed or skipped
97
+ run: |
98
+ if [[ "${{ contains(needs.*.result, 'failure') }}" == "true" || "${{ contains(needs.*.result, 'cancelled') }}" == "true" ]]; then
99
+ exit 1
100
+ fi
101
+
102
+ pi-fix-ci:
103
+ needs: ci-gate
104
+ if: |
105
+ !cancelled() &&
106
+ github.event_name == 'pull_request' &&
107
+ needs.ci-gate.result == 'failure' &&
108
+ github.run_attempt == 1 &&
109
+ github.actor == 'renovate[bot]' &&
110
+ github.event.pull_request.user.login == 'renovate[bot]' &&
111
+ startsWith(github.event.pull_request.head.ref, 'renovate/') &&
112
+ github.event.pull_request.head.repo.full_name == github.repository
113
+ runs-on: ubuntu-latest
114
+ permissions:
115
+ actions: write
116
+ steps:
117
+ - name: Dispatch Pi Fix CI workflow
118
+ env:
119
+ GH_TOKEN: ${{ github.token }}
120
+ GH_REPO: ${{ github.repository }}
121
+ run: gh workflow run pi-fix-ci.yaml --ref main -f run_id="$GITHUB_RUN_ID"
@@ -0,0 +1 @@
1
+ uv 0.13.7
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.5
2
2
  Name: apitally-serverless
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: Simple API monitoring & analytics for REST APIs running on serverless platforms (e.g. Cloudflare Workers).
5
5
  Project-URL: Homepage, https://apitally.io
6
6
  Project-URL: Documentation, https://docs.apitally.io
@@ -32,9 +32,9 @@ Requires-Python: <4.0,>=3.10
32
32
  Requires-Dist: typing-extensions>=4.0.0; python_version < '3.11'
33
33
  Provides-Extra: fastapi
34
34
  Requires-Dist: fastapi>=0.116.1; extra == 'fastapi'
35
- Requires-Dist: starlette<1.0.0,>=0.47.2; extra == 'fastapi'
35
+ Requires-Dist: starlette<2.0.0,>=0.47.2; extra == 'fastapi'
36
36
  Provides-Extra: starlette
37
- Requires-Dist: starlette<1.0.0,>=0.47.2; extra == 'starlette'
37
+ Requires-Dist: starlette<2.0.0,>=0.47.2; extra == 'starlette'
38
38
  Description-Content-Type: text/markdown
39
39
 
40
40
  <p align="center">
@@ -102,7 +102,7 @@ uptime checks. Alert notifications can be delivered via email, Slack and Microso
102
102
  | ------------------------------------------------- | ------------------ | ------------------------------------------------------------------------ |
103
103
  | [**FastAPI**](https://github.com/fastapi/fastapi) | `>=0.116.1` | [Link](https://docs.apitally.io/setup-guides/fastapi-cloudflare-workers) |
104
104
 
105
- Apitally also supports many other web frameworks in [Python](https://github.com/apitally/apitally-py), [JavaScript](https://github.com/apitally/apitally-js), [Go](https://github.com/apitally/apitally-go), [.NET](https://github.com/apitally/apitally-dotnet) and [Java](https://github.com/apitally/apitally-java) via our other SDKs.
105
+ Apitally also supports many other web frameworks in [Python](https://github.com/apitally/apitally-py), [JavaScript](https://github.com/apitally/apitally-js), [Go](https://github.com/apitally/apitally-go) and [.NET](https://github.com/apitally/apitally-dotnet) via our other SDKs.
106
106
 
107
107
  ## Getting started
108
108
 
@@ -63,7 +63,7 @@ uptime checks. Alert notifications can be delivered via email, Slack and Microso
63
63
  | ------------------------------------------------- | ------------------ | ------------------------------------------------------------------------ |
64
64
  | [**FastAPI**](https://github.com/fastapi/fastapi) | `>=0.116.1` | [Link](https://docs.apitally.io/setup-guides/fastapi-cloudflare-workers) |
65
65
 
66
- Apitally also supports many other web frameworks in [Python](https://github.com/apitally/apitally-py), [JavaScript](https://github.com/apitally/apitally-js), [Go](https://github.com/apitally/apitally-go), [.NET](https://github.com/apitally/apitally-dotnet) and [Java](https://github.com/apitally/apitally-java) via our other SDKs.
66
+ Apitally also supports many other web frameworks in [Python](https://github.com/apitally/apitally-py), [JavaScript](https://github.com/apitally/apitally-js), [Go](https://github.com/apitally/apitally-go) and [.NET](https://github.com/apitally/apitally-dotnet) via our other SDKs.
67
67
 
68
68
  ## Getting started
69
69
 
@@ -187,7 +187,7 @@ class ApitallyMiddleware:
187
187
  "msg": get_truncated_exception_msg(exception),
188
188
  "traceback": get_truncated_exception_traceback(exception),
189
189
  }
190
- if exception
190
+ if exception is not None
191
191
  else None,
192
192
  }
193
193
 
@@ -31,8 +31,8 @@ dependencies = ["typing-extensions>=4.0.0; python_version<'3.11'"]
31
31
  dynamic = ["version"]
32
32
 
33
33
  [project.optional-dependencies]
34
- fastapi = ["fastapi>=0.116.1", "starlette>=0.47.2,<1.0.0"]
35
- starlette = ["starlette>=0.47.2,<1.0.0"]
34
+ fastapi = ["fastapi>=0.116.1", "starlette>=0.47.2,<2.0.0"]
35
+ starlette = ["starlette>=0.47.2,<2.0.0"]
36
36
 
37
37
  [project.urls]
38
38
  Homepage = "https://apitally.io"
@@ -40,13 +40,13 @@ Documentation = "https://docs.apitally.io"
40
40
  Repository = "https://github.com/apitally/apitally-py-serverless"
41
41
 
42
42
  [dependency-groups]
43
- dev = ["ruff~=0.15.0", "ty>=0.0.61"]
43
+ dev = ["ruff~=0.17.0", "ty>=0.0.61"]
44
44
  test = [
45
45
  "httpx~=0.28.0",
46
- "pytest~=9.1.1",
46
+ "pytest~=9.2.0",
47
47
  "pytest-asyncio~=1.4.0",
48
48
  "pytest-cov~=7.1.0",
49
- "pytest-mock~=3.15.0",
49
+ "pytest-mock~=3.17.0",
50
50
  ]
51
51
 
52
52
  [build-system]