From 68a17579791cef227cb0e7522988c75847b93a7f Mon Sep 17 00:00:00 2001 From: Bjoern Ludwig Date: Thu, 14 Oct 2021 16:20:04 +0200 Subject: [PATCH 1/2] build(__version__): reintroduce __version__ variable according to PEP 396 --- setup.cfg | 2 +- setup.py | 20 ++++++++++++++++++-- src/PyDynamic/__init__.py | 15 ++++++++------- 3 files changed, 27 insertions(+), 10 deletions(-) diff --git a/setup.cfg b/setup.cfg index 347c98fcb..114c0587f 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,5 @@ [semantic_release] -version_variable=setup.py:current_release_version,docs/conf.py:version +version_variable=src/PyDynamic/__init__.py:__version__,docs/conf.py:version version_source=commit upload_to_pypi=true upload_to_release=true diff --git a/setup.py b/setup.py index 515aab476..0e54f166d 100755 --- a/setup.py +++ b/setup.py @@ -1,10 +1,9 @@ """Install PyDynamic in Python path and provide all packaging metadata.""" +import codecs from os import path from setuptools import find_packages, setup -current_release_version = "1.10.0" - def get_readme(): """Get README.md's content""" @@ -13,6 +12,23 @@ def get_readme(): return f.read() +def read(rel_path): + here = path.abspath(path.dirname(__file__)) + with codecs.open(path.join(here, rel_path), "r") as fp: + return fp.read() + + +def get_version(rel_path): + for line in read(rel_path).splitlines(): + if line.startswith("__version__"): + delim = '"' if '"' in line else "'" + return line.split(delim)[1] + else: + raise RuntimeError("Unable to find version string.") + + +current_release_version = get_version("src/PyDynamic/__init__.py") + setup( metadata_version="2.1", name="PyDynamic", diff --git a/src/PyDynamic/__init__.py b/src/PyDynamic/__init__.py index c7c325a22..1a5bfaf49 100644 --- a/src/PyDynamic/__init__.py +++ b/src/PyDynamic/__init__.py @@ -6,13 +6,7 @@ -uptake-of-nmi-calibrations-of-dynamic-force-torque-and/>`_ - `GitHub website `_ """ - -from .deconvolution.fit_filter import LSFIR_unc, LSFIR_uncMC, LSIIR_unc -from .identification.fit_transfer import fit_sos - -from .misc import * -from .model_estimation import * -from .uncertainty import * +__version__ = "1.10.0" __all__ = [ "invLSFIR", @@ -74,3 +68,10 @@ "is_2d_matrix", "number_of_rows_equals_vector_dim", ] + +from .deconvolution.fit_filter import LSFIR_unc, LSFIR_uncMC, LSIIR_unc +from .identification.fit_transfer import fit_sos + +from .misc import * +from .model_estimation import * +from .uncertainty import * From 95761b7a54c068a55250aa4b657cfd5a607e0a6b Mon Sep 17 00:00:00 2001 From: Bjoern Ludwig Date: Thu, 14 Oct 2021 16:20:34 +0200 Subject: [PATCH 2/2] build(MANIFEST.in): properly set values to keep package clean and small --- MANIFEST.in | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/MANIFEST.in b/MANIFEST.in index 41ae4658b..477877830 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1 +1,4 @@ -recursive-include src/PyDynamic/examples/uncertainty_for_dft *.dat \ No newline at end of file +graft src/PyDynamic/examples/uncertainty_for_dft +graft requirements +prune test +include licence.txt \ No newline at end of file