Name | apispec-webframeworks JSON |
Version |
1.0.0
JSON |
| download |
home_page | |
Summary | Web framework plugins for apispec. |
upload_time | 2024-01-17 16:13:35 |
maintainer | |
docs_url | None |
author | |
requires_python | >=3.8 |
license | |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
*********************
apispec-webframeworks
*********************
.. image:: https://badgen.net/pypi/v/apispec-webframeworks
:target: https://pypi.org/project/apispec-webframeworks/
:alt: PyPI version
.. 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
.. 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.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": "",
"name": "apispec-webframeworks",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "Steven Loria <sloria1@gmail.com>",
"keywords": "",
"author": "",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/47/a0/aa9db329f9accf1a8f6ada6d5f84e25d2d51f1f046ec60e8f7b95285b854/apispec_webframeworks-1.0.0.tar.gz",
"platform": null,
"description": "*********************\napispec-webframeworks\n*********************\n\n.. image:: https://badgen.net/pypi/v/apispec-webframeworks\n :target: https://pypi.org/project/apispec-webframeworks/\n :alt: PyPI version\n\n.. 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.. 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.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": "",
"summary": "Web framework plugins for apispec.",
"version": "1.0.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": "775d1609a842753667fa1afdbd5e19f73aa7001eeaf101a1fdaee1701a11935e",
"md5": "99919ab2d5de7f36c7956b66a6ab7d38",
"sha256": "7ca64ee5cdac25f6eb686744d179a4946db9185388d1986c9468e4f52762febb"
},
"downloads": -1,
"filename": "apispec_webframeworks-1.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "99919ab2d5de7f36c7956b66a6ab7d38",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 8066,
"upload_time": "2024-01-17T16:13:33",
"upload_time_iso_8601": "2024-01-17T16:13:33.922095Z",
"url": "https://files.pythonhosted.org/packages/77/5d/1609a842753667fa1afdbd5e19f73aa7001eeaf101a1fdaee1701a11935e/apispec_webframeworks-1.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "47a0aa9db329f9accf1a8f6ada6d5f84e25d2d51f1f046ec60e8f7b95285b854",
"md5": "b594ddc80e8b7f2cc5a6528ba3180aa5",
"sha256": "024965e69d40b8245165070668c9df6e65cd010ed333a5fb648472ff656bf019"
},
"downloads": -1,
"filename": "apispec_webframeworks-1.0.0.tar.gz",
"has_sig": false,
"md5_digest": "b594ddc80e8b7f2cc5a6528ba3180aa5",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 9938,
"upload_time": "2024-01-17T16:13:35",
"upload_time_iso_8601": "2024-01-17T16:13:35.014559Z",
"url": "https://files.pythonhosted.org/packages/47/a0/aa9db329f9accf1a8f6ada6d5f84e25d2d51f1f046ec60e8f7b95285b854/apispec_webframeworks-1.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-01-17 16:13:35",
"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"
}