diff --git a/agithub/__init__.py b/agithub/__init__.py index e47e18b..c43ae91 100644 --- a/agithub/__init__.py +++ b/agithub/__init__.py @@ -1,5 +1,5 @@ # Copyright 2012-2016 Jonathan Paugh and contributors # See COPYING for license details -from agithub.base import VERSION, STR_VERSION +from agithub.base import VERSION -__all__ = ["VERSION", "STR_VERSION"] +__all__ = ["VERSION"] diff --git a/agithub/base.py b/agithub/base.py index 555a1c6..454382a 100644 --- a/agithub/base.py +++ b/agithub/base.py @@ -2,6 +2,7 @@ # See COPYING for license details import json from functools import partial, update_wrapper +from setuptools_scm import get_version import sys if sys.version_info[0:2] > (3, 0): @@ -14,14 +15,13 @@ else: class ConnectionError(OSError): pass -VERSION = [2, 1] -STR_VERSION = 'v' + '.'.join(str(v) for v in VERSION) +VERSION = get_version(root='..', relative_to=__file__) # These headers are implicitly included in each request; however, each # can be explicitly overridden by the client code. (Used in Client # objects.) _default_headers = { - 'user-agent': 'agithub/' + STR_VERSION, + 'user-agent': 'agithub/' + VERSION, 'content-type': 'application/json' } diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 23fcba9..0000000 --- a/setup.cfg +++ /dev/null @@ -1,5 +0,0 @@ -[egg_info] -tag_build = -tag_date = 0 -tag_svn_revision = 0 - diff --git a/setup.py b/setup.py index 7f381bc..4ba0edf 100755 --- a/setup.py +++ b/setup.py @@ -5,10 +5,13 @@ here = path.abspath(path.dirname(__file__)) with open(path.join(here, 'README.md')) as f: long_description = f.read() -version = '2.2.0' +test_requirements = ['pytest'] + +extras = { + "test": test_requirements, +} setup(name='agithub', - version=version, description="A lightweight, transparent syntax for REST clients", long_description=long_description, long_description_content_type='text/markdown', @@ -29,4 +32,9 @@ setup(name='agithub', packages=find_packages(exclude=['ez_setup', 'examples', 'tests']), include_package_data=True, zip_safe=False, + tests_require=test_requirements, + extras_require=extras, + setup_requires=['setuptools-scm'], + use_scm_version=True, + install_requires=['setuptools-scm'], )