fastapi-router-versioning 0.1.0__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. fastapi_router_versioning-0.1.0/.github/dependabot.yml +45 -0
  2. fastapi_router_versioning-0.1.0/.github/workflows/detect-conflicts.yml +22 -0
  3. fastapi_router_versioning-0.1.0/.github/workflows/pre-commit.yml +66 -0
  4. fastapi_router_versioning-0.1.0/.github/workflows/publish.yml +40 -0
  5. fastapi_router_versioning-0.1.0/.github/workflows/test-redistribute.yml +68 -0
  6. fastapi_router_versioning-0.1.0/.github/workflows/test.yml +145 -0
  7. fastapi_router_versioning-0.1.0/.gitignore +35 -0
  8. fastapi_router_versioning-0.1.0/.pre-commit-config.yaml +59 -0
  9. fastapi_router_versioning-0.1.0/.python-version +1 -0
  10. fastapi_router_versioning-0.1.0/LICENSE +21 -0
  11. fastapi_router_versioning-0.1.0/PKG-INFO +410 -0
  12. fastapi_router_versioning-0.1.0/README.md +382 -0
  13. fastapi_router_versioning-0.1.0/examples/calver_app.py +56 -0
  14. fastapi_router_versioning-0.1.0/examples/download_static_assets.py +37 -0
  15. fastapi_router_versioning-0.1.0/examples/multi_router_app.py +59 -0
  16. fastapi_router_versioning-0.1.0/examples/openapi_hook_app.py +61 -0
  17. fastapi_router_versioning-0.1.0/examples/self_hosted_docs_app.py +57 -0
  18. fastapi_router_versioning-0.1.0/examples/semver_app.py +56 -0
  19. fastapi_router_versioning-0.1.0/examples/semver_major_only_app.py +58 -0
  20. fastapi_router_versioning-0.1.0/examples/webhook_versioning_app.py +91 -0
  21. fastapi_router_versioning-0.1.0/fastapi_router_versioning/__init__.py +5 -0
  22. fastapi_router_versioning-0.1.0/fastapi_router_versioning/py.typed +0 -0
  23. fastapi_router_versioning-0.1.0/fastapi_router_versioning/versioner.py +564 -0
  24. fastapi_router_versioning-0.1.0/pyproject.toml +135 -0
  25. fastapi_router_versioning-0.1.0/scripts/format.sh +5 -0
  26. fastapi_router_versioning-0.1.0/scripts/lint.sh +9 -0
  27. fastapi_router_versioning-0.1.0/scripts/test-cov-html.sh +8 -0
  28. fastapi_router_versioning-0.1.0/scripts/test-cov.sh +6 -0
  29. fastapi_router_versioning-0.1.0/scripts/test.sh +6 -0
  30. fastapi_router_versioning-0.1.0/tests/__init__.py +0 -0
  31. fastapi_router_versioning-0.1.0/tests/test_calver.py +116 -0
  32. fastapi_router_versioning-0.1.0/tests/test_fastapi_integration.py +105 -0
  33. fastapi_router_versioning-0.1.0/tests/test_semver.py +119 -0
  34. fastapi_router_versioning-0.1.0/tests/test_versioner.py +835 -0
  35. fastapi_router_versioning-0.1.0/uv.lock +1059 -0
@@ -0,0 +1,45 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: "github-actions"
4
+ directory: "/"
5
+ schedule:
6
+ interval: "weekly"
7
+ cooldown:
8
+ default-days: 7
9
+ commit-message:
10
+ prefix: "chore(actions)"
11
+ labels:
12
+ - "dependencies"
13
+ groups:
14
+ github-actions:
15
+ patterns:
16
+ - "*"
17
+
18
+ - package-ecosystem: "uv"
19
+ directory: "/"
20
+ schedule:
21
+ interval: "weekly"
22
+ cooldown:
23
+ default-days: 7
24
+ commit-message:
25
+ prefix: "chore(deps)"
26
+ groups:
27
+ python-dev:
28
+ dependency-type: "development"
29
+ patterns:
30
+ - "*"
31
+
32
+ - package-ecosystem: "pre-commit"
33
+ directory: "/"
34
+ schedule:
35
+ interval: "weekly"
36
+ cooldown:
37
+ default-days: 7
38
+ commit-message:
39
+ prefix: "chore(pre-commit)"
40
+ labels:
41
+ - "dependencies"
42
+ groups:
43
+ pre-commit:
44
+ patterns:
45
+ - "*"
@@ -0,0 +1,22 @@
1
+ name: "Conflict detector"
2
+ on:
3
+ push:
4
+ pull_request_target: # zizmor: ignore[dangerous-triggers]
5
+ types: [synchronize]
6
+
7
+ permissions: {}
8
+
9
+ jobs:
10
+ main:
11
+ permissions:
12
+ contents: read
13
+ pull-requests: write
14
+ runs-on: ubuntu-latest
15
+ timeout-minutes: 5
16
+ steps:
17
+ - name: Check if PRs have merge conflicts
18
+ uses: eps1lon/actions-label-merge-conflict@0273be72a0bbd58fcd71d0d6c02c209b50d1e5e1 # v3.1.0
19
+ with:
20
+ dirtyLabel: "conflicts"
21
+ repoToken: "${{ secrets.GITHUB_TOKEN }}"
22
+ commentOnDirty: "This pull request has a merge conflict that needs to be resolved."
@@ -0,0 +1,66 @@
1
+ name: pre-commit
2
+
3
+ on:
4
+ pull_request:
5
+ types:
6
+ - opened
7
+ - synchronize
8
+
9
+ permissions: {}
10
+
11
+ jobs:
12
+ pre-commit:
13
+ permissions:
14
+ contents: read
15
+ runs-on: ubuntu-latest
16
+ timeout-minutes: 5
17
+ steps:
18
+ - name: Dump GitHub context
19
+ env:
20
+ GITHUB_CONTEXT: ${{ toJson(github) }}
21
+ run: echo "$GITHUB_CONTEXT"
22
+
23
+ - name: Checkout code
24
+ uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
25
+ with:
26
+ persist-credentials: false
27
+ # Full history required for --from-ref/--to-ref diff in prek
28
+ fetch-depth: 0
29
+
30
+ - name: Set up Python
31
+ uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
32
+ with:
33
+ python-version-file: ".python-version"
34
+
35
+ - name: Setup uv
36
+ uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
37
+ with:
38
+ version: "0.11.18"
39
+ cache-dependency-glob: |
40
+ pyproject.toml
41
+ uv.lock
42
+
43
+ - name: Install Dependencies
44
+ run: uv sync --locked
45
+
46
+ - name: Run prek - pre-commit
47
+ # Only lint files changed in this PR, not the entire repo
48
+ run: uv run prek run --from-ref origin/${GITHUB_BASE_REF} --to-ref HEAD --show-diff-on-failure
49
+
50
+ # Required by GitHub branch protection rules
51
+ pre-commit-alls-green:
52
+ if: always()
53
+ needs:
54
+ - pre-commit
55
+ runs-on: ubuntu-latest
56
+ timeout-minutes: 5
57
+ steps:
58
+ - name: Dump GitHub context
59
+ env:
60
+ GITHUB_CONTEXT: ${{ toJson(github) }}
61
+ run: echo "$GITHUB_CONTEXT"
62
+
63
+ - name: Decide whether the needed jobs succeeded or failed
64
+ uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # v1.2.2
65
+ with:
66
+ jobs: ${{ toJSON(needs) }}
@@ -0,0 +1,40 @@
1
+ name: Publish
2
+
3
+ on:
4
+ release:
5
+ types:
6
+ - published
7
+
8
+ permissions: {}
9
+
10
+ jobs:
11
+ publish:
12
+ runs-on: ubuntu-latest
13
+ environment: pypi
14
+ permissions:
15
+ id-token: write
16
+ contents: read
17
+ timeout-minutes: 5
18
+ steps:
19
+ - name: Dump GitHub context
20
+ env:
21
+ GITHUB_CONTEXT: ${{ toJson(github) }}
22
+ run: echo "$GITHUB_CONTEXT"
23
+ - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
24
+ with:
25
+ persist-credentials: false
26
+ - name: Set up Python
27
+ uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
28
+ with:
29
+ python-version-file: ".python-version"
30
+ - name: Install uv
31
+ uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
32
+ with:
33
+ # Before upgrading uv version, make sure astral-sh/setup-uv knows its checksum.
34
+ # See: https://github.com/astral-sh/setup-uv/issues/851#issuecomment-4282017837
35
+ version: "0.11.18"
36
+ enable-cache: "false"
37
+ - name: Build distribution
38
+ run: uv build
39
+ - name: Publish
40
+ run: uv publish
@@ -0,0 +1,68 @@
1
+ name: Test Redistribute
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ pull_request:
8
+ types:
9
+ - opened
10
+ - synchronize
11
+
12
+ permissions: {}
13
+
14
+ jobs:
15
+ test-redistribute:
16
+ runs-on: ubuntu-latest
17
+ timeout-minutes: 5
18
+ permissions:
19
+ contents: read
20
+ steps:
21
+ - name: Dump GitHub context
22
+ env:
23
+ GITHUB_CONTEXT: ${{ toJson(github) }}
24
+ run: echo "$GITHUB_CONTEXT"
25
+ - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
26
+ with:
27
+ persist-credentials: false
28
+ - name: Set up Python
29
+ uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
30
+ with:
31
+ python-version-file: ".python-version"
32
+ - name: Install build dependencies
33
+ run: pip install build
34
+ - name: Build source distribution
35
+ run: python -m build --sdist
36
+ - name: Decompress source distribution
37
+ run: |
38
+ cd dist
39
+ tar xvf fastapi_router_versioning*.tar.gz
40
+ - name: Install test dependencies
41
+ run: |
42
+ cd dist/fastapi_router_versioning*/
43
+ pip install --group dev --editable .
44
+ - name: Run source distribution tests
45
+ run: |
46
+ cd dist/fastapi_router_versioning*/
47
+ bash scripts/test.sh
48
+ - name: Build wheel distribution
49
+ run: |
50
+ cd dist
51
+ pip wheel --no-deps fastapi_router_versioning*.tar.gz
52
+ - name: Dump GitHub context
53
+ env:
54
+ GITHUB_CONTEXT: ${{ toJson(github) }}
55
+ run: echo "$GITHUB_CONTEXT"
56
+
57
+ # https://github.com/marketplace/actions/alls-green#why
58
+ test-redistribute-alls-green:
59
+ if: always()
60
+ needs:
61
+ - test-redistribute
62
+ runs-on: ubuntu-latest
63
+ timeout-minutes: 5
64
+ steps:
65
+ - name: Decide whether the needed jobs succeeded or failed
66
+ uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # v1.2.2
67
+ with:
68
+ jobs: ${{ toJSON(needs) }}
@@ -0,0 +1,145 @@
1
+ name: Test
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ pull_request:
8
+ types:
9
+ - opened
10
+ - synchronize
11
+ schedule:
12
+ - cron: "0 0 * * 1"
13
+
14
+ permissions: {}
15
+
16
+ env:
17
+ UV_NO_SYNC: true
18
+
19
+ jobs:
20
+ test:
21
+ timeout-minutes: 15
22
+ permissions:
23
+ contents: read
24
+ strategy:
25
+ fail-fast: false
26
+ matrix:
27
+ python-version: [ "3.10", "3.11", "3.12", "3.13", "3.14" ]
28
+ fastapi-version: [ "0.120.0", "0.136.0", "latest" ]
29
+
30
+ include:
31
+ # Designates which job collects coverage
32
+ - python-version: "3.14"
33
+ fastapi-version: "latest"
34
+ coverage: "coverage"
35
+
36
+ runs-on: ubuntu-latest
37
+ env:
38
+ UV_PYTHON: ${{ matrix.python-version }}
39
+
40
+ steps:
41
+ - name: Dump GitHub context
42
+ env:
43
+ GITHUB_CONTEXT: ${{ toJson(github) }}
44
+ run: echo "$GITHUB_CONTEXT"
45
+
46
+ - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
47
+ with:
48
+ persist-credentials: false
49
+
50
+ - name: Set up Python
51
+ uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
52
+ with:
53
+ python-version: ${{ matrix.python-version }}
54
+
55
+ - name: Setup uv
56
+ uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
57
+ with:
58
+ version: "0.11.18"
59
+ enable-cache: true
60
+ cache-suffix: ${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.uv-resolution }}-fa${{ matrix.fastapi-version }}
61
+ cache-dependency-glob: |
62
+ pyproject.toml
63
+ uv.lock
64
+
65
+ - name: Install dependencies
66
+ run: uv sync
67
+
68
+ - name: Override FastAPI version
69
+ if: matrix.fastapi-version != 'latest'
70
+ run: uv pip install "fastapi==${{ matrix.fastapi-version }}"
71
+
72
+ - name: Prepare coverage dir
73
+ run: mkdir coverage
74
+
75
+ - name: Test
76
+ # GitHub Windows runners ship bash natively
77
+ run: uv run --no-sync bash scripts/test.sh
78
+ env:
79
+ COVERAGE_FILE: coverage/.coverage.${{ runner.os }}-py${{ matrix.python-version }}-fa${{ matrix.fastapi-version }}
80
+ CONTEXT: ${{ runner.os }}-py${{ matrix.python-version }}-fa${{ matrix.fastapi-version }}
81
+
82
+ - name: Store coverage files
83
+ if: matrix.coverage == 'coverage'
84
+ uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
85
+ with:
86
+ name: coverage-${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.fastapi-version }}
87
+ path: coverage
88
+ include-hidden-files: true
89
+
90
+ coverage-combine:
91
+ needs:
92
+ - test
93
+ runs-on: ubuntu-latest
94
+ timeout-minutes: 5
95
+ permissions:
96
+ contents: read
97
+ steps:
98
+ - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
99
+ with:
100
+ persist-credentials: false
101
+
102
+ - name: Setup uv
103
+ uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
104
+ with:
105
+ version: "0.11.18"
106
+ enable-cache: true
107
+ cache-dependency-glob: |
108
+ pyproject.toml
109
+ uv.lock
110
+
111
+ - name: Install Dependencies
112
+ run: uv sync --locked
113
+
114
+ - name: Get coverage files
115
+ uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
116
+ with:
117
+ pattern: coverage-*
118
+ path: coverage
119
+ merge-multiple: true
120
+
121
+ - run: ls -la coverage
122
+ - run: uv run coverage combine coverage
123
+ - run: uv run coverage html --title "Coverage for ${{ github.sha }}"
124
+
125
+ - name: Store coverage HTML
126
+ uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
127
+ with:
128
+ name: coverage-html
129
+ path: htmlcov
130
+ include-hidden-files: true
131
+
132
+ - run: uv run coverage report --fail-under=100
133
+
134
+ check:
135
+ if: always()
136
+ needs:
137
+ - coverage-combine
138
+ runs-on: ubuntu-latest
139
+ timeout-minutes: 5
140
+ permissions: {}
141
+ steps:
142
+ - name: Decide whether the needed jobs succeeded or failed
143
+ uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # v1.2.2
144
+ with:
145
+ jobs: ${{ toJSON(needs) }}
@@ -0,0 +1,35 @@
1
+ # Python
2
+ __pycache__/
3
+ *.pyc
4
+ *.pyo
5
+ *.pyd
6
+ *.egg-info/
7
+ *.egg
8
+
9
+ # Build / dist
10
+ build/
11
+ dist/
12
+
13
+ # Coverage
14
+ .coverage
15
+ coverage/
16
+ htmlcov/
17
+
18
+ # Virtual environments
19
+ .venv/
20
+ venv/
21
+
22
+ # IDE / OS
23
+ .vscode/
24
+ .idea/
25
+ .DS_Store
26
+ Thumbs.db
27
+
28
+ # Runtime
29
+ *.pid
30
+ *.log
31
+ *.tmp
32
+
33
+ # Local environment
34
+ .env
35
+ .run/
@@ -0,0 +1,59 @@
1
+ # See https://pre-commit.com for more information
2
+ # See https://pre-commit.com/hooks.html for more hooks
3
+ repos:
4
+ - repo: https://github.com/pre-commit/pre-commit-hooks
5
+ rev: 3e8a8703264a2f4a69428a0aa4dcb512790b2c8c # v6.0.0
6
+ hooks:
7
+ - id: check-added-large-files
8
+ args: [ '--maxkb=750' ]
9
+ exclude: ^uv\.lock$
10
+ - id: check-toml
11
+ - id: check-yaml
12
+ args:
13
+ - --unsafe
14
+ - id: end-of-file-fixer
15
+ - id: trailing-whitespace
16
+
17
+ - repo: https://github.com/crate-ci/typos
18
+ rev: b859c0df7f391deba73030f79b957e62b4d81dc6 # varcon-core-v5.0.7
19
+ hooks:
20
+ - id: typos
21
+ args: [--force-exclude]
22
+
23
+ - repo: local
24
+ hooks:
25
+ - id: local-ruff-check
26
+ name: ruff check
27
+ entry: uv run ruff check --force-exclude --fix --exit-non-zero-on-fix
28
+ require_serial: true
29
+ language: unsupported
30
+ types: [ python ]
31
+
32
+ - id: local-ruff-format
33
+ name: ruff format
34
+ entry: uv run ruff format --force-exclude --exit-non-zero-on-format
35
+ require_serial: true
36
+ language: unsupported
37
+ types: [ python ]
38
+
39
+ - id: local-mypy
40
+ name: mypy check
41
+ entry: uv run mypy fastapi_router_versioning
42
+ require_serial: true
43
+ language: unsupported
44
+ pass_filenames: false
45
+
46
+ - id: local-ty
47
+ name: ty check
48
+ entry: uv run ty check fastapi_router_versioning
49
+ require_serial: true
50
+ language: unsupported
51
+ pass_filenames: false
52
+
53
+ - id: zizmor
54
+ name: zizmor
55
+ language: python
56
+ entry: uv run zizmor .
57
+ files: ^\.github/workflows/
58
+ require_serial: true
59
+ pass_filenames: false
@@ -0,0 +1 @@
1
+ 3.11
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018 Sebastián Ramírez
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.