feat: initial commit - Phase 1 & 2 core features

This commit is contained in:
hiderfong
2026-04-22 17:07:33 +08:00
commit 1773bda06b
25005 changed files with 6252106 additions and 0 deletions
@@ -0,0 +1,175 @@
Metadata-Version: 2.1
Name: starlette
Version: 0.37.2
Summary: The little ASGI library that shines.
Project-URL: Homepage, https://github.com/encode/starlette
Project-URL: Documentation, https://www.starlette.io/
Project-URL: Changelog, https://www.starlette.io/release-notes/
Project-URL: Funding, https://github.com/sponsors/encode
Project-URL: Source, https://github.com/encode/starlette
Author-email: Tom Christie <tom@tomchristie.com>
License-Expression: BSD-3-Clause
License-File: LICENSE.md
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Web Environment
Classifier: Framework :: AnyIO
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Internet :: WWW/HTTP
Requires-Python: >=3.8
Requires-Dist: anyio<5,>=3.4.0
Requires-Dist: typing-extensions>=3.10.0; python_version < '3.10'
Provides-Extra: full
Requires-Dist: httpx>=0.22.0; extra == 'full'
Requires-Dist: itsdangerous; extra == 'full'
Requires-Dist: jinja2; extra == 'full'
Requires-Dist: python-multipart>=0.0.7; extra == 'full'
Requires-Dist: pyyaml; extra == 'full'
Description-Content-Type: text/markdown
<p align="center">
<a href="https://www.starlette.io/"><img width="420px" src="https://raw.githubusercontent.com/encode/starlette/master/docs/img/starlette.png" alt='starlette'></a>
</p>
<p align="center">
<em>✨ The little ASGI framework that shines. ✨</em>
</p>
---
[![Build Status](https://github.com/encode/starlette/workflows/Test%20Suite/badge.svg)](https://github.com/encode/starlette/actions)
[![Package version](https://badge.fury.io/py/starlette.svg)](https://pypi.python.org/pypi/starlette)
[![Supported Python Version](https://img.shields.io/pypi/pyversions/starlette.svg?color=%2334D058)](https://pypi.org/project/starlette)
**Documentation**: [https://www.starlette.io/](https://www.starlette.io/)
---
# Starlette
Starlette is a lightweight [ASGI][asgi] framework/toolkit,
which is ideal for building async web services in Python.
It is production-ready, and gives you the following:
* A lightweight, low-complexity HTTP web framework.
* WebSocket support.
* In-process background tasks.
* Startup and shutdown events.
* Test client built on `httpx`.
* CORS, GZip, Static Files, Streaming responses.
* Session and Cookie support.
* 100% test coverage.
* 100% type annotated codebase.
* Few hard dependencies.
* Compatible with `asyncio` and `trio` backends.
* Great overall performance [against independent benchmarks][techempower].
## Requirements
Python 3.8+
## Installation
```shell
$ pip3 install starlette
```
You'll also want to install an ASGI server, such as [uvicorn](http://www.uvicorn.org/), [daphne](https://github.com/django/daphne/), or [hypercorn](https://pgjones.gitlab.io/hypercorn/).
```shell
$ pip3 install uvicorn
```
## Example
**example.py**:
```python
from starlette.applications import Starlette
from starlette.responses import JSONResponse
from starlette.routing import Route
async def homepage(request):
return JSONResponse({'hello': 'world'})
routes = [
Route("/", endpoint=homepage)
]
app = Starlette(debug=True, routes=routes)
```
Then run the application using Uvicorn:
```shell
$ uvicorn example:app
```
For a more complete example, see [encode/starlette-example](https://github.com/encode/starlette-example).
## Dependencies
Starlette only requires `anyio`, and the following are optional:
* [`httpx`][httpx] - Required if you want to use the `TestClient`.
* [`jinja2`][jinja2] - Required if you want to use `Jinja2Templates`.
* [`python-multipart`][python-multipart] - Required if you want to support form parsing, with `request.form()`.
* [`itsdangerous`][itsdangerous] - Required for `SessionMiddleware` support.
* [`pyyaml`][pyyaml] - Required for `SchemaGenerator` support.
You can install all of these with `pip3 install starlette[full]`.
## Framework or Toolkit
Starlette is designed to be used either as a complete framework, or as
an ASGI toolkit. You can use any of its components independently.
```python
from starlette.responses import PlainTextResponse
async def app(scope, receive, send):
assert scope['type'] == 'http'
response = PlainTextResponse('Hello, world!')
await response(scope, receive, send)
```
Run the `app` application in `example.py`:
```shell
$ uvicorn example:app
INFO: Started server process [11509]
INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
```
Run uvicorn with `--reload` to enable auto-reloading on code changes.
## Modularity
The modularity that Starlette is designed on promotes building re-usable
components that can be shared between any ASGI framework. This should enable
an ecosystem of shared middleware and mountable applications.
The clean API separation also means it's easier to understand each component
in isolation.
---
<p align="center"><i>Starlette is <a href="https://github.com/encode/starlette/blob/master/LICENSE.md">BSD licensed</a> code.<br/>Designed & crafted with care.</i></br>&mdash; ⭐️ &mdash;</p>
[asgi]: https://asgi.readthedocs.io/en/latest/
[httpx]: https://www.python-httpx.org/
[jinja2]: https://jinja.palletsprojects.com/
[python-multipart]: https://andrew-d.github.io/python-multipart/
[itsdangerous]: https://itsdangerous.palletsprojects.com/
[sqlalchemy]: https://www.sqlalchemy.org
[pyyaml]: https://pyyaml.org/wiki/PyYAMLDocumentation
[techempower]: https://www.techempower.com/benchmarks/#hw=ph&test=fortune&l=zijzen-sf
@@ -0,0 +1,76 @@
../../../../../../../../Library/Caches/com.apple.python/Users/nathan/Work/DataPointer/prop-data-guard/backend/.venv/lib/python3.9/site-packages/starlette/__init__.cpython-39.pyc,,
../../../../../../../../Library/Caches/com.apple.python/Users/nathan/Work/DataPointer/prop-data-guard/backend/.venv/lib/python3.9/site-packages/starlette/_compat.cpython-39.pyc,,
../../../../../../../../Library/Caches/com.apple.python/Users/nathan/Work/DataPointer/prop-data-guard/backend/.venv/lib/python3.9/site-packages/starlette/_exception_handler.cpython-39.pyc,,
../../../../../../../../Library/Caches/com.apple.python/Users/nathan/Work/DataPointer/prop-data-guard/backend/.venv/lib/python3.9/site-packages/starlette/_utils.cpython-39.pyc,,
../../../../../../../../Library/Caches/com.apple.python/Users/nathan/Work/DataPointer/prop-data-guard/backend/.venv/lib/python3.9/site-packages/starlette/applications.cpython-39.pyc,,
../../../../../../../../Library/Caches/com.apple.python/Users/nathan/Work/DataPointer/prop-data-guard/backend/.venv/lib/python3.9/site-packages/starlette/authentication.cpython-39.pyc,,
../../../../../../../../Library/Caches/com.apple.python/Users/nathan/Work/DataPointer/prop-data-guard/backend/.venv/lib/python3.9/site-packages/starlette/background.cpython-39.pyc,,
../../../../../../../../Library/Caches/com.apple.python/Users/nathan/Work/DataPointer/prop-data-guard/backend/.venv/lib/python3.9/site-packages/starlette/concurrency.cpython-39.pyc,,
../../../../../../../../Library/Caches/com.apple.python/Users/nathan/Work/DataPointer/prop-data-guard/backend/.venv/lib/python3.9/site-packages/starlette/config.cpython-39.pyc,,
../../../../../../../../Library/Caches/com.apple.python/Users/nathan/Work/DataPointer/prop-data-guard/backend/.venv/lib/python3.9/site-packages/starlette/convertors.cpython-39.pyc,,
../../../../../../../../Library/Caches/com.apple.python/Users/nathan/Work/DataPointer/prop-data-guard/backend/.venv/lib/python3.9/site-packages/starlette/datastructures.cpython-39.pyc,,
../../../../../../../../Library/Caches/com.apple.python/Users/nathan/Work/DataPointer/prop-data-guard/backend/.venv/lib/python3.9/site-packages/starlette/endpoints.cpython-39.pyc,,
../../../../../../../../Library/Caches/com.apple.python/Users/nathan/Work/DataPointer/prop-data-guard/backend/.venv/lib/python3.9/site-packages/starlette/exceptions.cpython-39.pyc,,
../../../../../../../../Library/Caches/com.apple.python/Users/nathan/Work/DataPointer/prop-data-guard/backend/.venv/lib/python3.9/site-packages/starlette/formparsers.cpython-39.pyc,,
../../../../../../../../Library/Caches/com.apple.python/Users/nathan/Work/DataPointer/prop-data-guard/backend/.venv/lib/python3.9/site-packages/starlette/middleware/__init__.cpython-39.pyc,,
../../../../../../../../Library/Caches/com.apple.python/Users/nathan/Work/DataPointer/prop-data-guard/backend/.venv/lib/python3.9/site-packages/starlette/middleware/authentication.cpython-39.pyc,,
../../../../../../../../Library/Caches/com.apple.python/Users/nathan/Work/DataPointer/prop-data-guard/backend/.venv/lib/python3.9/site-packages/starlette/middleware/base.cpython-39.pyc,,
../../../../../../../../Library/Caches/com.apple.python/Users/nathan/Work/DataPointer/prop-data-guard/backend/.venv/lib/python3.9/site-packages/starlette/middleware/cors.cpython-39.pyc,,
../../../../../../../../Library/Caches/com.apple.python/Users/nathan/Work/DataPointer/prop-data-guard/backend/.venv/lib/python3.9/site-packages/starlette/middleware/errors.cpython-39.pyc,,
../../../../../../../../Library/Caches/com.apple.python/Users/nathan/Work/DataPointer/prop-data-guard/backend/.venv/lib/python3.9/site-packages/starlette/middleware/exceptions.cpython-39.pyc,,
../../../../../../../../Library/Caches/com.apple.python/Users/nathan/Work/DataPointer/prop-data-guard/backend/.venv/lib/python3.9/site-packages/starlette/middleware/gzip.cpython-39.pyc,,
../../../../../../../../Library/Caches/com.apple.python/Users/nathan/Work/DataPointer/prop-data-guard/backend/.venv/lib/python3.9/site-packages/starlette/middleware/httpsredirect.cpython-39.pyc,,
../../../../../../../../Library/Caches/com.apple.python/Users/nathan/Work/DataPointer/prop-data-guard/backend/.venv/lib/python3.9/site-packages/starlette/middleware/sessions.cpython-39.pyc,,
../../../../../../../../Library/Caches/com.apple.python/Users/nathan/Work/DataPointer/prop-data-guard/backend/.venv/lib/python3.9/site-packages/starlette/middleware/trustedhost.cpython-39.pyc,,
../../../../../../../../Library/Caches/com.apple.python/Users/nathan/Work/DataPointer/prop-data-guard/backend/.venv/lib/python3.9/site-packages/starlette/middleware/wsgi.cpython-39.pyc,,
../../../../../../../../Library/Caches/com.apple.python/Users/nathan/Work/DataPointer/prop-data-guard/backend/.venv/lib/python3.9/site-packages/starlette/requests.cpython-39.pyc,,
../../../../../../../../Library/Caches/com.apple.python/Users/nathan/Work/DataPointer/prop-data-guard/backend/.venv/lib/python3.9/site-packages/starlette/responses.cpython-39.pyc,,
../../../../../../../../Library/Caches/com.apple.python/Users/nathan/Work/DataPointer/prop-data-guard/backend/.venv/lib/python3.9/site-packages/starlette/routing.cpython-39.pyc,,
../../../../../../../../Library/Caches/com.apple.python/Users/nathan/Work/DataPointer/prop-data-guard/backend/.venv/lib/python3.9/site-packages/starlette/schemas.cpython-39.pyc,,
../../../../../../../../Library/Caches/com.apple.python/Users/nathan/Work/DataPointer/prop-data-guard/backend/.venv/lib/python3.9/site-packages/starlette/staticfiles.cpython-39.pyc,,
../../../../../../../../Library/Caches/com.apple.python/Users/nathan/Work/DataPointer/prop-data-guard/backend/.venv/lib/python3.9/site-packages/starlette/status.cpython-39.pyc,,
../../../../../../../../Library/Caches/com.apple.python/Users/nathan/Work/DataPointer/prop-data-guard/backend/.venv/lib/python3.9/site-packages/starlette/templating.cpython-39.pyc,,
../../../../../../../../Library/Caches/com.apple.python/Users/nathan/Work/DataPointer/prop-data-guard/backend/.venv/lib/python3.9/site-packages/starlette/testclient.cpython-39.pyc,,
../../../../../../../../Library/Caches/com.apple.python/Users/nathan/Work/DataPointer/prop-data-guard/backend/.venv/lib/python3.9/site-packages/starlette/types.cpython-39.pyc,,
../../../../../../../../Library/Caches/com.apple.python/Users/nathan/Work/DataPointer/prop-data-guard/backend/.venv/lib/python3.9/site-packages/starlette/websockets.cpython-39.pyc,,
starlette-0.37.2.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
starlette-0.37.2.dist-info/METADATA,sha256=gpSdLAFW7nRhQCywHqkqolWMFuvlGhK4Dx93-LMPg-U,5852
starlette-0.37.2.dist-info/RECORD,,
starlette-0.37.2.dist-info/WHEEL,sha256=TJPnKdtrSue7xZ_AVGkp9YXcvDrobsjBds1du3Nx6dc,87
starlette-0.37.2.dist-info/licenses/LICENSE.md,sha256=3LlWd6AiQCQxh-lk-UGEfRmxeCHPmeWvrmhPqzKMGb8,1518
starlette/__init__.py,sha256=SeBQC857Sy21Q4v87dY7jgVizyx3X9q-VXoO_THI1WI,23
starlette/_compat.py,sha256=pcaBiAKr9ON7PFVg780yWlgH88AYXTGfcyV6c3awVY4,1148
starlette/_exception_handler.py,sha256=tylIPMfrfqDhAvtkPXVPuh1aoWxRjZfQIEkBvNgtsmE,2854
starlette/_utils.py,sha256=l6gXrrVgzwwdeH_0ipac4cOkwcGcitKU0JifQYZ9lIo,2586
starlette/applications.py,sha256=Sq-FzMl2Tw4XLajoFSboaAmCyK55I2SeIr7M_RzOrc8,10830
starlette/authentication.py,sha256=Cu4_Gne7kxr-nvInSyMRhwd5Ii2LvHemDfitC5IiPio,5036
starlette/background.py,sha256=gjbQhUJxISOcy-zY_WwL7lB4mPWs_3MWDGIvUVBtaig,1285
starlette/concurrency.py,sha256=CFzs6T9jP3Ac2CgPnEotVYiZzfnp0nwe4Himvrf10Fc,1895
starlette/config.py,sha256=2T_xQIpHrcmH8ZMI_7zP_9xbR8hXV1bVpYp6AlC7UPI,4651
starlette/convertors.py,sha256=LeLag5FHWCTkL5e5Itgw5fMqaiV2YFV1m_2WnbhMT4I,2283
starlette/datastructures.py,sha256=raQAOz9zH2QINbEq-Dzl_GLivoxC5WiIi9RoINv7prA,22660
starlette/endpoints.py,sha256=EWlkZyQ_gMxR4pJW2VZUFcVtSf1m0JYCjWOlM6b1ZOA,5217
starlette/exceptions.py,sha256=uh2wZTgrugWlFOtWU0LwrNitrfTl_nBhvg0WcXxBX_M,1816
starlette/formparsers.py,sha256=-o_f3MT6h04CU_Nxbivc5Rvc88OUbh-Bo1E0ilC4zRc,10314
starlette/middleware/__init__.py,sha256=YMPYCt96gJFlECzYnzu636MRLOtxZ5a36fC_SOPgn_Q,1302
starlette/middleware/authentication.py,sha256=mVWgFbGe2kouaGrYeH-1jxJ5j0yh9E7wEo4NIT0Ck-I,1797
starlette/middleware/base.py,sha256=9RhnqbZX88ZdWsmSM3RdXaspl8hG18VoPD_iIdpk_r0,8757
starlette/middleware/cors.py,sha256=DUmZOFog1qm5dAQ3UmhVmh_Jz7DMfDkgWz5jGmU8_f0,7101
starlette/middleware/errors.py,sha256=dH52FEGhSzVKFLZ6RvOFnlm0eIrvAz1-44M7A55-CNM,7942
starlette/middleware/exceptions.py,sha256=kjgonYNzo5gPKXwS2RUNIUuqQgfuIvUnK_mxHiXpTu0,2822
starlette/middleware/gzip.py,sha256=4PwBc42TLGo50SNUn8PNMndiJmN6VHdIBI5x1Pyq4go,4507
starlette/middleware/httpsredirect.py,sha256=SNTleaYALGoITV7xwbic4gB6VYdM8Ylea_ykciUz31g,848
starlette/middleware/sessions.py,sha256=nSI7jncGPhu9QMmiP2atqAbym43mZxbdMUTWul3fiW8,3592
starlette/middleware/trustedhost.py,sha256=I-sMihiGktdWraExEcxZbj6eyeRYonNTM07_JyGAb6Y,2233
starlette/middleware/wsgi.py,sha256=Nt9P-STDeAPfnCCHMcOpQx_a1CR_dX23nHuqyh9ewuc,5409
starlette/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
starlette/requests.py,sha256=6dQPuBPC1JrAZndCEQjb00IJvnrQZPEdAT9BetH3QMI,11034
starlette/responses.py,sha256=GKWyELRBTaSPREqlvcDhydCRt6iihADtbn1QHlHNBtE,12725
starlette/routing.py,sha256=by66F0uuO1ufM-BMTGNMIzaykyXQRgKdBUOGYECv_oU,35221
starlette/schemas.py,sha256=c1BRoALtNXZrWGj3ZKdkZE7IgpI6OPcBXYhNB24wQ30,5198
starlette/staticfiles.py,sha256=PLr6sJ1CKHrZa6GaLlwCjpMN2gqe5URbrhxnN06-tg8,8584
starlette/status.py,sha256=agWf8GelGgnGsgzWsFxkY6-0jSvC1kjHiiiG4lDvYQM,6098
starlette/templating.py,sha256=hFv1nMXEFfdFkR3UbK3lnGiZPWDl9UzoP6dIq-5uDCk,8683
starlette/testclient.py,sha256=rPqp1fVBgkVdNSSz4Dud64X53a53cj5asD6GS80SqI4,30367
starlette/types.py,sha256=u1auAPdWCMSVRLVJsyKzkvFN8EKW5JjLv8-Qs7f3QN0,1066
starlette/websockets.py,sha256=6cunEhLgyth9WNFI5IknBFo3eBsU4r7ibnmvK-Vq0VY,8779
@@ -0,0 +1,4 @@
Wheel-Version: 1.0
Generator: hatchling 1.21.1
Root-Is-Purelib: true
Tag: py3-none-any
@@ -0,0 +1,27 @@
Copyright © 2018, [Encode OSS Ltd](https://www.encode.io/).
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.