This commit is contained in:
Dave Shawley 2017-02-19 20:26:53 -05:00
commit 718bf1b9ae
16 changed files with 204 additions and 0 deletions

7
.gitignore vendored Normal file
View file

@ -0,0 +1,7 @@
*.egg-info
*.pyc
.coverage
__pycache__/
build/
dist/
env/

14
.travis.yml Normal file
View file

@ -0,0 +1,14 @@
language: python
python:
- 2.7
- 3.4
- 3.5
- pypy
sudo: false
install:
- pip install -r requires/testing.txt coveralls sphinx
script:
- nosetests
- ./setup.py build_sphinx
after_success:
- coveralls

4
MANIFEST.in Normal file
View file

@ -0,0 +1,4 @@
graft docs
graft examples
graft requires
include tests.py

69
README.rst Normal file
View file

@ -0,0 +1,69 @@
================
sprockets-status
================
Simple application status handler for Tornado.
+-------------+--------------------------------------------------------+
| |GitHub| | https://github.com/sprockets/sprockets-status |
+-------------+--------------------------------------------------------+
| |PyPI| | https://pypi.org/project/sprockets-status/ |
+-------------+--------------------------------------------------------+
| |Docs| | https://pythonhosted.org/sprockets-status/ |
+-------------+--------------------------------------------------------+
| |Coveralls| | https://coveralls.io/github/sprockets/sprockets-status |
+-------------+--------------------------------------------------------+
| |Travis| | https://travis-ci.org/sprockets/sprockets-status |
+-------------+--------------------------------------------------------+
This library includes a very simple ``tornado.web.RequestHandler`` that
returns an applications status information. You should install the
handler under the ``/status`` path for a very simple healthcheck that
verifies the operation of the IOLoop (at the very least). This library
is the successor to the `sprockets.handlers.status`_ library. We have
moved away from a deeply nested package structure based on namespace
packages because they are actually more trouble than they are worth.
Simplest Example
================
.. code-block:: python
from tornado import ioloop, web
import sprockets_status.handlers
def make_app(**settings):
return web.Application([
web.url('/status', sprockets_status.handlers.StatusHandler,
{'name': 'my-app-name', 'version': '1.1.1'}),
# add your handlers here
], **settings)
if __name__ == '__main__':
app = make_app()
iol = ioloop.IOLoop.current()
try:
app.listen(8888)
iol.start()
except KeyboardInterrupt:
iol.stop()
Developer Quickstart
====================
.. code-block:: bash
python3.5 -mvenv --copies env
env/bin/pip install -r requires/development.txt -e .
env/bin/nosetests
env/bin/python setup.py build_sphinx
.. _sprockets.handlers.status: https://github.com/sprockets/
sprockets.handlers.status
.. |Coveralls| image:: https://img.shields.io/coveralls/sprockets/sprockets-status.svg
:target: https://coveralls.io/github/sprockets/sprockets-status
.. |GitHub| image:: https://img.shields.io/github/release/sprockets/sprockets-status.svg
:target: https://github.com/sprockets/sprockets-status
.. |PyPI| image:: https://img.shields.io/pypi/v/sprockets-status.svg
:target: https://pypi.org/project/sprockets-status
.. |Docs| image:: https://img.shields.io/badge/docs-pythonhosted-green.svg
:target: https://pythonhosted.com/sprockets-status/
.. |Travis| image:: https://img.shields.io/travis/sprockets/sprockets-status.svg
:target: https://travis-ci.org/sprockets/sprockets-status

17
docs/conf.py Normal file
View file

@ -0,0 +1,17 @@
import sprockets_status
project = 'sprockets-status'
copyright = 'AWeber Communications, Inc.'
version = sprockets_status.version
release = '.'.join(str(v) for v in sprockets_status.version_info[:2])
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.intersphinx']
master_doc = 'index'
source_suffix = '.rst'
html_static_path = ['.']
intersphinx_mapping = {
'python': ('http://docs.python.org/3/', None),
'tornado': ('http://tornadoweb.org/en/stable/', None),
}

5
docs/custom.css Normal file
View file

@ -0,0 +1,5 @@
.field-name {
-webkit-hyphens: none;
hyphens: none;
min-width: 8em;
}

9
docs/history.rst Normal file
View file

@ -0,0 +1,9 @@
===============
Release History
===============
`Next Release`_
---------------
.. _Next Release: https://github.com/sprockets/sprockets-status/compare/0.0.0...HEAD

6
docs/index.rst Normal file
View file

@ -0,0 +1,6 @@
.. include:: ../README.rst
.. toctree::
:hidden:
history

0
examples/__init__.py Normal file
View file

4
requires/development.txt Normal file
View file

@ -0,0 +1,4 @@
coverage==4.3.4
nose==1.3.7
Sphinx==1.5.2
tornado==4.4.2

View file

@ -0,0 +1 @@
tornado>=4.2

2
requires/testing.txt Normal file
View file

@ -0,0 +1,2 @@
coverage>=4,<5
nose>=1.3,<2

13
setup.cfg Normal file
View file

@ -0,0 +1,13 @@
[bdist_wheel]
universal = 1
[nosetests]
with-coverage = 1
cover-package = sprockets_status
cover-branches = 1
cover-erase = 1
cover-html = 1
cover-html-dir = build/coverage
[upload_docs]
upload-dir = build/sphinx/html

51
setup.py Executable file
View file

@ -0,0 +1,51 @@
#!/usr/bin/env python
#
import os.path
import setuptools
import sprockets_status
def read_requirements(name):
requirements = []
with open(os.path.join('requires', name)) as req_file:
for line in req_file:
if '#' in line:
line = line[:line.index('#')]
line = line.strip()
if line.startswith('-r'):
requirements.extend(read_requirements(line[2:].strip()))
elif line:
requirements.append(line)
return requirements
setuptools.setup(
name='sprockets-status',
version=sprockets_status.version,
description='Application status handler for Tornado',
long_description='\n' + open('README.rst').read(),
url='https://github.com/sprockets/sprockets-status',
license='BSD',
author='AWeber Communications, Inc.',
author_email='api@aweber.com',
packages=['sprockets_status'],
install_requires=read_requirements('installation.txt'),
tests_require=read_requirements('testing.txt'),
classifiers=[
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
'Topic :: Software Development :: Libraries',
'Topic :: Software Development :: Libraries :: Python Modules',
],
)

View file

@ -0,0 +1,2 @@
version_info = (0, 0, 0)
version = '.'.join(str(v) for v in version_info)

0
tests.py Normal file
View file