Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sphinx REST api #306

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
9 changes: 9 additions & 0 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down
2 changes: 1 addition & 1 deletion doc/source/documentation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
16 changes: 16 additions & 0 deletions doc/source/httpapi.rst
Original file line number Diff line number Diff line change
@@ -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:
1 change: 1 addition & 0 deletions doc/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Contents:
sysadmin
documentation
developer
httpapi
api/modules


Expand Down
3 changes: 3 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down