diff --git a/AUTHORS.rst b/AUTHORS.rst new file mode 100644 index 0000000..b28d19d --- /dev/null +++ b/AUTHORS.rst @@ -0,0 +1,9 @@ +======= +Authors +======= + +The following folks have contributed to making this library possible. + +* Andy Dirnberger (`@dirn `_) +* Jon Banafato (`@jonafato `_) +* Leonard Bedner (`@lbedner `_) diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..2f11356 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,12 @@ +include AUTHORS.rst +include LICENSE +include README.rst + +recursive-include docs Makefile *.py *.rst + +exclude .coveragerc +exclude .travis.yml +exclude tox.ini + +prune docs/_build +prune tests diff --git a/README.rst b/README.rst index 0a8fe0f..d2121f2 100644 --- a/README.rst +++ b/README.rst @@ -1,5 +1,13 @@ -############## -Henson-Logging -############## +############################# +Henson-Logging |build status| +############################# + +.. |build status| image:: https://travis-ci.org/iheartradio/Henson-Logging.svg?branch=master + :target: https://travis-ci.org/iheartradio/Henso-Logging A library to use structured logging with a Henson application. + +* `Documentation `_ +* `Installation `_ +* `Changelog `_ +* `Source `_ diff --git a/henson_logging/__init__.py b/henson_logging/__init__.py index 6a48c20..7ecbb05 100644 --- a/henson_logging/__init__.py +++ b/henson_logging/__init__.py @@ -1,8 +1,9 @@ """Logging plugin for Henson.""" -from pkg_resources import get_distribution import logging import logging.config +import os +import pkg_resources from henson import Extension import structlog @@ -10,7 +11,17 @@ from . import processors __all__ = ('Logging',) -__version__ = get_distribution(__package__).version + +try: + _dist = pkg_resources.get_distribution(__package__) + if not __file__.startswith(os.path.join(_dist.location, __package__)): + # Manually raise the exception if there is a distribution but + # it's installed from elsewhere. + raise pkg_resources.DistributionNotFound +except pkg_resources.DistributionNotFound: + __version__ = 'development' +else: + __version__ = _dist.version class Logging(Extension): diff --git a/setup.py b/setup.py index 3266c63..d3f41b1 100644 --- a/setup.py +++ b/setup.py @@ -1,16 +1,45 @@ from setuptools import find_packages, setup +from setuptools.command.test import test as TestCommand +import sys + + +class PyTest(TestCommand): + def finalize_options(self): + super().finalize_options() + self.test_args = [] + self.test_suite = True + + def run_tests(self): + import pytest + sys.exit(pytest.main(self.test_args)) + + +def read(filename): + with open(filename) as f: + return f.read() + setup( name='Henson-Logging', version='0.3.0', + author='Andy Dirnberger, Jon Banafato, and others', + author_email='henson@iheart.com', + url='https://henson-logging.rtfd.org', + description='A library to use structured logging with a Henson application.', + long_description=read('README.rst'), + license='Apache License, Version 2.0', packages=find_packages(exclude=['tests']), + zip_safe=False, install_requires=[ 'Henson>=0.2.0', 'structlog', ], tests_require=[ - 'tox', + 'pytest', ], + cmdclass={ + 'test': PyTest, + }, classifiers=[ 'Development Status :: 4 - Beta', 'Intended Audience :: Developers',