fastapi-router-versioning 0.2.5__tar.gz → 0.2.7__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 (49) hide show
  1. {fastapi_router_versioning-0.2.5 → fastapi_router_versioning-0.2.7}/.github/dependabot.yml +2 -19
  2. fastapi_router_versioning-0.2.7/.github/workflows/bump-pre-commit-hooks.yml +67 -0
  3. {fastapi_router_versioning-0.2.5 → fastapi_router_versioning-0.2.7}/.github/workflows/create-draft-release.yml +1 -1
  4. {fastapi_router_versioning-0.2.5 → fastapi_router_versioning-0.2.7}/.github/workflows/labeler.yml +1 -1
  5. {fastapi_router_versioning-0.2.5 → fastapi_router_versioning-0.2.7}/.github/workflows/pre-commit.yml +1 -1
  6. {fastapi_router_versioning-0.2.5 → fastapi_router_versioning-0.2.7}/.github/workflows/prepare-release.yml +1 -1
  7. {fastapi_router_versioning-0.2.5 → fastapi_router_versioning-0.2.7}/.github/workflows/publish.yml +1 -1
  8. {fastapi_router_versioning-0.2.5 → fastapi_router_versioning-0.2.7}/.github/workflows/test.yml +2 -2
  9. {fastapi_router_versioning-0.2.5 → fastapi_router_versioning-0.2.7}/.pre-commit-config.yaml +1 -1
  10. {fastapi_router_versioning-0.2.5 → fastapi_router_versioning-0.2.7}/PKG-INFO +11 -2
  11. {fastapi_router_versioning-0.2.5 → fastapi_router_versioning-0.2.7}/README.md +10 -1
  12. {fastapi_router_versioning-0.2.5 → fastapi_router_versioning-0.2.7}/RELEASE_NOTES.md +15 -0
  13. {fastapi_router_versioning-0.2.5 → fastapi_router_versioning-0.2.7}/fastapi_router_versioning/__init__.py +1 -1
  14. {fastapi_router_versioning-0.2.5 → fastapi_router_versioning-0.2.7}/fastapi_router_versioning/versioner.py +1 -2
  15. {fastapi_router_versioning-0.2.5 → fastapi_router_versioning-0.2.7}/uv.lock +221 -217
  16. {fastapi_router_versioning-0.2.5 → fastapi_router_versioning-0.2.7}/.github/labeler.yml +0 -0
  17. {fastapi_router_versioning-0.2.5 → fastapi_router_versioning-0.2.7}/.github/workflows/detect-conflicts.yml +0 -0
  18. {fastapi_router_versioning-0.2.5 → fastapi_router_versioning-0.2.7}/.github/workflows/guard-dependencies.yml +0 -0
  19. {fastapi_router_versioning-0.2.5 → fastapi_router_versioning-0.2.7}/.github/workflows/latest-changes.yml +0 -0
  20. {fastapi_router_versioning-0.2.5 → fastapi_router_versioning-0.2.7}/.github/workflows/test-redistribute.yml +0 -0
  21. {fastapi_router_versioning-0.2.5 → fastapi_router_versioning-0.2.7}/.github/workflows/zizmor.yml +0 -0
  22. {fastapi_router_versioning-0.2.5 → fastapi_router_versioning-0.2.7}/.gitignore +0 -0
  23. {fastapi_router_versioning-0.2.5 → fastapi_router_versioning-0.2.7}/.python-version +0 -0
  24. {fastapi_router_versioning-0.2.5 → fastapi_router_versioning-0.2.7}/LICENSE +0 -0
  25. {fastapi_router_versioning-0.2.5 → fastapi_router_versioning-0.2.7}/examples/calver_app.py +0 -0
  26. {fastapi_router_versioning-0.2.5 → fastapi_router_versioning-0.2.7}/examples/download_static_assets.py +0 -0
  27. {fastapi_router_versioning-0.2.5 → fastapi_router_versioning-0.2.7}/examples/mounted_subapps_app.py +0 -0
  28. {fastapi_router_versioning-0.2.5 → fastapi_router_versioning-0.2.7}/examples/multi_router_app.py +0 -0
  29. {fastapi_router_versioning-0.2.5 → fastapi_router_versioning-0.2.7}/examples/openapi_hook_app.py +0 -0
  30. {fastapi_router_versioning-0.2.5 → fastapi_router_versioning-0.2.7}/examples/self_hosted_docs_app.py +0 -0
  31. {fastapi_router_versioning-0.2.5 → fastapi_router_versioning-0.2.7}/examples/semver_app.py +0 -0
  32. {fastapi_router_versioning-0.2.5 → fastapi_router_versioning-0.2.7}/examples/semver_major_only_app.py +0 -0
  33. {fastapi_router_versioning-0.2.5 → fastapi_router_versioning-0.2.7}/examples/validation_error_code_app.py +0 -0
  34. {fastapi_router_versioning-0.2.5 → fastapi_router_versioning-0.2.7}/examples/validation_error_code_custom_handler_app.py +0 -0
  35. {fastapi_router_versioning-0.2.5 → fastapi_router_versioning-0.2.7}/examples/webhook_versioning_app.py +0 -0
  36. {fastapi_router_versioning-0.2.5 → fastapi_router_versioning-0.2.7}/fastapi_router_versioning/py.typed +0 -0
  37. {fastapi_router_versioning-0.2.5 → fastapi_router_versioning-0.2.7}/pyproject.toml +0 -0
  38. {fastapi_router_versioning-0.2.5 → fastapi_router_versioning-0.2.7}/scripts/format.sh +0 -0
  39. {fastapi_router_versioning-0.2.5 → fastapi_router_versioning-0.2.7}/scripts/lint.sh +0 -0
  40. {fastapi_router_versioning-0.2.5 → fastapi_router_versioning-0.2.7}/scripts/prepare_release.py +0 -0
  41. {fastapi_router_versioning-0.2.5 → fastapi_router_versioning-0.2.7}/scripts/test-cov-html.sh +0 -0
  42. {fastapi_router_versioning-0.2.5 → fastapi_router_versioning-0.2.7}/scripts/test-cov.sh +0 -0
  43. {fastapi_router_versioning-0.2.5 → fastapi_router_versioning-0.2.7}/scripts/test.sh +0 -0
  44. {fastapi_router_versioning-0.2.5 → fastapi_router_versioning-0.2.7}/tests/__init__.py +0 -0
  45. {fastapi_router_versioning-0.2.5 → fastapi_router_versioning-0.2.7}/tests/test_calver.py +0 -0
  46. {fastapi_router_versioning-0.2.5 → fastapi_router_versioning-0.2.7}/tests/test_fastapi_integration.py +0 -0
  47. {fastapi_router_versioning-0.2.5 → fastapi_router_versioning-0.2.7}/tests/test_prepare_release.py +0 -0
  48. {fastapi_router_versioning-0.2.5 → fastapi_router_versioning-0.2.7}/tests/test_semver.py +0 -0
  49. {fastapi_router_versioning-0.2.5 → fastapi_router_versioning-0.2.7}/tests/test_versioner.py +0 -0
@@ -4,7 +4,7 @@ updates:
4
4
  - package-ecosystem: "github-actions"
5
5
  directory: "/"
6
6
  schedule:
7
- interval: "weekly"
7
+ interval: "monthly"
8
8
  cooldown:
9
9
  default-days: 7
10
10
  commit-message:
@@ -21,7 +21,7 @@ updates:
21
21
  - package-ecosystem: "uv"
22
22
  directory: "/"
23
23
  schedule:
24
- interval: "weekly"
24
+ interval: "monthly"
25
25
  cooldown:
26
26
  default-days: 7
27
27
  commit-message:
@@ -31,20 +31,3 @@ updates:
31
31
  dependency-type: "development"
32
32
  patterns:
33
33
  - "*"
34
- # pre-commit
35
- - package-ecosystem: "pre-commit"
36
- directory: "/"
37
- schedule:
38
- interval: "weekly"
39
- cooldown:
40
- default-days: 7
41
- commit-message:
42
- prefix: ⬆
43
- labels:
44
- - "internal"
45
- - "dependencies"
46
- - "pre-commit"
47
- groups:
48
- pre-commit:
49
- patterns:
50
- - "*"
@@ -0,0 +1,67 @@
1
+ name: Bump pre-commit hooks
2
+
3
+ on:
4
+ schedule:
5
+ - cron: "0 12 1 * *"
6
+ workflow_dispatch:
7
+
8
+ permissions: {}
9
+
10
+ jobs:
11
+ bump-pre-commit-hooks:
12
+ if: github.repository_owner == 'mat81black'
13
+ runs-on: ubuntu-latest
14
+ timeout-minutes: 10
15
+ steps:
16
+ - name: Dump GitHub context
17
+ env:
18
+ GITHUB_CONTEXT: ${{ toJson(github) }}
19
+ run: echo "$GITHUB_CONTEXT"
20
+ - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
21
+ with:
22
+ token: ${{ secrets.FASTAPI_ROUTER_VERSIONING_LATEST_CHANGES }}
23
+ persist-credentials: true
24
+ - name: Set up Python
25
+ uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
26
+ with:
27
+ python-version-file: ".python-version"
28
+ - name: Setup uv
29
+ uses: astral-sh/setup-uv@11f9893b081a58869d3b5fccaea48c9e9e46f990 # v8.3.2
30
+ with:
31
+ # Before upgrading uv version, make sure astral-sh/setup-uv knows its checksum.
32
+ # See: https://github.com/astral-sh/setup-uv/issues/851#issuecomment-4282017837
33
+ version: "0.11.18"
34
+ cache-dependency-glob: |
35
+ pyproject.toml
36
+ uv.lock
37
+ - name: Bump pre-commit hooks
38
+ run: uv run prek auto-update --freeze --cooldown-days 7
39
+ - name: Create pull request
40
+ env:
41
+ GH_TOKEN: ${{ secrets.FASTAPI_ROUTER_VERSIONING_LATEST_CHANGES }}
42
+ BASE_BRANCH: ${{ github.event.repository.default_branch }}
43
+ run: |
44
+ set -euo pipefail
45
+ if git diff --quiet; then
46
+ echo "No pre-commit hook updates available"
47
+ exit 0
48
+ fi
49
+ git config user.name "github-actions[bot]"
50
+ git config user.email "github-actions[bot]@users.noreply.github.com"
51
+ branch="bump-pre-commit-hooks"
52
+ git switch -C "$branch"
53
+ git add .pre-commit-config.yaml
54
+ git commit -m "⬆ Bump pre-commit hooks"
55
+ git push --force origin "$branch"
56
+ if [ -z "$(gh pr list --head "$branch" --state open --json number --jq '.[].number')" ]; then
57
+ gh pr create \
58
+ --base "$BASE_BRANCH" \
59
+ --head "$branch" \
60
+ --title "⬆ Bump pre-commit hooks" \
61
+ --body "Bump pre-commit hook versions via \`prek auto-update --freeze --cooldown-days 7\`." \
62
+ --label internal \
63
+ --label dependencies \
64
+ --label pre-commit
65
+ else
66
+ echo "PR for \"$branch\" already open; branch updated in place."
67
+ fi
@@ -31,7 +31,7 @@ jobs:
31
31
  with:
32
32
  python-version-file: ".python-version"
33
33
  - name: Install uv
34
- uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
34
+ uses: astral-sh/setup-uv@11f9893b081a58869d3b5fccaea48c9e9e46f990 # v8.3.2
35
35
  with:
36
36
  # Before upgrading uv version, make sure astral-sh/setup-uv knows its checksum.
37
37
  # See: https://github.com/astral-sh/setup-uv/issues/851#issuecomment-4282017837
@@ -19,7 +19,7 @@ jobs:
19
19
  runs-on: ubuntu-latest
20
20
  timeout-minutes: 5
21
21
  steps:
22
- - uses: actions/labeler@f27b608878404679385c85cfa523b85ccb86e213 # v6.1.0
22
+ - uses: actions/labeler@b8dd2d9be0f68b860e7dae5dae7d772984eacd6d # v6.2.0
23
23
  if: ${{ github.event.action != 'labeled' && github.event.action != 'unlabeled' }}
24
24
  - run: echo "Done adding labels"
25
25
  # Run this after labeler applied labels
@@ -30,7 +30,7 @@ jobs:
30
30
  python-version-file: ".python-version"
31
31
 
32
32
  - name: Setup uv
33
- uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
33
+ uses: astral-sh/setup-uv@11f9893b081a58869d3b5fccaea48c9e9e46f990 # v8.3.2
34
34
  with:
35
35
  # Before upgrading uv version, make sure astral-sh/setup-uv knows its checksum.
36
36
  # See: https://github.com/astral-sh/setup-uv/issues/851#issuecomment-4282017837
@@ -43,7 +43,7 @@ jobs:
43
43
  with:
44
44
  python-version-file: ".python-version"
45
45
  - name: Install uv
46
- uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
46
+ uses: astral-sh/setup-uv@11f9893b081a58869d3b5fccaea48c9e9e46f990 # v8.3.2
47
47
  with:
48
48
  # Before upgrading uv version, make sure astral-sh/setup-uv knows its checksum.
49
49
  # See: https://github.com/astral-sh/setup-uv/issues/851#issuecomment-4282017837
@@ -28,7 +28,7 @@ jobs:
28
28
  with:
29
29
  python-version-file: ".python-version"
30
30
  - name: Install uv
31
- uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
31
+ uses: astral-sh/setup-uv@11f9893b081a58869d3b5fccaea48c9e9e46f990 # v8.3.2
32
32
  with:
33
33
  # Before upgrading uv version, make sure astral-sh/setup-uv knows its checksum.
34
34
  # See: https://github.com/astral-sh/setup-uv/issues/851#issuecomment-4282017837
@@ -82,7 +82,7 @@ jobs:
82
82
  python-version: ${{ matrix.python-version }}
83
83
 
84
84
  - name: Setup uv
85
- uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
85
+ uses: astral-sh/setup-uv@11f9893b081a58869d3b5fccaea48c9e9e46f990 # v8.3.2
86
86
  with:
87
87
  # Before upgrading uv version, make sure astral-sh/setup-uv knows its checksum.
88
88
  # See: https://github.com/astral-sh/setup-uv/issues/851#issuecomment-4282017837
@@ -135,7 +135,7 @@ jobs:
135
135
  persist-credentials: false
136
136
 
137
137
  - name: Setup uv
138
- uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
138
+ uses: astral-sh/setup-uv@11f9893b081a58869d3b5fccaea48c9e9e46f990 # v8.3.2
139
139
  with:
140
140
  # Before upgrading uv version, make sure astral-sh/setup-uv knows its checksum.
141
141
  # See: https://github.com/astral-sh/setup-uv/issues/851#issuecomment-4282017837
@@ -15,7 +15,7 @@ repos:
15
15
  - id: trailing-whitespace
16
16
 
17
17
  - repo: https://github.com/crate-ci/typos
18
- rev: b859c0df7f391deba73030f79b957e62b4d81dc6 # varcon-core-v5.0.7
18
+ rev: bee27e3a4fd1ea2111cf90ab89cd076c870fce14 # frozen: v1.48.0
19
19
  hooks:
20
20
  - id: typos
21
21
  args: [ --force-exclude ]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fastapi-router-versioning
3
- Version: 0.2.5
3
+ Version: 0.2.7
4
4
  Summary: Router-based API versioning for FastAPI, with per-version docs and a declarative route lifecycle.
5
5
  Project-URL: Homepage, https://github.com/mat81black/fastapi-router-versioning
6
6
  Project-URL: Repository, https://github.com/mat81black/fastapi-router-versioning
@@ -37,7 +37,7 @@ Description-Content-Type: text/markdown
37
37
  [![Supported Python versions](https://img.shields.io/pypi/pyversions/fastapi-router-versioning.svg?color=%2334D058)](https://pypi.org/project/fastapi-router-versioning/)
38
38
  [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)
39
39
 
40
- FastAPI doesn't ship a way to run multiple API versions side by side. Teams typically end up duplicating routers, hand-rolling prefixes, or branching on request paths, and every one of those gets harder to maintain as versions pile up. `RouterVersioner` takes a declarative approach instead: annotate each route with the version it belongs to, and it generates the URL prefixes, the per-version OpenAPI schema, and the docs for you, without moving anything else in your app.
40
+ Running multiple API versions side by side usually means duplicating routers, hand-rolling prefixes, or branching on request paths, and every one of those gets harder to maintain as versions pile up. `RouterVersioner` takes a declarative approach instead: annotate each route with the version it belongs to, and it generates the URL prefixes, the per-version OpenAPI schema, and the docs for you, without moving anything else in your app.
41
41
 
42
42
  ---
43
43
 
@@ -154,6 +154,15 @@ def legacy_route():
154
154
  A route without `@api_version` isn't excluded, it falls back to `default_version`
155
155
  (`(1, 0)` for SemVer, `"1"` for CalVer, unless overridden).
156
156
 
157
+ FastAPI's own `deprecated=True` (set directly on a route, or inherited from
158
+ `APIRouter(deprecated=True)`) is preserved as-is: `RouterVersioner` copies it into every
159
+ version unconditionally, on top of whatever `deprecate_in` computes. `deprecate_in` only
160
+ ever turns deprecation *on* for versions at or after its boundary, it never turns off a
161
+ `deprecated=True` that was already set natively. If you set both on the same route, it
162
+ shows as deprecated in every version, including ones before `deprecate_in`'s boundary.
163
+ Use one or the other: `deprecated=True` for an unconditional, version-independent flag,
164
+ `deprecate_in` for a per-version lifecycle.
165
+
157
166
  ---
158
167
 
159
168
  ## `RouterVersioner` reference
@@ -6,7 +6,7 @@
6
6
  [![Supported Python versions](https://img.shields.io/pypi/pyversions/fastapi-router-versioning.svg?color=%2334D058)](https://pypi.org/project/fastapi-router-versioning/)
7
7
  [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)
8
8
 
9
- FastAPI doesn't ship a way to run multiple API versions side by side. Teams typically end up duplicating routers, hand-rolling prefixes, or branching on request paths, and every one of those gets harder to maintain as versions pile up. `RouterVersioner` takes a declarative approach instead: annotate each route with the version it belongs to, and it generates the URL prefixes, the per-version OpenAPI schema, and the docs for you, without moving anything else in your app.
9
+ Running multiple API versions side by side usually means duplicating routers, hand-rolling prefixes, or branching on request paths, and every one of those gets harder to maintain as versions pile up. `RouterVersioner` takes a declarative approach instead: annotate each route with the version it belongs to, and it generates the URL prefixes, the per-version OpenAPI schema, and the docs for you, without moving anything else in your app.
10
10
 
11
11
  ---
12
12
 
@@ -123,6 +123,15 @@ def legacy_route():
123
123
  A route without `@api_version` isn't excluded, it falls back to `default_version`
124
124
  (`(1, 0)` for SemVer, `"1"` for CalVer, unless overridden).
125
125
 
126
+ FastAPI's own `deprecated=True` (set directly on a route, or inherited from
127
+ `APIRouter(deprecated=True)`) is preserved as-is: `RouterVersioner` copies it into every
128
+ version unconditionally, on top of whatever `deprecate_in` computes. `deprecate_in` only
129
+ ever turns deprecation *on* for versions at or after its boundary, it never turns off a
130
+ `deprecated=True` that was already set natively. If you set both on the same route, it
131
+ shows as deprecated in every version, including ones before `deprecate_in`'s boundary.
132
+ Use one or the other: `deprecated=True` for an unconditional, version-independent flag,
133
+ `deprecate_in` for a per-version lifecycle.
134
+
126
135
  ---
127
136
 
128
137
  ## `RouterVersioner` reference
@@ -2,6 +2,21 @@
2
2
 
3
3
  ## Latest Changes
4
4
 
5
+ ## 0.2.7 (2026-07-18)
6
+
7
+ ### Internal
8
+
9
+ * ⬆ Bump pre-commit hooks. PR [#44](https://github.com/mat81black/fastapi-router-versioning/pull/44) by [@mat81black](https://github.com/mat81black).
10
+ * ⬆ Bump the python-packages group across 1 directory with 5 updates. PR [#42](https://github.com/mat81black/fastapi-router-versioning/pull/42) by [@dependabot[bot]](https://github.com/apps/dependabot).
11
+ * ⬆ Bump the github-actions group across 1 directory with 2 updates. PR [#41](https://github.com/mat81black/fastapi-router-versioning/pull/41) by [@dependabot[bot]](https://github.com/apps/dependabot).
12
+ * 👷 Replace Dependabot pre-commit ecosystem with custom bump workflow. PR [#43](https://github.com/mat81black/fastapi-router-versioning/pull/43) by [@mat81black](https://github.com/mat81black).
13
+
14
+ ## 0.2.6 (2026-07-11)
15
+
16
+ ### Refactors
17
+
18
+ * ♻️ Use fastapi-native imports instead of importing from starlette directly. PR [#38](https://github.com/mat81black/fastapi-router-versioning/pull/38) by [@mat81black](https://github.com/mat81black).
19
+
5
20
  ## 0.2.5 (2026-07-10)
6
21
 
7
22
  ### Fixes
@@ -1,5 +1,5 @@
1
1
  from .versioner import RouterVersioner, VersionFormat, VersionT, api_version
2
2
 
3
- __version__ = "0.2.5"
3
+ __version__ = "0.2.7"
4
4
 
5
5
  __all__ = ["RouterVersioner", "api_version", "VersionFormat", "VersionT"]
@@ -9,7 +9,7 @@ from typing import Any, TypeAlias, TypeVar
9
9
  import fastapi.openapi.utils
10
10
  import fastapi.routing
11
11
 
12
- from fastapi import APIRouter, FastAPI
12
+ from fastapi import APIRouter, FastAPI, Request
13
13
  from fastapi.encoders import jsonable_encoder
14
14
  from fastapi.exceptions import RequestValidationError
15
15
  from fastapi.openapi.docs import (
@@ -19,7 +19,6 @@ from fastapi.openapi.docs import (
19
19
  )
20
20
  from fastapi.responses import HTMLResponse, JSONResponse
21
21
  from fastapi.routing import APIRoute, APIWebSocketRoute
22
- from starlette.requests import Request
23
22
 
24
23
  # iter_route_contexts was introduced in FastAPI 0.137.2. On older versions the
25
24
  # attribute does not exist and getattr returns None, activating the fallback path.