From 95ae7bffcf8850a2904a59c96525cab94a0328df Mon Sep 17 00:00:00 2001 From: boyska Date: Mon, 1 Aug 2016 19:53:55 +0200 Subject: [PATCH 1/4] add sphinx extensions to setup refs #168 --- doc/source/conf.py | 9 +++++++++ setup.py | 3 +++ 2 files changed, 12 insertions(+) diff --git a/doc/source/conf.py b/doc/source/conf.py index b6e3391..d4d6676 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -33,6 +33,15 @@ 'sphinx.ext.coverage', 'sphinx.ext.viewcode', ] +try: + import sphinxcontrib.autohttp.flask +except ImportError: + print "WARNING: sphinxcontrib-httpdomain not installed," \ + "you will get no REST API doc" + print " You might want to do pip install -U pip && pip install '.[doc]'" +else: + del sphinxcontrib.autohttp.flask + extensions += ['sphinxcontrib.autohttp.flask'] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] diff --git a/setup.py b/setup.py index 8acafc7..7f4b518 100644 --- a/setup.py +++ b/setup.py @@ -123,6 +123,9 @@ def read(fname): 'webant': ['translations/*/*/*.mo'] }, include_package_data=True, + extras_require={ + 'doc':['sphinx', 'sphinxcontrib-httpdomain>=1.1'], + }, tests_require=['nose', 'coverage'], zip_safe=False, cmdclass={'build': build, From b93cbd47c3442bd9f60388827b51ba6eb92d3003 Mon Sep 17 00:00:00 2001 From: boyska Date: Mon, 1 Aug 2016 20:15:38 +0200 Subject: [PATCH 2/4] Add HTTP APIs to documentation refs #168 --- doc/source/httpapi.rst | 16 ++++++++++++++++ doc/source/index.rst | 1 + 2 files changed, 17 insertions(+) create mode 100644 doc/source/httpapi.rst diff --git a/doc/source/httpapi.rst b/doc/source/httpapi.rst new file mode 100644 index 0000000..f62530f --- /dev/null +++ b/doc/source/httpapi.rst @@ -0,0 +1,16 @@ +HTTP API +========= + +Archivant and Users +--------------------- + +.. autoflask:: webant.webant:create_app(dict(USERS_DATABASE='sqlite:////tmp/asd')) + :blueprints: api + :include-empty-docstring: + +Agherant +----------- + +.. autoflask:: webant.webant:create_app(dict(AGHERANT_DESCRIPTIONS=range(3))) + :blueprints: agherant + :include-empty-docstring: diff --git a/doc/source/index.rst b/doc/source/index.rst index df6cc0c..fb13a81 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -17,6 +17,7 @@ Contents: sysadmin documentation developer + httpapi api/modules From 25a575a7737b79e89b00368acad32b0257941263 Mon Sep 17 00:00:00 2001 From: boyska Date: Tue, 2 Aug 2016 09:34:05 +0200 Subject: [PATCH 3/4] travis updated for new documentation commands --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 9247543..ac990f7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -43,6 +43,6 @@ before_script: script: - 'if [[ -z $TEST_SUITE ]]; then sleep 10; python setup.py test; return $?; fi' - 'if [[ $TEST_SUITE == flake ]]; then flake8; return $?; fi' - - 'if [[ $TEST_SUITE == build_sphinx ]]; then python setup.py build_sphinx; return $?; fi' + - 'if [[ $TEST_SUITE == build_sphinx ]]; then pip install ".[doc]" && python setup.py build_sphinx; return $?; fi' cache: pip From 2e3656efd76c29919c047641f011fa8139a90255 Mon Sep 17 00:00:00 2001 From: boyska Date: Tue, 2 Aug 2016 09:34:26 +0200 Subject: [PATCH 4/4] update documentation on how to build documentation --- doc/source/documentation.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/documentation.rst b/doc/source/documentation.rst index e3d096e..093c1fb 100644 --- a/doc/source/documentation.rst +++ b/doc/source/documentation.rst @@ -27,7 +27,7 @@ which to include all the other pages. add its filename to the ``toctree`` in ``index.rst`` To build html documentation from it, you should first of all ``pip install -Sphinx`` inside your virtualenv. Then you can run ``python setup.py +'.[doc]'`` inside your virtualenv. If this command fails, you probably have an old pip version: run ``pip install -U pip`` to fix this. Then you can run ``python setup.py build_sphinx``. This command will create documentation inside ``build/sphinx/html/``. So run ``firefox build/sphinx/html/index.html`` and you can read it.