fastapi-standalone-di 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 (29) hide show
  1. fastapi_standalone_di-0.1.0/.github/workflows/ci.yml +220 -0
  2. fastapi_standalone_di-0.1.0/.gitignore +218 -0
  3. fastapi_standalone_di-0.1.0/.pre-commit-config.yaml +33 -0
  4. fastapi_standalone_di-0.1.0/CHANGELOG.md +7 -0
  5. fastapi_standalone_di-0.1.0/LICENSE +21 -0
  6. fastapi_standalone_di-0.1.0/PKG-INFO +536 -0
  7. fastapi_standalone_di-0.1.0/README.md +500 -0
  8. fastapi_standalone_di-0.1.0/hatch_build.py +66 -0
  9. fastapi_standalone_di-0.1.0/pyproject.toml +132 -0
  10. fastapi_standalone_di-0.1.0/src/fastapi_standalone_di/__init__.py +48 -0
  11. fastapi_standalone_di-0.1.0/src/fastapi_standalone_di/_compat.py +49 -0
  12. fastapi_standalone_di-0.1.0/src/fastapi_standalone_di/app_state.py +128 -0
  13. fastapi_standalone_di-0.1.0/src/fastapi_standalone_di/py.typed +0 -0
  14. fastapi_standalone_di-0.1.0/src/fastapi_standalone_di/registration.py +132 -0
  15. fastapi_standalone_di-0.1.0/src/fastapi_standalone_di/resolve.py +1088 -0
  16. fastapi_standalone_di-0.1.0/tests/_future_annotations_deps.py +24 -0
  17. fastapi_standalone_di-0.1.0/tests/test_app_state.py +185 -0
  18. fastapi_standalone_di-0.1.0/tests/test_compat.py +94 -0
  19. fastapi_standalone_di-0.1.0/tests/test_future_annotations.py +23 -0
  20. fastapi_standalone_di-0.1.0/tests/test_packaging.py +22 -0
  21. fastapi_standalone_di-0.1.0/tests/test_params.py +191 -0
  22. fastapi_standalone_di-0.1.0/tests/test_readme.py +69 -0
  23. fastapi_standalone_di-0.1.0/tests/test_registration.py +113 -0
  24. fastapi_standalone_di-0.1.0/tests/test_request.py +182 -0
  25. fastapi_standalone_di-0.1.0/tests/test_resolve.py +853 -0
  26. fastapi_standalone_di-0.1.0/tests/test_scopes.py +337 -0
  27. fastapi_standalone_di-0.1.0/tests/test_security.py +56 -0
  28. fastapi_standalone_di-0.1.0/tests/test_standalone_app.py +201 -0
  29. fastapi_standalone_di-0.1.0/uv.lock +1357 -0
@@ -0,0 +1,220 @@
1
+ name: ci
2
+ on:
3
+ push: ~
4
+ pull_request: ~
5
+ jobs:
6
+ ci:
7
+ if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
8
+ runs-on: ubuntu-latest
9
+
10
+ name: Python ${{ matrix.python-version }}
11
+
12
+ strategy:
13
+ fail-fast: false
14
+ matrix:
15
+ python-version: [ "3.12", "3.13", "3.14" ]
16
+
17
+ steps:
18
+ - name: Checkout
19
+ uses: actions/checkout@v7
20
+
21
+ - name: Install uv
22
+ uses: astral-sh/setup-uv@v8.2.0
23
+ with:
24
+ python-version: ${{ matrix.python-version }}
25
+ enable-cache: true
26
+
27
+ - name: Install Dependencies
28
+ run: uv sync --locked --no-dev --group test
29
+
30
+ - name: Test
31
+ run: uv run --no-sync pytest --cov=fastapi_standalone_di
32
+
33
+ - name: Codecov
34
+ uses: codecov/codecov-action@v7
35
+
36
+ fastapi-compat:
37
+ # Test against FastAPI versions around each key internal-API change, from
38
+ # the supported floor (0.61) to latest. The package is installed normally
39
+ # (so tests run against the real installed artifact), then the target
40
+ # FastAPI version is forced on top — every matrix version satisfies the
41
+ # package's own ``fastapi>=…`` pin, so the downgrade resolves cleanly.
42
+ if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
43
+
44
+ runs-on: ubuntu-latest
45
+
46
+ name: FastAPI ${{ matrix.fastapi-version }}
47
+
48
+ strategy:
49
+ fail-fast: false
50
+ matrix:
51
+ fastapi-version:
52
+ - "0.61.0" # floor: HTTPConnection injection support
53
+ - "0.68.0" # ~5 years ago (pydantic v1 era)
54
+ - "0.99.1" # last pydantic v1 release
55
+ - "0.100.0" # pydantic v2 transition
56
+ - "0.112.4" # Dependant -> dataclass
57
+ - "0.120.2" # last before the deps/scopes rework
58
+ - "0.121.0" # is_*_callable leave utils.py; scope added (fracture line)
59
+ - "0.123.0" # security_scopes -> own/parent_oauth_scopes
60
+ - "0.129.0" # PEP 604 typing sweep
61
+ - "0.137.0" # routing dependant build extracted
62
+ - "0.139.0" # latest
63
+
64
+ steps:
65
+ - uses: actions/checkout@v7
66
+
67
+ - name: Install uv
68
+ uses: astral-sh/setup-uv@v8.2.0
69
+ with:
70
+ python-version: "3.12"
71
+
72
+ - name: Install (package + test deps)
73
+ run: uv sync --no-dev --group test
74
+
75
+ - name: Force FastAPI ${{ matrix.fastapi-version }}
76
+ run: uv pip install "fastapi==${{ matrix.fastapi-version }}"
77
+
78
+ - name: Test
79
+ # The README examples are a documentation-quality check against the
80
+ # current, fully-typed FastAPI (covered by the Python-version matrix).
81
+ # Old floor versions predate explicit type re-exports, so mypy --strict
82
+ # rejects them — irrelevant to runtime compatibility.
83
+ run: uv run --no-sync pytest --ignore=tests/test_readme.py
84
+
85
+ pre-commit:
86
+ if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
87
+
88
+ runs-on: ubuntu-latest
89
+
90
+ steps:
91
+ - uses: actions/checkout@v7
92
+
93
+ - name: Install uv
94
+ uses: astral-sh/setup-uv@v8.2.0
95
+ with:
96
+ python-version: "3.14"
97
+
98
+ - name: Run pre-commit
99
+ run: uv run pre-commit run --all-files --show-diff-on-failure
100
+
101
+ commitizen:
102
+ if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
103
+
104
+ runs-on: ubuntu-latest
105
+
106
+ steps:
107
+ - uses: actions/checkout@v7
108
+ with:
109
+ fetch-depth: 0
110
+
111
+ - name: Install uv
112
+ uses: astral-sh/setup-uv@v8.2.0
113
+ with:
114
+ python-version: "3.14"
115
+
116
+ - name: Check commit messages
117
+ run: |
118
+ if [ "${{ github.event_name }}" = "pull_request" ]; then
119
+ RANGE="${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }}"
120
+ elif [ "${{ github.event.before }}" = "0000000000000000000000000000000000000000" ] \
121
+ || ! git cat-file -e "${{ github.event.before }}^{commit}" 2>/dev/null; then
122
+ RANGE="HEAD~1..HEAD"
123
+ else
124
+ RANGE="${{ github.event.before }}..${{ github.event.after }}"
125
+ fi
126
+ echo "Checking commit range: ${RANGE}"
127
+ uv run cz check --rev-range "${RANGE}"
128
+
129
+ build:
130
+ if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
131
+ needs: [ ci ]
132
+
133
+ runs-on: ubuntu-latest
134
+
135
+ steps:
136
+ - name: Checkout
137
+ uses: actions/checkout@v7
138
+ with:
139
+ fetch-depth: 0
140
+
141
+ - name: Install uv
142
+ uses: astral-sh/setup-uv@v8.2.0
143
+ with:
144
+ python-version: "3.14"
145
+ enable-cache: true
146
+
147
+ - name: Git User config
148
+ run: |
149
+ git config --global user.email "action@github.com"
150
+ git config --global user.name "github-actions"
151
+
152
+ - name: Bump version
153
+ run: uvx --from python-semantic-release semantic-release version --no-commit --no-tag --no-push
154
+ env:
155
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
156
+
157
+ - name: Build
158
+ run: uv build
159
+
160
+ - uses: actions/upload-artifact@v7
161
+ with:
162
+ name: fastapi-standalone-di-python
163
+ path: ./dist
164
+
165
+ release:
166
+ if: github.ref == 'refs/heads/main' && github.event_name == 'push'
167
+ needs: [ pre-commit, commitizen, build ]
168
+
169
+ runs-on: ubuntu-latest
170
+
171
+ environment: pypi
172
+
173
+ permissions:
174
+ contents: write # semantic-release pushes the version bump commit + tag + GitHub release
175
+ id-token: write # OIDC token for PyPI Trusted Publishing (no API token needed)
176
+
177
+ steps:
178
+ - name: Checkout
179
+ uses: actions/checkout@v7
180
+ with:
181
+ fetch-depth: 0
182
+
183
+ - name: Install uv
184
+ uses: astral-sh/setup-uv@v8.2.0
185
+ with:
186
+ python-version: "3.14"
187
+ enable-cache: true
188
+
189
+ - name: Git User config
190
+ run: |
191
+ git config --global user.email "action@github.com"
192
+ git config --global user.name "github-actions"
193
+
194
+ - name: Bump version
195
+ run: uvx --from python-semantic-release semantic-release version
196
+ env:
197
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
198
+
199
+ - name: Build
200
+ run: uv build
201
+
202
+ - name: Upload to pypi
203
+ # Trusted Publishing via the job's OIDC token (see permissions above);
204
+ # requires a trusted publisher configured on PyPI for this repo + ci.yml.
205
+ run: uv publish --trusted-publishing always dist/*.tar.gz dist/*.whl
206
+
207
+ - name: Publish release
208
+ run: uvx --from python-semantic-release semantic-release publish
209
+ env:
210
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
211
+
212
+ - name: Merge main to develop
213
+ uses: robotology/gh-action-nightly-merge@v1.5.2
214
+ with:
215
+ stable_branch: 'main'
216
+ development_branch: 'develop'
217
+ allow_ff: true
218
+ user_name: github-actions
219
+ env:
220
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -0,0 +1,218 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[codz]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py.cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ # Pipfile.lock
96
+
97
+ # UV
98
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ # uv.lock
102
+
103
+ # poetry
104
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
106
+ # commonly ignored for libraries.
107
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108
+ # poetry.lock
109
+ # poetry.toml
110
+
111
+ # pdm
112
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
113
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
114
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
115
+ # pdm.lock
116
+ # pdm.toml
117
+ .pdm-python
118
+ .pdm-build/
119
+
120
+ # pixi
121
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
122
+ # pixi.lock
123
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
124
+ # in the .venv directory. It is recommended not to include this directory in version control.
125
+ .pixi
126
+
127
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
128
+ __pypackages__/
129
+
130
+ # Celery stuff
131
+ celerybeat-schedule
132
+ celerybeat.pid
133
+
134
+ # Redis
135
+ *.rdb
136
+ *.aof
137
+ *.pid
138
+
139
+ # RabbitMQ
140
+ mnesia/
141
+ rabbitmq/
142
+ rabbitmq-data/
143
+
144
+ # ActiveMQ
145
+ activemq-data/
146
+
147
+ # SageMath parsed files
148
+ *.sage.py
149
+
150
+ # Environments
151
+ .env
152
+ .envrc
153
+ .venv
154
+ env/
155
+ venv/
156
+ ENV/
157
+ env.bak/
158
+ venv.bak/
159
+
160
+ # Spyder project settings
161
+ .spyderproject
162
+ .spyproject
163
+
164
+ # Rope project settings
165
+ .ropeproject
166
+
167
+ # mkdocs documentation
168
+ /site
169
+
170
+ # mypy
171
+ .mypy_cache/
172
+ .dmypy.json
173
+ dmypy.json
174
+
175
+ # Pyre type checker
176
+ .pyre/
177
+
178
+ # pytype static type analyzer
179
+ .pytype/
180
+
181
+ # Cython debug symbols
182
+ cython_debug/
183
+
184
+ # PyCharm
185
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
186
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
187
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
188
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
189
+ # .idea/
190
+
191
+ # Abstra
192
+ # Abstra is an AI-powered process automation framework.
193
+ # Ignore directories containing user credentials, local state, and settings.
194
+ # Learn more at https://abstra.io/docs
195
+ .abstra/
196
+
197
+ # Visual Studio Code
198
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
199
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
200
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
201
+ # you could uncomment the following to ignore the entire vscode folder
202
+ # .vscode/
203
+ # Temporary file for partial code execution
204
+ tempCodeRunnerFile.py
205
+
206
+ # Ruff stuff:
207
+ .ruff_cache/
208
+
209
+ # PyPI configuration file
210
+ .pypirc
211
+
212
+ # Marimo
213
+ marimo/_static/
214
+ marimo/_lsp/
215
+ __marimo__/
216
+
217
+ # Streamlit
218
+ .streamlit/secrets.toml
@@ -0,0 +1,33 @@
1
+ # Install the git hooks with: uv run pre-commit install
2
+ # Run the file hooks manually with: uv run pre-commit run --all-files
3
+ #
4
+ # All hooks are `local` + `language: system` and run the tools through `uv run`,
5
+ # so they use the exact versions locked in uv.lock (declared in the dev group).
6
+ default_install_hook_types: [pre-commit, commit-msg]
7
+
8
+ repos:
9
+ - repo: local
10
+ hooks:
11
+ - id: ruff-check
12
+ name: ruff check
13
+ entry: uv run ruff check --fix
14
+ language: system
15
+ types_or: [python, pyi]
16
+ require_serial: true
17
+ - id: ruff-format
18
+ name: ruff format
19
+ entry: uv run ruff format
20
+ language: system
21
+ types_or: [python, pyi]
22
+ require_serial: true
23
+ - id: mypy
24
+ name: mypy
25
+ entry: uv run mypy
26
+ language: system
27
+ types: [python]
28
+ pass_filenames: false
29
+ - id: commitizen
30
+ name: commitizen check
31
+ entry: uv run cz check --commit-msg-file
32
+ language: system
33
+ stages: [commit-msg]
@@ -0,0 +1,7 @@
1
+ # CHANGELOG
2
+
3
+ <!-- version list -->
4
+
5
+ Changelog entries are generated automatically by
6
+ [python-semantic-release](https://python-semantic-release.readthedocs.io/) from
7
+ [Conventional Commits](https://www.conventionalcommits.org/) on release.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Rémi Alvergnat
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 all
13
+ 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 THE
21
+ SOFTWARE.