From 21a3d024c1e55749f648016ca67a6bd0fdb0e0a0 Mon Sep 17 00:00:00 2001 From: johnb Date: Mon, 13 Oct 2014 11:16:28 -0400 Subject: [PATCH] initial commit --- .gitignore | 59 ++++++++++++++++++++ .travis.yml | 26 +++++++++ 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 | 1 + setup.cfg | 12 +++++ setup.py | 68 ++++++++++++++++++++++++ sprockets/__init__.py | 1 + sprockets/handlers/__init__.py | 1 + sprockets/handlers/heartbeat/__init__.py | 8 +++ test-requirements.txt | 3 ++ tests.py | 13 +++++ 19 files changed, 393 insertions(+) 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/heartbeat/__init__.py create mode 100644 test-requirements.txt create mode 100644 tests.py 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..e13ce73 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,26 @@ +%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: + provider: pypi + user: sprockets + on: + python: 2.7 + tags: true + all_branches: true + password: + secure: [REPLACE-ME] \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..630f26e --- /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. \ No newline at end of file diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..2979b93 --- /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 \ No newline at end of file diff --git a/README.rst b/README.rst new file mode 100644 index 0000000..1124100 --- /dev/null +++ b/README.rst @@ -0,0 +1,51 @@ +sprockets.handlers.heartbeat +============================ +A callback-based heartbeat handler + +|Version| |Downloads| |Status| |Coverage| |License| + +Installation +------------ +``sprockets.handlers.heartbeat`` is available on the +`Python Package Index `_ +and can be installed via ``pip`` or ``easy_install``: + +.. code:: bash + + pip install sprockets.handlers.heartbeat + +Documentation +------------- +https://sprocketshandlersheartbeat.readthedocs.org + +Requirements +------------ +- `sprockets `_ + +Example +------- +This examples demonstrates how to use ``sprockets.handlers.heartbeat`` by ... +.. code:: python + + from sprockets import handlers.heartbeat + + # Example here + +Version History +--------------- +Available at https://sprocketshandlersheartbeat.readthedocs.org/en/latest/history.html + +.. |Version| image:: https://badge.fury.io/py/sprockets.handlers.heartbeat.svg? + :target: http://badge.fury.io/py/sprockets.handlers.heartbeat + +.. |Status| image:: https://travis-ci.org/sprockets/sprockets.handlers.heartbeat.svg?branch=master + :target: https://travis-ci.org/sprockets/sprockets.handlers.heartbeat + +.. |Coverage| image:: https://img.shields.io/coveralls/sprockets/sprockets.handlers.heartbeat.svg? + :target: https://coveralls.io/r/sprockets/sprockets.handlers.heartbeat + +.. |Downloads| image:: https://pypip.in/d/sprockets.handlers.heartbeat/badge.svg? + :target: https://pypi.python.org/pypi/sprockets.handlers.heartbeat + +.. |License| image:: https://pypip.in/license/sprockets.handlers.heartbeat/badge.svg? + :target: https://sprocketshandlersheartbeat.readthedocs.org \ No newline at end of file diff --git a/dev-requirements.txt b/dev-requirements.txt new file mode 100644 index 0000000..dfd7aba --- /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 \ No newline at end of file diff --git a/docs/api.rst b/docs/api.rst new file mode 100644 index 0000000..768b626 --- /dev/null +++ b/docs/api.rst @@ -0,0 +1,2 @@ +.. automodule:: sprockets.handlers.heartbeat + :members: \ No newline at end of file diff --git a/docs/conf.py b/docs/conf.py new file mode 100644 index 0000000..20392d2 --- /dev/null +++ b/docs/conf.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python +import sphinx_rtd_theme + +from sprockets.handlers.heartbeat 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.heartbeat' +copyright = '2014, 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), +} \ No newline at end of file diff --git a/docs/examples.rst b/docs/examples.rst new file mode 100644 index 0000000..dbddbe2 --- /dev/null +++ b/docs/examples.rst @@ -0,0 +1,10 @@ +Examples +======== +The following example ... + +.. code:: python + + from sprockets import handlers.heartbeat + + class Foo(object): + pass \ No newline at end of file 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..47b6e8b --- /dev/null +++ b/docs/index.rst @@ -0,0 +1,66 @@ +sprockets.handlers.heartbeat +============================ +A callback-based heartbeat handler + +|Version| |Downloads| |Status| |Coverage| |License| + +Installation +------------ +``sprockets.handlers.heartbeat`` is available on the +`Python Package Index `_ +and can be installed via ``pip`` or ``easy_install``: + +.. code:: bash + + pip install sprockets.handlers.heartbeat + +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.heartbeat/issues `_ + +Source +------ +``sprockets.handlers.heartbeat`` source is available on Github at `https://github.com/sprockets/sprockets.handlers.heartbeat `_ + +License +------- +``sprockets.handlers.heartbeat`` 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.heartbeat.svg? + :target: http://badge.fury.io/py/sprockets.handlers.heartbeat + +.. |Status| image:: https://travis-ci.org/sprockets/sprockets.handlers.heartbeat.svg?branch=master + :target: https://travis-ci.org/sprockets/sprockets.handlers.heartbeat + +.. |Coverage| image:: https://img.shields.io/coveralls/sprockets/sprockets.handlers.heartbeat.svg? + :target: https://coveralls.io/r/sprockets/sprockets.handlers.heartbeat + +.. |Downloads| image:: https://pypip.in/d/sprockets.handlers.heartbeat/badge.svg? + :target: https://pypi.python.org/pypi/sprockets.handlers.heartbeat + +.. |License| image:: https://pypip.in/license/sprockets.handlers.heartbeat/badge.svg? + :target: https://sprocketshandlersheartbeat.readthedocs.org \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..9724f0b --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +sprockets<2 \ No newline at end of file diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..1204b1d --- /dev/null +++ b/setup.cfg @@ -0,0 +1,12 @@ +[build_sphinx] +all-files = 1 +source-dir = docs +build-dir = build/docs + +[nosetests] +with-coverage = 1 +cover-package = sprockets.handlers.heartbeat +verbose = 1 + +[flake8] +exclude = build,dist,docs,env \ No newline at end of file diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..0cfab53 --- /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.heartbeat', + version='0.0.0', + description='A callback-based heartbeat handler', + long_description=codecs.open('README.rst', encoding='utf-8').read(), + url='https://github.com/sprockets/sprockets.handlers.heartbeat.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.heartbeat'], + 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) \ No newline at end of file diff --git a/sprockets/__init__.py b/sprockets/__init__.py new file mode 100644 index 0000000..b0d6433 --- /dev/null +++ b/sprockets/__init__.py @@ -0,0 +1 @@ +__import__('pkg_resources').declare_namespace(__name__) \ No newline at end of file diff --git a/sprockets/handlers/__init__.py b/sprockets/handlers/__init__.py new file mode 100644 index 0000000..b0d6433 --- /dev/null +++ b/sprockets/handlers/__init__.py @@ -0,0 +1 @@ +__import__('pkg_resources').declare_namespace(__name__) \ No newline at end of file diff --git a/sprockets/handlers/heartbeat/__init__.py b/sprockets/handlers/heartbeat/__init__.py new file mode 100644 index 0000000..bd173b7 --- /dev/null +++ b/sprockets/handlers/heartbeat/__init__.py @@ -0,0 +1,8 @@ +""" +handlers.heartbeat + +A callback-based heartbeat handler + +""" +version_info = (0, 0, 0) +__version__ = '.'.join(str(v) for v in version_info) \ No newline at end of file diff --git a/test-requirements.txt b/test-requirements.txt new file mode 100644 index 0000000..09ac575 --- /dev/null +++ b/test-requirements.txt @@ -0,0 +1,3 @@ +coverage>=3.7,<4 +coveralls>=0.4,<1 +nose>=1.3,<2 \ No newline at end of file diff --git a/tests.py b/tests.py new file mode 100644 index 0000000..e1f7440 --- /dev/null +++ b/tests.py @@ -0,0 +1,13 @@ +""" +Tests for the sprockets.handlers.heartbeat package + +""" +import mock +try: + import unittest2 as unittest +except ImportError: + import unittest + + +class MyTest(unittest.TestCase): + pass \ No newline at end of file