commit 718bf1b9aea5213407ab683b6a505594f05fc870 Author: Dave Shawley Date: Sun Feb 19 20:26:53 2017 -0500 SYN diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d8f8f5b --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +*.egg-info +*.pyc +.coverage +__pycache__/ +build/ +dist/ +env/ diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..74664f4 --- /dev/null +++ b/.travis.yml @@ -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 diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..8f76115 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,4 @@ +graft docs +graft examples +graft requires +include tests.py diff --git a/README.rst b/README.rst new file mode 100644 index 0000000..ba8d271 --- /dev/null +++ b/README.rst @@ -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 diff --git a/docs/conf.py b/docs/conf.py new file mode 100644 index 0000000..9967a53 --- /dev/null +++ b/docs/conf.py @@ -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), +} diff --git a/docs/custom.css b/docs/custom.css new file mode 100644 index 0000000..3d8ad89 --- /dev/null +++ b/docs/custom.css @@ -0,0 +1,5 @@ +.field-name { + -webkit-hyphens: none; + hyphens: none; + min-width: 8em; +} diff --git a/docs/history.rst b/docs/history.rst new file mode 100644 index 0000000..93300f0 --- /dev/null +++ b/docs/history.rst @@ -0,0 +1,9 @@ +=============== +Release History +=============== + +`Next Release`_ +--------------- + + +.. _Next Release: https://github.com/sprockets/sprockets-status/compare/0.0.0...HEAD diff --git a/docs/index.rst b/docs/index.rst new file mode 100644 index 0000000..d7b6664 --- /dev/null +++ b/docs/index.rst @@ -0,0 +1,6 @@ +.. include:: ../README.rst + +.. toctree:: + :hidden: + + history diff --git a/examples/__init__.py b/examples/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/requires/development.txt b/requires/development.txt new file mode 100644 index 0000000..2810abf --- /dev/null +++ b/requires/development.txt @@ -0,0 +1,4 @@ +coverage==4.3.4 +nose==1.3.7 +Sphinx==1.5.2 +tornado==4.4.2 diff --git a/requires/installation.txt b/requires/installation.txt new file mode 100644 index 0000000..3c0dc49 --- /dev/null +++ b/requires/installation.txt @@ -0,0 +1 @@ +tornado>=4.2 diff --git a/requires/testing.txt b/requires/testing.txt new file mode 100644 index 0000000..794153a --- /dev/null +++ b/requires/testing.txt @@ -0,0 +1,2 @@ +coverage>=4,<5 +nose>=1.3,<2 diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..d24d72d --- /dev/null +++ b/setup.cfg @@ -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 diff --git a/setup.py b/setup.py new file mode 100755 index 0000000..fc006a6 --- /dev/null +++ b/setup.py @@ -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', + ], +) diff --git a/sprockets_status/__init__.py b/sprockets_status/__init__.py new file mode 100644 index 0000000..0d8992f --- /dev/null +++ b/sprockets_status/__init__.py @@ -0,0 +1,2 @@ +version_info = (0, 0, 0) +version = '.'.join(str(v) for v in version_info) diff --git a/tests.py b/tests.py new file mode 100644 index 0000000..e69de29