From f4f450ad07547125bc5390ce91f895a92554114a Mon Sep 17 00:00:00 2001 From: Patrick Huck Date: Thu, 10 Nov 2022 14:42:12 -0800 Subject: [PATCH] work on release through github actions (#885) * use scm for version * local version override --- matminer/__init__.py | 8 +++++++- setup.py | 13 ++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) 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(),