METADATA 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. Metadata-Version: 2.1
  2. Name: starlette
  3. Version: 0.27.0
  4. Summary: The little ASGI library that shines.
  5. Project-URL: Homepage, https://github.com/encode/starlette
  6. Project-URL: Documentation, https://www.starlette.io/
  7. Project-URL: Changelog, https://www.starlette.io/release-notes/
  8. Project-URL: Funding, https://github.com/sponsors/encode
  9. Project-URL: Source, https://github.com/encode/starlette
  10. Author-email: Tom Christie <tom@tomchristie.com>
  11. License-Expression: BSD-3-Clause
  12. License-File: LICENSE.md
  13. Classifier: Development Status :: 3 - Alpha
  14. Classifier: Environment :: Web Environment
  15. Classifier: Framework :: AnyIO
  16. Classifier: Intended Audience :: Developers
  17. Classifier: License :: OSI Approved :: BSD License
  18. Classifier: Operating System :: OS Independent
  19. Classifier: Programming Language :: Python :: 3
  20. Classifier: Programming Language :: Python :: 3.7
  21. Classifier: Programming Language :: Python :: 3.8
  22. Classifier: Programming Language :: Python :: 3.9
  23. Classifier: Programming Language :: Python :: 3.10
  24. Classifier: Programming Language :: Python :: 3.11
  25. Classifier: Topic :: Internet :: WWW/HTTP
  26. Requires-Python: >=3.7
  27. Requires-Dist: anyio<5,>=3.4.0
  28. Requires-Dist: typing-extensions>=3.10.0; python_version < '3.10'
  29. Provides-Extra: full
  30. Requires-Dist: httpx>=0.22.0; extra == 'full'
  31. Requires-Dist: itsdangerous; extra == 'full'
  32. Requires-Dist: jinja2; extra == 'full'
  33. Requires-Dist: python-multipart; extra == 'full'
  34. Requires-Dist: pyyaml; extra == 'full'
  35. Description-Content-Type: text/markdown
  36. <p align="center">
  37. <a href="https://www.starlette.io/"><img width="420px" src="https://raw.githubusercontent.com/encode/starlette/master/docs/img/starlette.png" alt='starlette'></a>
  38. </p>
  39. <p align="center">
  40. <em>✨ The little ASGI framework that shines. ✨</em>
  41. </p>
  42. <p align="center">
  43. <a href="https://github.com/encode/starlette/actions">
  44. <img src="https://github.com/encode/starlette/workflows/Test%20Suite/badge.svg" alt="Build Status">
  45. </a>
  46. <a href="https://pypi.org/project/starlette/">
  47. <img src="https://badge.fury.io/py/starlette.svg" alt="Package version">
  48. </a>
  49. </p>
  50. ---
  51. **Documentation**: [https://www.starlette.io/](https://www.starlette.io/)
  52. ---
  53. # Starlette
  54. Starlette is a lightweight [ASGI][asgi] framework/toolkit,
  55. which is ideal for building async web services in Python.
  56. It is production-ready, and gives you the following:
  57. * A lightweight, low-complexity HTTP web framework.
  58. * WebSocket support.
  59. * In-process background tasks.
  60. * Startup and shutdown events.
  61. * Test client built on `httpx`.
  62. * CORS, GZip, Static Files, Streaming responses.
  63. * Session and Cookie support.
  64. * 100% test coverage.
  65. * 100% type annotated codebase.
  66. * Few hard dependencies.
  67. * Compatible with `asyncio` and `trio` backends.
  68. * Great overall performance [against independent benchmarks][techempower].
  69. ## Requirements
  70. Python 3.7+ (For Python 3.6 support, install version 0.19.1)
  71. ## Installation
  72. ```shell
  73. $ pip3 install starlette
  74. ```
  75. 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/).
  76. ```shell
  77. $ pip3 install uvicorn
  78. ```
  79. ## Example
  80. **example.py**:
  81. ```python
  82. from starlette.applications import Starlette
  83. from starlette.responses import JSONResponse
  84. from starlette.routing import Route
  85. async def homepage(request):
  86. return JSONResponse({'hello': 'world'})
  87. routes = [
  88. Route("/", endpoint=homepage)
  89. ]
  90. app = Starlette(debug=True, routes=routes)
  91. ```
  92. Then run the application using Uvicorn:
  93. ```shell
  94. $ uvicorn example:app
  95. ```
  96. For a more complete example, see [encode/starlette-example](https://github.com/encode/starlette-example).
  97. ## Dependencies
  98. Starlette only requires `anyio`, and the following are optional:
  99. * [`httpx`][httpx] - Required if you want to use the `TestClient`.
  100. * [`jinja2`][jinja2] - Required if you want to use `Jinja2Templates`.
  101. * [`python-multipart`][python-multipart] - Required if you want to support form parsing, with `request.form()`.
  102. * [`itsdangerous`][itsdangerous] - Required for `SessionMiddleware` support.
  103. * [`pyyaml`][pyyaml] - Required for `SchemaGenerator` support.
  104. You can install all of these with `pip3 install starlette[full]`.
  105. ## Framework or Toolkit
  106. Starlette is designed to be used either as a complete framework, or as
  107. an ASGI toolkit. You can use any of its components independently.
  108. ```python
  109. from starlette.responses import PlainTextResponse
  110. async def app(scope, receive, send):
  111. assert scope['type'] == 'http'
  112. response = PlainTextResponse('Hello, world!')
  113. await response(scope, receive, send)
  114. ```
  115. Run the `app` application in `example.py`:
  116. ```shell
  117. $ uvicorn example:app
  118. INFO: Started server process [11509]
  119. INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
  120. ```
  121. Run uvicorn with `--reload` to enable auto-reloading on code changes.
  122. ## Modularity
  123. The modularity that Starlette is designed on promotes building re-usable
  124. components that can be shared between any ASGI framework. This should enable
  125. an ecosystem of shared middleware and mountable applications.
  126. The clean API separation also means it's easier to understand each component
  127. in isolation.
  128. ---
  129. <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>
  130. [asgi]: https://asgi.readthedocs.io/en/latest/
  131. [httpx]: https://www.python-httpx.org/
  132. [jinja2]: https://jinja.palletsprojects.com/
  133. [python-multipart]: https://andrew-d.github.io/python-multipart/
  134. [itsdangerous]: https://pythonhosted.org/itsdangerous/
  135. [sqlalchemy]: https://www.sqlalchemy.org
  136. [pyyaml]: https://pyyaml.org/wiki/PyYAMLDocumentation
  137. [techempower]: https://www.techempower.com/benchmarks/#hw=ph&test=fortune&l=zijzen-sf