mirror of
https://github.com/sprockets/sprockets.http.git
synced 2024-11-14 11:19:26 +00:00
Add documentation
This commit is contained in:
parent
5fa31adfce
commit
18d44704fc
7 changed files with 200 additions and 2 deletions
|
@ -1,2 +1,3 @@
|
||||||
include LICENSE
|
include LICENSE
|
||||||
|
graft docs
|
||||||
graft requires
|
graft requires
|
||||||
|
|
33
README.rst
33
README.rst
|
@ -1,3 +1,32 @@
|
||||||
Sprockets.HTTP
|
sprockets.http
|
||||||
==============
|
==============
|
||||||
HTTP Server / Web application controller
|
This library runs Tornado HTTP server applications intelligently.
|
||||||
|
|
||||||
|
* ``SIGTERM`` is gracefully handled with respect to outstanding timeouts
|
||||||
|
and callbacks
|
||||||
|
* Listening port is configured by the ``PORT`` environment variable
|
||||||
|
* ``logging`` layer is configured to output JSON by default
|
||||||
|
* *"Debug mode"* is enabled by the ``DEBUG`` environment variable
|
||||||
|
|
||||||
|
- makes log out human-readable
|
||||||
|
- catches ``SIGINT`` (e.g., ``Ctrl+C``)
|
||||||
|
- application run in a single process
|
||||||
|
|
||||||
|
Example Usage
|
||||||
|
-------------
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
from tornado import web
|
||||||
|
import sprockets.http
|
||||||
|
|
||||||
|
|
||||||
|
def make_app(**settings):
|
||||||
|
return web.Application([
|
||||||
|
# insert your handlers
|
||||||
|
], **settings)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
sprockets.http.run(make_app)
|
||||||
|
|
||||||
|
|
40
docs/conf.py
Normal file
40
docs/conf.py
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
import alabaster
|
||||||
|
from sprockets import http
|
||||||
|
|
||||||
|
project = 'sprockets.http'
|
||||||
|
copyright = 'AWeber Communications, Inc.'
|
||||||
|
version = http.__version__
|
||||||
|
release = '.'.join(str(v) for v in http.version_info[0:2])
|
||||||
|
|
||||||
|
needs_sphinx = '1.0'
|
||||||
|
extensions = [
|
||||||
|
'sphinx.ext.autodoc',
|
||||||
|
'sphinx.ext.intersphinx',
|
||||||
|
'sphinx.ext.viewcode',
|
||||||
|
'sphinxcontrib.autohttp.tornado',
|
||||||
|
]
|
||||||
|
|
||||||
|
templates_path = []
|
||||||
|
source_suffix = '.rst'
|
||||||
|
source_encoding = 'utf-8-sig'
|
||||||
|
master_doc = 'index'
|
||||||
|
exclude_patterns = []
|
||||||
|
pygments_style = 'sphinx'
|
||||||
|
html_theme = 'alabaster'
|
||||||
|
html_theme_path = [alabaster.get_path()]
|
||||||
|
html_sidebars = {
|
||||||
|
'**': ['about.html', 'navigation.html'],
|
||||||
|
}
|
||||||
|
html_theme_options = {
|
||||||
|
'github_user': 'sprockets',
|
||||||
|
'github_repo': 'sprockets.http',
|
||||||
|
'description': 'Tornado application runner',
|
||||||
|
'github_banner': True,
|
||||||
|
'travis_button': True,
|
||||||
|
}
|
||||||
|
|
||||||
|
intersphinx_mapping = {
|
||||||
|
'python': ('http://docs.python.org/3/', None),
|
||||||
|
'tornado': ('http://tornadoweb.org/en/latest/', None),
|
||||||
|
}
|
112
docs/contributing.rst
Normal file
112
docs/contributing.rst
Normal file
|
@ -0,0 +1,112 @@
|
||||||
|
How to Contribute
|
||||||
|
=================
|
||||||
|
Do you want to contribute fixes or improvements?
|
||||||
|
|
||||||
|
**AWesome!** *Thank you very much, and let's get started.*
|
||||||
|
|
||||||
|
Set up a development environment
|
||||||
|
--------------------------------
|
||||||
|
The first thing that you need is a development environment so that you can
|
||||||
|
run the test suite, update the documentation, and everything else that is
|
||||||
|
involved in contributing. The easiest way to do that is to create a virtual
|
||||||
|
environment for your endevours::
|
||||||
|
|
||||||
|
$ virtualenv -p python2.7 env
|
||||||
|
|
||||||
|
Don't worry about writing code against previous versions of Python unless
|
||||||
|
you you don't have a choice. That is why we run our tests through `tox`_.
|
||||||
|
If you don't have a choice, then install `virtualenv`_ to create the
|
||||||
|
environment instead. The next step is to install the development tools
|
||||||
|
that this project uses. These are listed in *requires/development.txt*::
|
||||||
|
|
||||||
|
$ env/bin/pip install -qr requires/development.txt
|
||||||
|
|
||||||
|
At this point, you will have everything that you need to develop at your
|
||||||
|
disposal. *setup.py* is the swiss-army knife in your development tool
|
||||||
|
chest. It provides the following commands:
|
||||||
|
|
||||||
|
**./setup.py nosetests**
|
||||||
|
Run the test suite using `nose`_ and generate a nice coverage report.
|
||||||
|
|
||||||
|
**./setup.py build_sphinx**
|
||||||
|
Generate the documentation using `sphinx`_.
|
||||||
|
|
||||||
|
**./setup.py flake8**
|
||||||
|
Run `flake8`_ over the code and report style violations.
|
||||||
|
|
||||||
|
If any of the preceding commands give you problems, then you will have to
|
||||||
|
fix them **before** your pull request will be accepted.
|
||||||
|
|
||||||
|
Running Tests
|
||||||
|
-------------
|
||||||
|
The easiest (and quickest) way to run the test suite is to use the
|
||||||
|
*nosetests* command. It will run the test suite against the currently
|
||||||
|
installed python version and report not only the test result but the
|
||||||
|
test coverage as well::
|
||||||
|
|
||||||
|
$ ./setup.py nosetests
|
||||||
|
|
||||||
|
running nosetests
|
||||||
|
running egg_info
|
||||||
|
writing dependency_links to sprockets.http.egg-info/dependency_links.txt
|
||||||
|
writing top-level names to sprockets.http.egg-info/top_level.txt
|
||||||
|
writing sprockets.http.egg-info/PKG-INFO
|
||||||
|
reading manifest file 'sprockets.http.egg-info/SOURCES.txt'
|
||||||
|
reading manifest template 'MANIFEST.in'
|
||||||
|
warning: no previously-included files matching '__pycache__'...
|
||||||
|
warning: no previously-included files matching '*.swp' found ...
|
||||||
|
writing manifest file 'sprockets.http.egg-info/SOURCES.txt'
|
||||||
|
...
|
||||||
|
|
||||||
|
Name Stmts Miss Branch BrMiss Cover Missing
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
...
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
TOTAL 95 2 59 2 97%
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
Ran 44 tests in 0.054s
|
||||||
|
|
||||||
|
OK
|
||||||
|
|
||||||
|
That's the quick way to run tests. The slightly longer way is to run
|
||||||
|
the `detox`_ utility. It will run the test suite against all of the
|
||||||
|
supported python versions in parallel. This is essentially what Travis-CI
|
||||||
|
will do when you issue a pull request anyway::
|
||||||
|
|
||||||
|
$ env/bin/detox
|
||||||
|
py27 recreate: /.../sprockets.http/build/tox/py27
|
||||||
|
GLOB sdist-make: /.../sprockets.http/setup.py
|
||||||
|
py34 recreate: /.../sprockets.http/build/tox/py34
|
||||||
|
py27 installdeps: -rtest-requirements.txt, mock
|
||||||
|
py34 installdeps: -rtest-requirements.txt
|
||||||
|
py27 inst: /.../sprockets.http/build/tox/dist/sprockets.http-0.0.0.zip
|
||||||
|
py27 runtests: PYTHONHASHSEED='2156646470'
|
||||||
|
py27 runtests: commands[0] | /../sprockets.http/build/tox/py27/bin/nosetests
|
||||||
|
py34 inst: /../sprockets.http/.build/tox/dist/sprockets.http-0.0.0.zip
|
||||||
|
py34 runtests: PYTHONHASHSEED='2156646470'
|
||||||
|
py34 runtests: commands[0] | /.../sprockets.http/build/tox/py34/bin/nosetests
|
||||||
|
_________________________________ summary _________________________________
|
||||||
|
py27: commands succeeded
|
||||||
|
py34: commands succeeded
|
||||||
|
congratulations :)
|
||||||
|
|
||||||
|
This is what you want to see. Now you can make your modifications and keep
|
||||||
|
the tests passing.
|
||||||
|
|
||||||
|
Submitting a Pull Request
|
||||||
|
-------------------------
|
||||||
|
Once you have made your modifications, gotten all of the tests to pass,
|
||||||
|
and added any necessary documentation, it is time to contribute back for
|
||||||
|
posterity. You've probably already cloned this repository and created a
|
||||||
|
new branch. If you haven't, then checkout what you have as a branch and
|
||||||
|
roll back *master* to where you found it. Then push your repository up
|
||||||
|
to github and issue a pull request. Describe your changes in the request,
|
||||||
|
if Travis isn't too annoyed someone will review it, and eventually merge
|
||||||
|
it back.
|
||||||
|
|
||||||
|
.. _flake8: http://flake8.readthedocs.org/
|
||||||
|
.. _nose: http://nose.readthedocs.org/
|
||||||
|
.. _sphinx: http://sphinx-doc.org/
|
||||||
|
.. _detox: http://testrun.org/tox/
|
||||||
|
.. _tox: http://testrun.org/tox/
|
||||||
|
.. _virtualenv: http://virtualenv.pypa.io/
|
7
docs/history.rst
Normal file
7
docs/history.rst
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
.. :changelog:
|
||||||
|
|
||||||
|
Release History
|
||||||
|
===============
|
||||||
|
|
||||||
|
Next Release
|
||||||
|
------------
|
7
docs/index.rst
Normal file
7
docs/index.rst
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
.. include:: ../README.rst
|
||||||
|
|
||||||
|
.. toctree::
|
||||||
|
:hidden:
|
||||||
|
|
||||||
|
contributing
|
||||||
|
history
|
2
setup.cfg
Normal file
2
setup.cfg
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
[build_sphinx]
|
||||||
|
all-files = 1
|
Loading…
Reference in a new issue