From bdba36243a7457fa862a11b263f96290e5dbe536 Mon Sep 17 00:00:00 2001 From: Dave Shawley <daveshawley@gmail.com> Date: Mon, 6 Jun 2016 07:21:10 -0400 Subject: [PATCH 1/6] Fix Python 2 nit. --- sphinxswagger/writer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sphinxswagger/writer.py b/sphinxswagger/writer.py index fd215ab..ac0d941 100644 --- a/sphinxswagger/writer.py +++ b/sphinxswagger/writer.py @@ -216,7 +216,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] From 6aa65fd8bad421367e792655ac788282cb162c25 Mon Sep 17 00:00:00 2001 From: Dave Shawley <daveshawley@gmail.com> Date: Mon, 6 Jun 2016 07:25:12 -0400 Subject: [PATCH 2/6] Remove some debug code and sample strings. I didn't really "remove" the code as much as comment it out. --- sphinxswagger/writer.py | 47 ++++++----------------------------------- 1 file changed, 6 insertions(+), 41 deletions(-) diff --git a/sphinxswagger/writer.py b/sphinxswagger/writer.py index ac0d941..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' @@ -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): From 0ae1adc63f234e70e9de3d9df401d71518490f49 Mon Sep 17 00:00:00 2001 From: Dave Shawley <daveshawley@gmail.com> Date: Mon, 6 Jun 2016 07:35:24 -0400 Subject: [PATCH 3/6] Put some polish on the documentation. --- docs/conf.py | 7 ++++++- docs/history.rst | 9 +++++++++ docs/index.rst | 1 + 3 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 docs/history.rst 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 From 8e1b3f90ffd691930f2cb92914f31628c472f869 Mon Sep 17 00:00:00 2001 From: Dave Shawley <daveshawley@gmail.com> Date: Mon, 6 Jun 2016 07:38:53 -0400 Subject: [PATCH 4/6] Metadata updates for first release. --- setup.py | 12 ++++++++++++ sphinxswagger/__init__.py | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) 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) From abdf02baf4fa902216739b590e9d2359cb81df9f Mon Sep 17 00:00:00 2001 From: Dave Shawley <daveshawley@gmail.com> Date: Mon, 6 Jun 2016 07:42:46 -0400 Subject: [PATCH 5/6] Add travis.yaml. --- .travis.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..33adf88 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,10 @@ +language: python +python: + - '2.7' + - '3.4' + - '3.5' +sudo: false +install: + - pip install -q -r requires/development.txt +script: + - ./setup.py build_sphinx From 3f3c4555fb4e438a8d1d7088655b62292034c584 Mon Sep 17 00:00:00 2001 From: Dave Shawley <daveshawley@gmail.com> Date: Mon, 6 Jun 2016 07:47:03 -0400 Subject: [PATCH 6/6] Add deploy section to travis control file. --- .travis.yml | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 33adf88..3803f97 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,21 @@ language: python python: - - '2.7' - - '3.4' - - '3.5' +- '2.7' +- '3.4' +- '3.5' sudo: false install: - - pip install -q -r requires/development.txt +- pip install -q -r requires/development.txt script: - - ./setup.py build_sphinx +- "./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