Name | apispec-webframeworks JSON |
Version |
1.2.0
JSON |
| download |
home_page | None |
Summary | Web framework plugins for apispec. |
upload_time | 2024-09-16 19:01:18 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.8 |
license | None |
keywords |
|
VCS |
 |
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
*********************
apispec-webframeworks
*********************
|pypi| |build-status| |marshmallow3|
.. |pypi| image:: https://badgen.net/pypi/v/apispec-webframeworks
:target: https://pypi.org/project/apispec-webframeworks/
:alt: PyPI package
.. |build-status| image:: https://github.com/marshmallow-code/apispec-webframeworks/actions/workflows/build-release.yml/badge.svg
:target: https://github.com/marshmallow-code/apispec-webframeworks/actions/workflows/build-release.yml
:alt: Build status
.. |marshmallow3| image:: https://badgen.net/badge/marshmallow/3?
:target: https://marshmallow.readthedocs.io/en/latest/upgrading.html
:alt: marshmallow 3 compatible
`apispec <https://github.com/marshmallow-code/apispec>`_ plugins for
integrating with various web frameworks.
These plugins used to be in ``apispec.ext`` but have since
been moved to their own package.
Included plugins:
* ``apispec_webframeworks.aiohttp``
* ``apispec_webframeworks.bottle``
* ``apispec_webframeworks.flask``
* ``apispec_webframeworks.tornado``
Migration from ``apispec<1.0.0``
================================
To migrate from older versions of apispec, install this package
with
.. code-block:: console
pip install apispec-webframeworks
Change your imports, like so:
.. code-block:: python
# apispec<1.0.0
from apispec.ext.flask import FlaskPlugin
# apispec>=1.0.0
from apispec_webframeworks.flask import FlaskPlugin
Example Usage
=============
.. code-block:: python
from flask import Flask
from apispec import APISpec
from apispec.ext.marshmallow import MarshmallowPlugin
from apispec_webframeworks.flask import FlaskPlugin
from marshmallow import Schema, fields
spec = APISpec(
title="Gisty",
version="1.0.0",
info=dict(description="A minimal gist API"),
plugins=[FlaskPlugin(), MarshmallowPlugin()],
)
app = Flask(__name__)
class GistParameter(Schema):
gist_id = fields.Int()
class GistSchema(Schema):
id = fields.Int()
content = fields.Str()
@app.route("/gists/<gist_id>")
def gist_detail(gist_id):
"""Gist detail view.
---
get:
parameters:
- in: path
schema: GistParameter
responses:
200:
schema: GistSchema
"""
return "details about gist {}".format(gist_id)
# Since `path` inspects the view and its route,
# we need to be in a Flask request context
with app.test_request_context():
spec.path(view=gist_detail)
Documentation
=============
For documentation for a specific plugin, see its module docstring.
Development
===========
* Clone and cd into this repo
* Create and activate a virtual environment
* Install this package (in editable mode) and the development
dependencies
::
$ pip install '.[dev]'
* Install pre-commit hooks
::
$ pre-commit install
Running tests
-------------
To run all tests: ::
$ pytest
To run syntax checks: ::
$ tox -e lint
(Optional) To run tests in all supported Python versions in their own virtual environments (must have each interpreter installed): ::
$ tox
License
=======
MIT licensed. See the bundled `LICENSE <https://github.com/marshmallow-code/apispec_webframeworks/blob/master/LICENSE>`_ file for more details.
Raw data
{
"_id": null,
"home_page": null,
"name": "apispec-webframeworks",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "Steven Loria <sloria1@gmail.com>",
"keywords": null,
"author": null,
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/f9/1f/8d98328269a2507b6cfe37e8a70725d168626615865dc7aec30e8720c495/apispec_webframeworks-1.2.0.tar.gz",
"platform": null,
"description": "*********************\napispec-webframeworks\n*********************\n\n|pypi| |build-status| |marshmallow3|\n\n.. |pypi| image:: https://badgen.net/pypi/v/apispec-webframeworks\n :target: https://pypi.org/project/apispec-webframeworks/\n :alt: PyPI package\n\n.. |build-status| image:: https://github.com/marshmallow-code/apispec-webframeworks/actions/workflows/build-release.yml/badge.svg\n :target: https://github.com/marshmallow-code/apispec-webframeworks/actions/workflows/build-release.yml\n :alt: Build status\n\n.. |marshmallow3| image:: https://badgen.net/badge/marshmallow/3?\n :target: https://marshmallow.readthedocs.io/en/latest/upgrading.html\n :alt: marshmallow 3 compatible\n\n`apispec <https://github.com/marshmallow-code/apispec>`_ plugins for\nintegrating with various web frameworks.\n\nThese plugins used to be in ``apispec.ext`` but have since\nbeen moved to their own package.\n\n\nIncluded plugins:\n\n* ``apispec_webframeworks.aiohttp``\n* ``apispec_webframeworks.bottle``\n* ``apispec_webframeworks.flask``\n* ``apispec_webframeworks.tornado``\n\nMigration from ``apispec<1.0.0``\n================================\n\nTo migrate from older versions of apispec, install this package\nwith\n\n.. code-block:: console\n\n pip install apispec-webframeworks\n\n\nChange your imports, like so:\n\n.. code-block:: python\n\n # apispec<1.0.0\n from apispec.ext.flask import FlaskPlugin\n\n # apispec>=1.0.0\n from apispec_webframeworks.flask import FlaskPlugin\n\nExample Usage\n=============\n\n.. code-block:: python\n\n from flask import Flask\n from apispec import APISpec\n from apispec.ext.marshmallow import MarshmallowPlugin\n from apispec_webframeworks.flask import FlaskPlugin\n from marshmallow import Schema, fields\n\n spec = APISpec(\n title=\"Gisty\",\n version=\"1.0.0\",\n info=dict(description=\"A minimal gist API\"),\n plugins=[FlaskPlugin(), MarshmallowPlugin()],\n )\n\n\n app = Flask(__name__)\n\n\n class GistParameter(Schema):\n gist_id = fields.Int()\n\n\n class GistSchema(Schema):\n id = fields.Int()\n content = fields.Str()\n\n\n @app.route(\"/gists/<gist_id>\")\n def gist_detail(gist_id):\n \"\"\"Gist detail view.\n ---\n get:\n parameters:\n - in: path\n schema: GistParameter\n responses:\n 200:\n schema: GistSchema\n \"\"\"\n return \"details about gist {}\".format(gist_id)\n\n\n # Since `path` inspects the view and its route,\n # we need to be in a Flask request context\n with app.test_request_context():\n spec.path(view=gist_detail)\n\nDocumentation\n=============\n\nFor documentation for a specific plugin, see its module docstring.\n\n\nDevelopment\n===========\n\n* Clone and cd into this repo\n* Create and activate a virtual environment\n* Install this package (in editable mode) and the development\n dependencies\n\n::\n\n $ pip install '.[dev]'\n\n* Install pre-commit hooks\n\n::\n\n $ pre-commit install\n\n\nRunning tests\n-------------\n\nTo run all tests: ::\n\n $ pytest\n\nTo run syntax checks: ::\n\n $ tox -e lint\n\n(Optional) To run tests in all supported Python versions in their own virtual environments (must have each interpreter installed): ::\n\n $ tox\n\nLicense\n=======\n\nMIT licensed. See the bundled `LICENSE <https://github.com/marshmallow-code/apispec_webframeworks/blob/master/LICENSE>`_ file for more details.\n\n",
"bugtrack_url": null,
"license": null,
"summary": "Web framework plugins for apispec.",
"version": "1.2.0",
"project_urls": {
"Funding": "https://opencollective.com/marshmallow",
"Issues": "https://github.com/marshmallow-code/apispec-webframeworks/issues",
"Source": "https://github.com/marshmallow-code/apispec-webframeworks"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "712c5aa396a3bca60de3b3f419ea770b8087d52aac5221bf15ddcd9b48d61d3c",
"md5": "c9ea23bfa781cfa17ae1bd5da256f082",
"sha256": "68aea0d1eeb3caeeacc7d6772a48c59c8b60b1a88d0bd51529d94597ccf33116"
},
"downloads": -1,
"filename": "apispec_webframeworks-1.2.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "c9ea23bfa781cfa17ae1bd5da256f082",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 9119,
"upload_time": "2024-09-16T19:01:16",
"upload_time_iso_8601": "2024-09-16T19:01:16.402198Z",
"url": "https://files.pythonhosted.org/packages/71/2c/5aa396a3bca60de3b3f419ea770b8087d52aac5221bf15ddcd9b48d61d3c/apispec_webframeworks-1.2.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "f91f8d98328269a2507b6cfe37e8a70725d168626615865dc7aec30e8720c495",
"md5": "75e31c1ac9d06ffa78246926b3d95edf",
"sha256": "5689288c266a2713c2f516eacc14ea2fec9b21f193edc8f659c770342b97fd81"
},
"downloads": -1,
"filename": "apispec_webframeworks-1.2.0.tar.gz",
"has_sig": false,
"md5_digest": "75e31c1ac9d06ffa78246926b3d95edf",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 10837,
"upload_time": "2024-09-16T19:01:18",
"upload_time_iso_8601": "2024-09-16T19:01:18.051631Z",
"url": "https://files.pythonhosted.org/packages/f9/1f/8d98328269a2507b6cfe37e8a70725d168626615865dc7aec30e8720c495/apispec_webframeworks-1.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-16 19:01:18",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "marshmallow-code",
"github_project": "apispec-webframeworks",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"tox": true,
"lcname": "apispec-webframeworks"
}