From ed4fbdf1e4284c62138baa0fc1d49862c75124cb Mon Sep 17 00:00:00 2001 From: Dan Tracy Date: Thu, 26 Mar 2015 17:43:30 -0400 Subject: [PATCH] Initial commit --- .editorconfig | 14 +++++ .gitignore | 59 +++++++++++++++++++ .travis.yml | 27 +++++++++ LICENSE | 25 ++++++++ MANIFEST.in | 7 +++ README.rst | 51 ++++++++++++++++ dev-requirements.txt | 6 ++ docs/api.rst | 2 + docs/conf.py | 29 +++++++++ docs/examples.rst | 10 ++++ docs/history.rst | 5 ++ docs/index.rst | 66 +++++++++++++++++++++ requirements.txt | 0 setup.cfg | 2 + setup.py | 68 ++++++++++++++++++++++ sprockets/__init__.py | 1 + sprockets/handlers/__init__.py | 1 + sprockets/handlers/redis_stats/__init__.py | 8 +++ test-requirements.txt | 3 + tests.py | 13 +++++ 20 files changed, 397 insertions(+) create mode 100644 .editorconfig create mode 100644 .gitignore create mode 100644 .travis.yml create mode 100644 LICENSE create mode 100644 MANIFEST.in create mode 100644 README.rst create mode 100644 dev-requirements.txt create mode 100644 docs/api.rst create mode 100644 docs/conf.py create mode 100644 docs/examples.rst create mode 100644 docs/history.rst create mode 100644 docs/index.rst create mode 100644 requirements.txt create mode 100644 setup.cfg create mode 100644 setup.py create mode 100644 sprockets/__init__.py create mode 100644 sprockets/handlers/__init__.py create mode 100644 sprockets/handlers/redis_stats/__init__.py create mode 100644 test-requirements.txt create mode 100644 tests.py diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..1e60c81 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,14 @@ +root = true + +[*] +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true + +[*.py] +indent_style = space +indent_size = 4 + +[.travis.yml] +indent_style = space +indent_size = 2 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..256332b --- /dev/null +++ b/.gitignore @@ -0,0 +1,59 @@ +# Editor +*.swp +*.swo + +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] + +# C extensions +*.so + +# Distribution / packaging +.Python +env/ +bin/ +build/ +develop-eggs/ +dist/ +eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +*.egg-info/ +.installed.cfg +*.egg + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.coverage +.cache +nosetests.xml +coverage.xml + +# Translations +*.mo + +# Mr Developer +.mr.developer.cfg +.project +.pydevproject + +# Rope +.ropeproject + +# Django stuff: +*.log +*.pot + +# Sphinx documentation +docs/_build/ + + diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..8aeec00 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,27 @@ +%YAML 1.1 +--- +language: python +python: + - 2.6 + - 2.7 + - pypy + - 3.2 + - 3.3 + - 3.4 +install: + - if [[ $TRAVIS_PYTHON_VERSION == '2.6' ]]; then pip install unittest2; fi + - pip install -r test-requirements.txt + - pip install -e . +script: nosetests +after_success: + - coveralls +deploy: + distributions: sdist bdist_wheel + provider: pypi + on: + python: 2.7 + tags: true + all_branches: true + user: sprockets + password: + secure: [REPLACE-ME] diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..6ccc982 --- /dev/null +++ b/LICENSE @@ -0,0 +1,25 @@ +Copyright (c) 2014 AWeber Communications +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of Sprockets nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..1c854ba --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,7 @@ +include LICENSE +include README.rst +include *requirements.txt +graft docs +graft tests.py +global-exclude __pycache__ +global-exclude *.pyc diff --git a/README.rst b/README.rst new file mode 100644 index 0000000..858f2c2 --- /dev/null +++ b/README.rst @@ -0,0 +1,51 @@ +sprockets.handlers.redis_stats +============================== +A Tornado handler dedicated to returning pertinent stats about your Redis database + +|Version| |Downloads| |Status| |Coverage| |License| + +Installation +------------ +``sprockets.handlers.redis_stats`` is available on the +`Python Package Index `_ +and can be installed via ``pip`` or ``easy_install``: + +.. code:: bash + + pip install sprockets.handlers.redis_stats + +Documentation +------------- +https://sprocketshandlersredis_stats.readthedocs.org + +Requirements +------------ +- `sprockets `_ + +Example +------- +This examples demonstrates how to use ``sprockets.handlers.redis_stats`` by ... +.. code:: python + + from sprockets import handlers.redis_stats + + # Example here + +Version History +--------------- +Available at https://sprocketshandlersredis_stats.readthedocs.org/en/latest/history.html + +.. |Version| image:: https://badge.fury.io/py/sprockets.handlers.redis_stats.svg? + :target: http://badge.fury.io/py/sprockets.handlers.redis_stats + +.. |Status| image:: https://travis-ci.org/sprockets/sprockets.handlers.redis_stats.svg?branch=master + :target: https://travis-ci.org/sprockets/sprockets.handlers.redis_stats + +.. |Coverage| image:: https://img.shields.io/coveralls/sprockets/sprockets.handlers.redis_stats.svg? + :target: https://coveralls.io/r/sprockets/sprockets.handlers.redis_stats + +.. |Downloads| image:: https://pypip.in/d/sprockets.handlers.redis_stats/badge.svg? + :target: https://pypi.python.org/pypi/sprockets.handlers.redis_stats + +.. |License| image:: https://pypip.in/license/sprockets.handlers.redis_stats/badge.svg? + :target: https://sprocketshandlersredis_stats.readthedocs.org \ No newline at end of file diff --git a/dev-requirements.txt b/dev-requirements.txt new file mode 100644 index 0000000..6a259fc --- /dev/null +++ b/dev-requirements.txt @@ -0,0 +1,6 @@ +-r requirements.txt +-r test-requirements.txt +flake8>=2.1,<3 +sphinx>=1.2,<2 +sphinx-rtd-theme>=0.1,<1.0 +sphinxcontrib-httpdomain>=1.2,<2 diff --git a/docs/api.rst b/docs/api.rst new file mode 100644 index 0000000..6932870 --- /dev/null +++ b/docs/api.rst @@ -0,0 +1,2 @@ +.. automodule:: sprockets.handlers.redis_stats + :members: \ No newline at end of file diff --git a/docs/conf.py b/docs/conf.py new file mode 100644 index 0000000..6667049 --- /dev/null +++ b/docs/conf.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python +import sphinx_rtd_theme + +from sprockets.handlers.redis_stats import version_info, __version__ + +needs_sphinx = '1.0' +extensions = [ + 'sphinx.ext.autodoc', + 'sphinx.ext.intersphinx', + 'sphinxcontrib.httpdomain', +] +templates_path = [] +source_suffix = '.rst' +master_doc = 'index' +project = 'sprockets.handlers.redis_stats' +copyright = '2015, AWeber Communications' +version = '.'.join(__version__.split('.')[0:1]) +release = __version__ +if len(version_info) > 3: + release += '-{0}'.format(str(v) for v in version_info[3:]) +exclude_patterns = [] +pygments_style = 'sphinx' +html_theme = 'sphinx_rtd_theme' +html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] +intersphinx_mapping = { + 'python': ('https://docs.python.org/', None), + 'requests': ('https://requests.readthedocs.org/en/latest/', None), + 'sprockets': ('https://sprockets.readthedocs.org/en/latest/', None), +} diff --git a/docs/examples.rst b/docs/examples.rst new file mode 100644 index 0000000..7e6b1f2 --- /dev/null +++ b/docs/examples.rst @@ -0,0 +1,10 @@ +Examples +======== +The following example ... + +.. code:: python + + from sprockets import handlers.redis_stats + + class Foo(object): + pass diff --git a/docs/history.rst b/docs/history.rst new file mode 100644 index 0000000..9c6846c --- /dev/null +++ b/docs/history.rst @@ -0,0 +1,5 @@ +Version History +--------------- +- 0.0.0 [YYYY-MM-DD] + - Change 1 + - Change 2 \ No newline at end of file diff --git a/docs/index.rst b/docs/index.rst new file mode 100644 index 0000000..4ebcc47 --- /dev/null +++ b/docs/index.rst @@ -0,0 +1,66 @@ +sprockets.handlers.redis_stats +============================== +A Tornado handler dedicated to returning pertinent stats about your Redis database + +|Version| |Downloads| |Status| |Coverage| |License| + +Installation +------------ +``sprockets.handlers.redis_stats`` is available on the +`Python Package Index `_ +and can be installed via ``pip`` or ``easy_install``: + +.. code:: bash + + pip install sprockets.handlers.redis_stats + +Requirements +------------ +@TODO: Put full requirements list here, should match requirements.txt +- `sprockets `_ + +API Documentation +----------------- +.. toctree:: + :maxdepth: 2 + + api + examples + +Version History +--------------- +See :doc:`history` + +Issues +------ +Please report any issues to the Github project at `https://github.com/sprockets/sprockets.handlers.redis_stats/issues `_ + +Source +------ +``sprockets.handlers.redis_stats`` source is available on Github at `https://github.com/sprockets/sprockets.handlers.redis_stats `_ + +License +------- +``sprockets.handlers.redis_stats`` is released under the `3-Clause BSD license `_. + +Indices and tables +------------------ + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` + +.. |Version| image:: https://badge.fury.io/py/sprockets.handlers.redis_stats.svg? + :target: http://badge.fury.io/py/sprockets.handlers.redis_stats + +.. |Status| image:: https://travis-ci.org/sprockets/sprockets.handlers.redis_stats.svg?branch=master + :target: https://travis-ci.org/sprockets/sprockets.handlers.redis_stats + +.. |Coverage| image:: https://img.shields.io/coveralls/sprockets/sprockets.handlers.redis_stats.svg? + :target: https://coveralls.io/r/sprockets/sprockets.handlers.redis_stats + +.. |Downloads| image:: https://pypip.in/d/sprockets.handlers.redis_stats/badge.svg? + :target: https://pypi.python.org/pypi/sprockets.handlers.redis_stats + +.. |License| image:: https://pypip.in/license/sprockets.handlers.redis_stats/badge.svg? + :target: https://sprocketshandlersredis_stats.readthedocs.org diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..e69de29 diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..7c2b287 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal = 1 \ No newline at end of file diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..db20821 --- /dev/null +++ b/setup.py @@ -0,0 +1,68 @@ +import codecs +import sys + +import setuptools + + +def read_requirements_file(req_name): + requirements = [] + try: + with codecs.open(req_name, encoding='utf-8') as req_file: + for req_line in req_file: + if '#' in req_line: + req_line = req_line[0:req_line.find('#')].strip() + if req_line: + requirements.append(req_line.strip()) + except IOError: + pass + return requirements + + +install_requires = read_requirements_file('requirements.txt') +setup_requires = read_requirements_file('setup-requirements.txt') +tests_require = read_requirements_file('test-requirements.txt') + +if sys.version_info < (2, 7): + tests_require.append('unittest2') +if sys.version_info < (3, 0): + tests_require.append('mock') + +setuptools.setup( + name='sprockets.handlers.redis_stats', + version='0.0.0', + description='A Tornado handler dedicated to returning pertinent stats about your Redis database', + long_description=codecs.open('README.rst', encoding='utf-8').read(), + url='https://github.com/sprockets/sprockets.handlers.redis_stats.git', + author='AWeber Communications', + author_email='api@aweber.com', + license=codecs.open('LICENSE', encoding='utf-8').read(), + classifiers=[ + 'Development Status :: 4 - Beta', + 'Intended Audience :: Developers', + 'License :: OSI Approved :: BSD License', + 'Natural Language :: English', + 'Operating System :: OS Independent', + 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 2.6', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.2', + 'Programming Language :: Python :: 3.3', + 'Programming Language :: Python :: 3.4', + 'Programming Language :: Python :: Implementation :: CPython', + 'Programming Language :: Python :: Implementation :: PyPy', + 'Topic :: Software Development :: Libraries', + 'Topic :: Software Development :: Libraries :: Python Modules' + ], + packages=['sprockets', + 'sprockets.handlers', + 'sprockets.handlers.redis_stats'], + package_data={'': ['LICENSE', 'README.md']}, + include_package_data=True, + namespace_packages=['sprockets', + 'sprockets.handlers'], + install_requires=install_requires, + setup_requires=setup_requires, + tests_require=tests_require, + test_suite='nose.collector', + zip_safe=False) diff --git a/sprockets/__init__.py b/sprockets/__init__.py new file mode 100644 index 0000000..de40ea7 --- /dev/null +++ b/sprockets/__init__.py @@ -0,0 +1 @@ +__import__('pkg_resources').declare_namespace(__name__) diff --git a/sprockets/handlers/__init__.py b/sprockets/handlers/__init__.py new file mode 100644 index 0000000..de40ea7 --- /dev/null +++ b/sprockets/handlers/__init__.py @@ -0,0 +1 @@ +__import__('pkg_resources').declare_namespace(__name__) diff --git a/sprockets/handlers/redis_stats/__init__.py b/sprockets/handlers/redis_stats/__init__.py new file mode 100644 index 0000000..e0973b7 --- /dev/null +++ b/sprockets/handlers/redis_stats/__init__.py @@ -0,0 +1,8 @@ +""" +handlers.redis_stats + +A Tornado handler dedicated to returning pertinent stats about your Redis database + +""" +version_info = (0, 0, 0) +__version__ = '.'.join(str(v) for v in version_info) diff --git a/test-requirements.txt b/test-requirements.txt new file mode 100644 index 0000000..20b57db --- /dev/null +++ b/test-requirements.txt @@ -0,0 +1,3 @@ +coverage>=3.7,<4 +coveralls>=0.4,<1 +nose>=1.3,<2 diff --git a/tests.py b/tests.py new file mode 100644 index 0000000..8db8dca --- /dev/null +++ b/tests.py @@ -0,0 +1,13 @@ +""" +Tests for the sprockets.handlers.redis_stats package + +""" +import mock +try: + import unittest2 as unittest +except ImportError: + import unittest + + +class MyTest(unittest.TestCase): + pass