diff --git a/matminer/__init__.py b/matminer/__init__.py index 894cebca0..5733783c1 100644 --- a/matminer/__init__.py +++ b/matminer/__init__.py @@ -1 +1,7 @@ -__version__ = "0.7.8" +from pkg_resources import DistributionNotFound, get_distribution + +try: + __version__ = get_distribution("matminer").version +except DistributionNotFound: # pragma: no cover + # package is not installed + pass diff --git a/setup.py b/setup.py index d5a7b6cf8..87c623e5f 100644 --- a/setup.py +++ b/setup.py @@ -4,6 +4,12 @@ from setuptools import find_packages, setup + +def local_version(version): + # https://github.com/pypa/setuptools_scm/issues/342 + return "" + + module_dir = os.path.dirname(os.path.abspath(__file__)) extras_require = { @@ -22,7 +28,12 @@ if __name__ == "__main__": setup( name='matminer', - version='0.7.8', + use_scm_version={ + "root": ".", + "relative_to": __file__, + "local_scheme": local_version, + }, + setup_requires=["setuptools_scm"], description='matminer is a library that contains tools for data ' 'mining in Materials Science', long_description=open(os.path.join(module_dir, 'README.md')).read(),