diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..3803f97 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,21 @@ +language: python +python: +- '2.7' +- '3.4' +- '3.5' +sudo: false +install: +- pip install -q -r requires/development.txt +script: +- "./setup.py build_sphinx" +deploy: + provider: pypi + user: daveshawley + password: + secure: AFKcQSyfXnZGUAF5jfKZV8R5c+dFyPhJKBqaiVBaLoisOYpPksS4CBof/XTQfcB7lADWVHkIUv4vClmYaBU5CQ7XTJAwUQapDZMtNPiG7LIIxfecBeUI9kv+hnyqtVzzqZ/4cTP4J0+IqrmfePkNZ5QOgI+4pYiA/mvK6oBImx3LGc501vOxaLa9kag75u6J0ZCS0w4hq5LIhZZAWbVn963SZ4ChkAZJ7r2uzudKnQDD5EqJPLqWHzBA90sbnPkD2uin7r1BHHyKyYrxG9WcnSrqs98Hw/5AgypU2KEBS3XxJZqHI4eV5eAeG/pGmu2j51tYWG376Jnv5EaTfcFMYTsoXH2zrQjxQ3QzMi38BVIhQ+wIzcjY8nqVjT9oMpPFa8JEiPnVvES/hzdEFUjocakS/OtlePHy/6So8Dnbx25y4+YS7NnVytH6NEe6NqWuZ74CYQPiH5y+tjWL2P1QUZoka0Io1KsUSC8B+uKJpGrkbip1eQQsOm01zz2wGQ26Rb+Qrzu77iSZ75eZLCQw0zg0w26+SGHOfvB4qWNgspxrnZAeZyZTVFxuSm0yaG1CGj3vIyQD1kdIUE7sAK+XLNQefIUSgRlhP3uf3gczLo65AjnHJVyAfiBjW2M3Ffhu1rudt4DfimYjMKxwN3BFDms//ExgC0uLwaM+OYAGC4I= + distributions: sdist bdist_wheel + on: + tags: true + all_branches: true + repo: dave-shawley/sphinx-swagger + python: 3.5 diff --git a/docs/conf.py b/docs/conf.py index 7fd4d79..d3e7645 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -7,7 +7,9 @@ release = '.'.join(str(v) for v in sphinxswagger.version_info[:2]) version = sphinxswagger.__version__ needs_sphinx = '1.0' -extensions = [] +extensions = [ + 'sphinx.ext.intersphinx', +] master_doc = 'index' html_theme = 'alabaster' @@ -21,3 +23,6 @@ 'github_user': 'dave-shawley', 'github_repo': 'sphinx-swagger', } +intersphinx_mapping = { + 'python': ('https://docs.python.org/3', None), +} diff --git a/docs/history.rst b/docs/history.rst new file mode 100644 index 0000000..d1ac153 --- /dev/null +++ b/docs/history.rst @@ -0,0 +1,9 @@ +Release History +=============== + +`0.0.1`_ (2016 Jun 06) +---------------------- +- Initial release with simple Sphinx writer+builder. + +.. _Next Release: https://github.com/dave-shawley/sphinx-swagger/compare/0.0.1...HEAD +.. _0.0.1: https://github.com/dave-shawley/sphinx-swagger/compare/0.0.0...0.0.1 diff --git a/docs/index.rst b/docs/index.rst index 2340cff..8d6b6c2 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -5,3 +5,4 @@ advanced contributing + history diff --git a/setup.py b/setup.py index f781ec2..7aefdde 100755 --- a/setup.py +++ b/setup.py @@ -24,10 +24,22 @@ def read_requirements(name): setuptools.setup( name='sphinx-swagger', version=sphinxswagger.__version__, + url='https://github.com/dave-shawley/sphinx-swagger', description='Generate swagger definitions from sphinx docs', long_description='\n'+open('README.rst').read(), author='Dave Shawley', author_email='daveshawley+python@gmail.com', packages=['sphinxswagger'], install_requires=read_requirements('installation.txt'), + classifiers=[ + 'Intended Audience :: Developers', + 'License :: OSI Approved :: BSD License', + 'Operating System :: OS Independent', + 'Programming Language :: Python', + 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.4', + 'Framework :: Sphinx :: Extension', + ], ) diff --git a/sphinxswagger/__init__.py b/sphinxswagger/__init__.py index 8b65921..e7c3760 100644 --- a/sphinxswagger/__init__.py +++ b/sphinxswagger/__init__.py @@ -1,4 +1,4 @@ -version_info = (0, 0, 0) +version_info = (0, 0, 1) __version__ = '.'.join(str(v) for v in version_info) diff --git a/sphinxswagger/writer.py b/sphinxswagger/writer.py index fd215ab..de1958a 100644 --- a/sphinxswagger/writer.py +++ b/sphinxswagger/writer.py @@ -83,11 +83,12 @@ def depart_desc(self, node): return # TODO remove this ... useful for debugging only - with open('out-{}.json'.format(len(self._swagger_doc._paths)), 'w') as f: - data = _generate_debug_tree(node) - data['signature'] = desc_signature['path'] - data['url_template'] = url_template - json.dump(data, f, indent=2) + # debug_name = 'out-{}.json'.format(len(self._swagger_doc._paths)) + # with open(debug_name, 'w') as f: + # data = _generate_debug_tree(node) + # data['signature'] = desc_signature['path'] + # data['url_template'] = url_template + # json.dump(data, f, indent=2) # END TODO default = 'default' @@ -216,7 +217,7 @@ def _generate_status_codes(body): :rtype: tuple """ if len(body.children) > 1 or not isinstance(body[0], nodes.bullet_list): - return None + return bullet_list = body[0] @@ -314,42 +315,6 @@ def _convert_url(url): 'after {} tries'.format(start_url, attempt)) -""" -{"swagger":"2.0" -,"info":{"title":"Title String" - ,"description":"in Github-Flavored Markdown" - ,"termsOfService":"http://swagger.io/terms/" - ,"contact":{"name":"$AUTHOR_NAME" - ,"email":"api@example.com" - ,"url":"http://api.aweber.com/"} - ,"license":{"name":"BSD" - ,"url":"http://license.url"} - ,"version":"$PROJECT_VERSION"} -,"host":"localhost:8000" -,"basePath":"/" -,"schemes":["http"] -,"consumes":["application/json"] -,"produces":["application/json"] -,"paths":{"/status":{"get":{"description":"" - ,"responses":{"200":{"description":"the application is functional" - ,"schema":{"$ref":"#/definitions/Status"}}}}}} -,"definitions":{"Status":{"type":"object" - ,"description":"Application status information" - ,"required":["application","version","status"] - ,"properties":{"application":{"type":"string" - ,"description":"the name of the service"} - ,"version":{"type":"string" - ,"description":"the deployed application version"} - ,"status":{"type":"string" - ,"description":"status of the application"}}}} -,"parameters":{} -,"responses":{} -,"securityDefinitions":{} -,"security":[] -,"tags":[]} -""" - - class SwaggerDocument(object): def __init__(self):