METADATA 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339
  1. Metadata-Version: 2.3
  2. Name: apispec
  3. Version: 6.8.1
  4. Summary: A pluggable API specification generator. Currently supports the OpenAPI Specification (f.k.a. the Swagger specification).
  5. Keywords: apispec,swagger,openapi,specification,oas,documentation,spec,rest,api
  6. Author-email: Steven Loria <sloria1@gmail.com>
  7. Maintainer-email: Steven Loria <sloria1@gmail.com>, Jérôme Lafréchoux <jerome@jolimont.fr>
  8. Requires-Python: >=3.9
  9. Description-Content-Type: text/x-rst
  10. Classifier: Development Status :: 5 - Production/Stable
  11. Classifier: Intended Audience :: Developers
  12. Classifier: License :: OSI Approved :: MIT License
  13. Classifier: Programming Language :: Python :: 3
  14. Classifier: Programming Language :: Python :: 3.9
  15. Classifier: Programming Language :: Python :: 3.10
  16. Classifier: Programming Language :: Python :: 3.11
  17. Classifier: Programming Language :: Python :: 3.12
  18. Classifier: Programming Language :: Python :: 3.13
  19. Requires-Dist: packaging>=21.3
  20. Requires-Dist: apispec[tests] ; extra == "dev"
  21. Requires-Dist: tox ; extra == "dev"
  22. Requires-Dist: pre-commit>=3.5,<5.0 ; extra == "dev"
  23. Requires-Dist: apispec[marshmallow] ; extra == "docs"
  24. Requires-Dist: pyyaml==6.0.2 ; extra == "docs"
  25. Requires-Dist: sphinx==8.1.3 ; extra == "docs"
  26. Requires-Dist: sphinx-issues==5.0.0 ; extra == "docs"
  27. Requires-Dist: sphinx-rtd-theme==3.0.2 ; extra == "docs"
  28. Requires-Dist: marshmallow>=3.18.0 ; extra == "marshmallow"
  29. Requires-Dist: apispec[yaml, marshmallow] ; extra == "tests"
  30. Requires-Dist: openapi-spec-validator==0.7.1 ; extra == "tests"
  31. Requires-Dist: pytest ; extra == "tests"
  32. Requires-Dist: PyYAML>=3.10 ; extra == "yaml"
  33. Project-URL: Changelog, https://apispec.readthedocs.io/en/latest/changelog.html
  34. Project-URL: Funding, https://opencollective.com/marshmallow
  35. Project-URL: Issues, https://github.com/marshmallow-code/apispec/issues
  36. Project-URL: Source, https://github.com/marshmallow-code/apispec
  37. Project-URL: Tidelift, https://tidelift.com/subscription/pkg/pypi-apispec?utm_source=pypi-apispec&utm_medium=pypi
  38. Provides-Extra: dev
  39. Provides-Extra: docs
  40. Provides-Extra: marshmallow
  41. Provides-Extra: tests
  42. Provides-Extra: yaml
  43. *******
  44. apispec
  45. *******
  46. |pypi| |build-status| |docs| |marshmallow-support| |openapi|
  47. .. |pypi| image:: https://badgen.net/pypi/v/apispec
  48. :target: https://pypi.org/project/apispec/
  49. :alt: PyPI package
  50. .. |build-status| image:: https://github.com/marshmallow-code/apispec/actions/workflows/build-release.yml/badge.svg
  51. :target: https://github.com/marshmallow-code/webargs/actions/workflows/build-release.yml
  52. :alt: Build status
  53. .. |docs| image:: https://readthedocs.org/projects/apispec/badge/
  54. :target: https://apispec.readthedocs.io/
  55. :alt: Documentation
  56. .. |marshmallow-support| image:: https://badgen.net/badge/marshmallow/3,4?list=1
  57. :target: https://marshmallow.readthedocs.io/en/latest/upgrading.html
  58. :alt: marshmallow 3|4 compatible
  59. .. |openapi| image:: https://badgen.net/badge/OAS/2,3?list=1&color=cyan
  60. :target: https://github.com/OAI/OpenAPI-Specification
  61. :alt: OpenAPI Specification 2/3 compatible
  62. A pluggable API specification generator. Currently supports the `OpenAPI Specification <https://github.com/OAI/OpenAPI-Specification>`_ (f.k.a. the Swagger specification).
  63. Features
  64. ========
  65. - Supports the OpenAPI Specification (versions 2 and 3)
  66. - Framework-agnostic
  67. - Built-in support for `marshmallow <https://marshmallow.readthedocs.io/>`_
  68. - Utilities for parsing docstrings
  69. Installation
  70. ============
  71. ::
  72. $ pip install -U apispec
  73. When using the marshmallow plugin, ensure a compatible marshmallow version is used: ::
  74. $ pip install -U apispec[marshmallow]
  75. Example Application
  76. ===================
  77. .. code-block:: python
  78. from apispec import APISpec
  79. from apispec.ext.marshmallow import MarshmallowPlugin
  80. from apispec_webframeworks.flask import FlaskPlugin
  81. from flask import Flask
  82. from marshmallow import Schema, fields
  83. # Create an APISpec
  84. spec = APISpec(
  85. title="Swagger Petstore",
  86. version="1.0.0",
  87. openapi_version="3.0.2",
  88. plugins=[FlaskPlugin(), MarshmallowPlugin()],
  89. )
  90. # Optional marshmallow support
  91. class CategorySchema(Schema):
  92. id = fields.Int()
  93. name = fields.Str(required=True)
  94. class PetSchema(Schema):
  95. category = fields.List(fields.Nested(CategorySchema))
  96. name = fields.Str()
  97. # Optional security scheme support
  98. api_key_scheme = {"type": "apiKey", "in": "header", "name": "X-API-Key"}
  99. spec.components.security_scheme("ApiKeyAuth", api_key_scheme)
  100. # Optional Flask support
  101. app = Flask(__name__)
  102. @app.route("/random")
  103. def random_pet():
  104. """A cute furry animal endpoint.
  105. ---
  106. get:
  107. description: Get a random pet
  108. security:
  109. - ApiKeyAuth: []
  110. responses:
  111. 200:
  112. content:
  113. application/json:
  114. schema: PetSchema
  115. """
  116. pet = get_random_pet()
  117. return PetSchema().dump(pet)
  118. # Register the path and the entities within it
  119. with app.test_request_context():
  120. spec.path(view=random_pet)
  121. Generated OpenAPI Spec
  122. ----------------------
  123. .. code-block:: python
  124. import json
  125. print(json.dumps(spec.to_dict(), indent=2))
  126. # {
  127. # "paths": {
  128. # "/random": {
  129. # "get": {
  130. # "description": "Get a random pet",
  131. # "security": [
  132. # {
  133. # "ApiKeyAuth": []
  134. # }
  135. # ],
  136. # "responses": {
  137. # "200": {
  138. # "content": {
  139. # "application/json": {
  140. # "schema": {
  141. # "$ref": "#/components/schemas/Pet"
  142. # }
  143. # }
  144. # }
  145. # }
  146. # }
  147. # }
  148. # }
  149. # },
  150. # "tags": [],
  151. # "info": {
  152. # "title": "Swagger Petstore",
  153. # "version": "1.0.0"
  154. # },
  155. # "openapi": "3.0.2",
  156. # "components": {
  157. # "parameters": {},
  158. # "responses": {},
  159. # "schemas": {
  160. # "Category": {
  161. # "type": "object",
  162. # "properties": {
  163. # "name": {
  164. # "type": "string"
  165. # },
  166. # "id": {
  167. # "type": "integer",
  168. # "format": "int32"
  169. # }
  170. # },
  171. # "required": [
  172. # "name"
  173. # ]
  174. # },
  175. # "Pet": {
  176. # "type": "object",
  177. # "properties": {
  178. # "name": {
  179. # "type": "string"
  180. # },
  181. # "category": {
  182. # "type": "array",
  183. # "items": {
  184. # "$ref": "#/components/schemas/Category"
  185. # }
  186. # }
  187. # }
  188. # }
  189. # "securitySchemes": {
  190. # "ApiKeyAuth": {
  191. # "type": "apiKey",
  192. # "in": "header",
  193. # "name": "X-API-Key"
  194. # }
  195. # }
  196. # }
  197. # }
  198. # }
  199. print(spec.to_yaml())
  200. # components:
  201. # parameters: {}
  202. # responses: {}
  203. # schemas:
  204. # Category:
  205. # properties:
  206. # id: {format: int32, type: integer}
  207. # name: {type: string}
  208. # required: [name]
  209. # type: object
  210. # Pet:
  211. # properties:
  212. # category:
  213. # items: {$ref: '#/components/schemas/Category'}
  214. # type: array
  215. # name: {type: string}
  216. # type: object
  217. # securitySchemes:
  218. # ApiKeyAuth:
  219. # in: header
  220. # name: X-API-KEY
  221. # type: apiKey
  222. # info: {title: Swagger Petstore, version: 1.0.0}
  223. # openapi: 3.0.2
  224. # paths:
  225. # /random:
  226. # get:
  227. # description: Get a random pet
  228. # responses:
  229. # 200:
  230. # content:
  231. # application/json:
  232. # schema: {$ref: '#/components/schemas/Pet'}
  233. # security:
  234. # - ApiKeyAuth: []
  235. # tags: []
  236. Documentation
  237. =============
  238. Documentation is available at https://apispec.readthedocs.io/ .
  239. Ecosystem
  240. =========
  241. A list of apispec-related libraries can be found at the GitHub wiki here:
  242. https://github.com/marshmallow-code/apispec/wiki/Ecosystem
  243. Support apispec
  244. ===============
  245. apispec is maintained by a group of
  246. `volunteers <https://apispec.readthedocs.io/en/latest/authors.html>`_.
  247. If you'd like to support the future of the project, please consider
  248. contributing to our Open Collective:
  249. .. image:: https://opencollective.com/marshmallow/donate/button.png
  250. :target: https://opencollective.com/marshmallow
  251. :width: 200
  252. :alt: Donate to our collective
  253. Professional Support
  254. ====================
  255. Professionally-supported apispec is available through the
  256. `Tidelift Subscription <https://tidelift.com/subscription/pkg/pypi-apispec?utm_source=pypi-apispec&utm_medium=referral&utm_campaign=readme>`_.
  257. Tidelift gives software development teams a single source for purchasing and maintaining their software,
  258. with professional-grade assurances from the experts who know it best,
  259. while seamlessly integrating with existing tools. [`Get professional support`_]
  260. .. _`Get professional support`: https://tidelift.com/subscription/pkg/pypi-apispec?utm_source=pypi-apispec&utm_medium=referral&utm_campaign=readme
  261. .. image:: https://user-images.githubusercontent.com/2379650/45126032-50b69880-b13f-11e8-9c2c-abd16c433495.png
  262. :target: https://tidelift.com/subscription/pkg/pypi-apispec?utm_source=pypi-apispec&utm_medium=referral&utm_campaign=readme
  263. :alt: Get supported apispec with Tidelift
  264. Security Contact Information
  265. ============================
  266. To report a security vulnerability, please use the
  267. `Tidelift security contact <https://tidelift.com/security>`_.
  268. Tidelift will coordinate the fix and disclosure.
  269. Project Links
  270. =============
  271. - Docs: https://apispec.readthedocs.io/
  272. - Changelog: https://apispec.readthedocs.io/en/latest/changelog.html
  273. - Contributing Guidelines: https://apispec.readthedocs.io/en/latest/contributing.html
  274. - PyPI: https://pypi.python.org/pypi/apispec
  275. - Issues: https://github.com/marshmallow-code/apispec/issues
  276. License
  277. =======
  278. MIT licensed. See the bundled `LICENSE <https://github.com/marshmallow-code/apispec/blob/dev/LICENSE>`_ file for more details.