Clean up for publish to pypi
parent
8883894775
commit
71b3fd2895
|
|
@ -54,6 +54,7 @@
|
|||
</option>
|
||||
</inspection_tool>
|
||||
<inspection_tool class="PyShadowingNamesInspection" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="PyUnresolvedReferencesInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="PyUnusedLocalInspection" enabled="false" level="WEAK WARNING" enabled_by_default="false">
|
||||
<option name="ignoreTupleUnpacking" value="true" />
|
||||
<option name="ignoreLambdaParameters" value="true" />
|
||||
|
|
|
|||
36
README.rst
36
README.rst
|
|
@ -14,7 +14,8 @@ Compatible with
|
|||
- **Django**: 1.11, 2.0
|
||||
- **Python**: 2.7, 3.4, 3.5, 3.6
|
||||
|
||||
**Source**: https://github.com/axnsan12/drf-swagger/ |br|
|
||||
**Source**: https://github.com/axnsan12/drf-swagger/
|
||||
|
||||
**Documentation**: https://drf-swagger.readthedocs.io/en/latest/
|
||||
|
||||
********
|
||||
|
|
@ -34,22 +35,21 @@ Features
|
|||
`swagger-spec-validator <https://github.com/Yelp/swagger_spec_validator>`__ or
|
||||
`flex <https://github.com/pipermerriam/flex>`__
|
||||
|
||||
|
||||
.. figure:: https://raw.githubusercontent.com/axnsan12/drf-swagger/docs/screenshots/redoc-nested-response.png
|
||||
.. figure:: https://raw.githubusercontent.com/axnsan12/drf-swagger/1.0.1/screenshots/redoc-nested-response.png
|
||||
:width: 100%
|
||||
:figwidth: image
|
||||
:alt: redoc screenshot
|
||||
|
||||
**Fully nested request and response schemas.**
|
||||
|
||||
.. figure:: https://raw.githubusercontent.com/axnsan12/drf-swagger/docs/screenshots/swagger-ui-list.png
|
||||
.. figure:: https://raw.githubusercontent.com/axnsan12/drf-swagger/1.0.1/screenshots/swagger-ui-list.png
|
||||
:width: 100%
|
||||
:figwidth: image
|
||||
:alt: swagger-ui screenshot
|
||||
|
||||
**Choose between redoc and swagger-ui.**
|
||||
|
||||
.. figure:: https://raw.githubusercontent.com/axnsan12/drf-swagger/docs/screenshots/swagger-ui-models.png
|
||||
.. figure:: https://raw.githubusercontent.com/axnsan12/drf-swagger/1.0.1/screenshots/swagger-ui-models.png
|
||||
:width: 100%
|
||||
:figwidth: image
|
||||
:alt: model definitions screenshot
|
||||
|
|
@ -68,15 +68,27 @@ Table of contents
|
|||
Usage
|
||||
*****
|
||||
|
||||
.. _readme-quickstart:
|
||||
0. Installation
|
||||
===============
|
||||
|
||||
1. Quickstart
|
||||
=============
|
||||
The preferred instalation method is directly from pypi:
|
||||
|
||||
.. code:: console
|
||||
|
||||
pip install drf-swagger
|
||||
|
||||
Additionally, if you want to use the built-in validation mechanisms (see `4. Validation`_), you need to install
|
||||
some extra requirements:
|
||||
|
||||
.. code:: console
|
||||
|
||||
pip install drf-swagger[validation]
|
||||
|
||||
.. _readme-quickstart:
|
||||
|
||||
1. Quickstart
|
||||
=============
|
||||
|
||||
In ``settings.py``:
|
||||
|
||||
.. code:: python
|
||||
|
|
@ -222,7 +234,7 @@ it still conforms to OpenAPI 2.0. To this end, validation is provided at the gen
|
|||
libraries, and can be activated by passing :python:`validators=['ssv', 'flex']` to ``get_schema_view``; if the generated
|
||||
schema is not valid, a :python:`SwaggerValidationError` is raised by the handling codec.
|
||||
|
||||
**Warning:** This internal validation can slow down your server. |br|
|
||||
**Warning:** This internal validation can slow down your server.
|
||||
Caching can mitigate the speed impact of validation.
|
||||
|
||||
The provided validation will catch syntactic errors, but more subtle violations of the spec might slip by them. To
|
||||
|
|
@ -258,8 +270,6 @@ If your schema is not accessible from the internet, you can run a local copy of
|
|||
$ curl http://localhost:8189/debug?url=http://test.local:8002/swagger/?format=openapi
|
||||
{}
|
||||
|
||||
|
||||
|
||||
Using ``swagger-cli``
|
||||
---------------------
|
||||
|
||||
|
|
@ -349,7 +359,3 @@ https://drf-swagger.readthedocs.io/en/latest/
|
|||
|
||||
.. |nbsp| unicode:: 0xA0
|
||||
:trim:
|
||||
|
||||
.. |br| raw:: html
|
||||
|
||||
<br />
|
||||
|
|
|
|||
14
docs/conf.py
14
docs/conf.py
|
|
@ -7,6 +7,7 @@ import os
|
|||
import sys
|
||||
|
||||
import sphinx_rtd_theme
|
||||
from pkg_resources import get_distribution
|
||||
|
||||
# -- General configuration ------------------------------------------------
|
||||
|
||||
|
|
@ -39,11 +40,12 @@ author = 'Cristi V.'
|
|||
# The version info for the project you're documenting, acts as replacement for
|
||||
# |version| and |release|, also used in various other places throughout the
|
||||
# built documents.
|
||||
#
|
||||
# The short X.Y version.
|
||||
version = '1.0'
|
||||
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
release = '1.0.0'
|
||||
release = get_distribution('drf_swagger').version
|
||||
|
||||
# The short X.Y.Z version.
|
||||
version = '.'.join(release.split('.')[:3])
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
|
|
@ -194,11 +196,11 @@ nitpick_ignore = [
|
|||
sys.path.insert(0, os.path.abspath('../testproj'))
|
||||
os.putenv('DJANGO_SETTINGS_MODULE', 'testproj.settings')
|
||||
|
||||
from django.conf import settings
|
||||
from django.conf import settings # noqa: E402
|
||||
|
||||
settings.configure()
|
||||
|
||||
import drf_swagger.views
|
||||
import drf_swagger.views # noqa: E402
|
||||
|
||||
# instantiate a SchemaView in the views module to make it available to autodoc
|
||||
drf_swagger.views.SchemaView = drf_swagger.views.get_schema_view(None)
|
||||
|
|
|
|||
|
|
@ -1,3 +1,6 @@
|
|||
# requirements for local development
|
||||
tox>=2.9.1
|
||||
tox-battery>=0.5
|
||||
|
||||
# do not unpin this (see setup.py)
|
||||
setuptools_scm==1.15.6
|
||||
|
|
|
|||
15
setup.py
15
setup.py
|
|
@ -5,6 +5,16 @@ import os
|
|||
|
||||
from setuptools import setup, find_packages
|
||||
|
||||
try:
|
||||
# see https://github.com/pypa/setuptools_scm/issues/190, setuptools_scm includes ALL versioned files from the git
|
||||
# repo into the sdist by default, and there is no easy way to provide an opt-out;
|
||||
# this hack is ugly but does the job; because this is not really a documented interface of the module,
|
||||
# the setuptools_scm version should remain pinned to ensure it keeps working
|
||||
import setuptools_scm.integration
|
||||
setuptools_scm.integration.find_files = lambda _: []
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
|
||||
def read_req(req_file):
|
||||
with open(os.path.join('requirements', req_file)) as req:
|
||||
|
|
@ -19,11 +29,12 @@ requirements_validation = read_req('validation.txt')
|
|||
|
||||
setup(
|
||||
name='drf-swagger',
|
||||
version='1.0.0rc1',
|
||||
use_scm_version=True,
|
||||
packages=find_packages('src', include=['drf_swagger']),
|
||||
package_dir={'': 'src'},
|
||||
include_package_data=True,
|
||||
install_requires=requirements,
|
||||
setup_requires=['setuptools_scm==1.15.6'],
|
||||
extras_require={
|
||||
'validation': requirements_validation,
|
||||
},
|
||||
|
|
@ -40,7 +51,7 @@ setup(
|
|||
'License :: OSI Approved :: BSD License',
|
||||
'Development Status :: 4 - Beta',
|
||||
'Operating System :: OS Independent',
|
||||
'Environment :: Web Environment'
|
||||
'Environment :: Web Environment',
|
||||
'Programming Language :: Python',
|
||||
'Programming Language :: Python :: 2',
|
||||
'Programming Language :: Python :: 2.7',
|
||||
|
|
|
|||
|
|
@ -1,4 +1,11 @@
|
|||
# coding=utf-8
|
||||
from pkg_resources import get_distribution, DistributionNotFound
|
||||
|
||||
__author__ = """Cristi V."""
|
||||
__email__ = 'cristi@cvjd.me'
|
||||
__version__ = '1.0.0rc1'
|
||||
|
||||
try:
|
||||
__version__ = get_distribution(__name__).version
|
||||
except DistributionNotFound:
|
||||
# package is not installed
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -178,8 +178,8 @@ class OpenAPISchemaGenerator(object):
|
|||
# Attempt to infer a field description if possible.
|
||||
try:
|
||||
model_field = model._meta.get_field(variable)
|
||||
except Exception:
|
||||
model_field = None # pragma: no cover
|
||||
except Exception: # pragma: no cover
|
||||
model_field = None
|
||||
|
||||
if model_field is not None and model_field.help_text:
|
||||
description = force_text(model_field.help_text)
|
||||
|
|
|
|||
Loading…
Reference in New Issue