From ff5ae37e7833443a4341f2147ca177a954fcf856 Mon Sep 17 00:00:00 2001 From: David Nabergoj Date: Sat, 19 Oct 2024 20:10:06 +0200 Subject: [PATCH 1/5] Fix __all__ --- torchflows/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/torchflows/__init__.py b/torchflows/__init__.py index 1a7460a..313943c 100644 --- a/torchflows/__init__.py +++ b/torchflows/__init__.py @@ -27,6 +27,7 @@ from torchflows.bijections.continuous.ffjord import FFJORD from torchflows.bijections.continuous.ddnf import DeepDiffeomorphicBijection from torchflows.bijections.continuous.otflow import OTFlow +from torchflows._version import __version__ __all__ = [ 'NICE', @@ -46,10 +47,11 @@ 'ProximalResFlow', 'Radial', 'Planar', - 'InverseSylvester', + 'Sylvester', 'ElementwiseShift', 'ElementwiseAffine', 'ElementwiseRQSpline', 'Flow', 'FlowMixture', + '__version__' ] From 3ae62c853d83c36c12b92a0f095c3f00a11e27df Mon Sep 17 00:00:00 2001 From: David Nabergoj Date: Sat, 19 Oct 2024 20:10:24 +0200 Subject: [PATCH 2/5] Update versioning and set version to 1.1.0 --- docs/conf.py | 8 ++++++-- docs/source/conf.py | 7 +++---- pyproject.toml | 2 +- setup.py | 17 +++++++++++------ torchflows/_version.py | 3 +++ 5 files changed, 24 insertions(+), 13 deletions(-) create mode 100644 torchflows/_version.py diff --git a/docs/conf.py b/docs/conf.py index 8b1ae73..83a3d18 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,13 +1,17 @@ # Configuration file for the Sphinx documentation builder. # -- Project information +import importlib.metadata + +version = importlib.metadata.version('torchflows') +release = version project = 'torchflows' copyright = '2024, David Nabergoj' author = 'David Nabergoj' -release = '1.0' -version = '1.0.6' +# release = f'{torchflows.__version__}' +# version = f'{torchflows.__version__}' # -- General configuration diff --git a/docs/source/conf.py b/docs/source/conf.py index bc399a8..32b8700 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -5,15 +5,14 @@ # -- Project information ----------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information -import pathlib -import sys +import importlib.metadata -sys.path.insert(0, pathlib.Path(__file__).parents[2].resolve().as_posix()) +version = importlib.metadata.version('torchflows') project = 'Torchflows' copyright = '2024, David Nabergoj' author = 'David Nabergoj' -release = '1.0.2' +release = f'{version}' # -- General configuration --------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration diff --git a/pyproject.toml b/pyproject.toml index 803ec33..3949534 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "torchflows" -version = "1.0.6" +version = "1.1.0" authors = [ { name = "David Nabergoj", email = "david.nabergoj@fri.uni-lj.si" }, ] diff --git a/setup.py b/setup.py index 45735b1..a607cb9 100644 --- a/setup.py +++ b/setup.py @@ -1,17 +1,22 @@ from setuptools import setup, find_packages import pathlib +import sys +import importlib.metadata -here = pathlib.Path(__file__).parent.resolve() +root = pathlib.Path(__file__).parent.resolve() +sys.path.append(root.as_posix()) -long_description = (here / "README.md").read_text(encoding="utf-8") +version = importlib.metadata.version('torchflows') + +long_description = (root / "README.md").read_text(encoding="utf-8") setup( - name="normalizing-flows", - version="1.0.4", + name="Torchflows", + version=f"{version}", description="Modern normalizing flows in Python", long_description=long_description, long_description_content_type="text/markdown", - url="https://github.com/davidnabergoj/normalizing-flows", + url="https://github.com/davidnabergoj/torchflows", author="David Nabergoj", author_email="david.nabergoj@fri.uni-lj.si", classifiers=[ # Optional @@ -43,6 +48,6 @@ "tqdm" ], project_urls={ - "Bug Reports": "https://github.com/davidnabergoj/normalizing-flows/issues", + "Bug Reports": "https://github.com/davidnabergoj/torchflows/issues", }, ) diff --git a/torchflows/_version.py b/torchflows/_version.py new file mode 100644 index 0000000..febfdc1 --- /dev/null +++ b/torchflows/_version.py @@ -0,0 +1,3 @@ +import importlib.metadata + +__version__ = importlib.metadata.version('torchflows') \ No newline at end of file From ccd94b3129d4e58442eae2eaa82f15bb64f4b3fa Mon Sep 17 00:00:00 2001 From: David Nabergoj Date: Sat, 19 Oct 2024 20:14:44 +0200 Subject: [PATCH 3/5] Use v prefix in version --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 3949534..a4b26db 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "torchflows" -version = "1.1.0" +version = "v1.1.0" authors = [ { name = "David Nabergoj", email = "david.nabergoj@fri.uni-lj.si" }, ] From db4a3ed792248aacaad4fc38748f857aac7e436a Mon Sep 17 00:00:00 2001 From: David Nabergoj Date: Sat, 19 Oct 2024 20:43:21 +0200 Subject: [PATCH 4/5] Separate versioning for package and docs --- docs/DOCS_VERSION | 1 + docs/conf.py | 6 ++++-- docs/source/conf.py | 5 +++-- pyproject.toml | 2 +- setup.py | 10 +++++++--- torchflows/_version.py | 13 +++++++++++-- 6 files changed, 27 insertions(+), 10 deletions(-) create mode 100644 docs/DOCS_VERSION diff --git a/docs/DOCS_VERSION b/docs/DOCS_VERSION new file mode 100644 index 0000000..992977a --- /dev/null +++ b/docs/DOCS_VERSION @@ -0,0 +1 @@ +v1.1.0 \ No newline at end of file diff --git a/docs/conf.py b/docs/conf.py index 83a3d18..bf47c93 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,9 +1,11 @@ # Configuration file for the Sphinx documentation builder. +import pathlib # -- Project information -import importlib.metadata -version = importlib.metadata.version('torchflows') +with open("DOCS_VERSION", 'r') as f: + version = f.read().strip() + release = version project = 'torchflows' diff --git a/docs/source/conf.py b/docs/source/conf.py index 32b8700..4211bb7 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -2,12 +2,13 @@ # # For the full list of built-in configuration values, see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html +import pathlib # -- Project information ----------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information -import importlib.metadata -version = importlib.metadata.version('torchflows') +with open("../DOCS_VERSION", 'r') as f: + version = f.read().strip() project = 'Torchflows' copyright = '2024, David Nabergoj' diff --git a/pyproject.toml b/pyproject.toml index a4b26db..e08352c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "torchflows" -version = "v1.1.0" +dynamic = ["version"] authors = [ { name = "David Nabergoj", email = "david.nabergoj@fri.uni-lj.si" }, ] diff --git a/setup.py b/setup.py index a607cb9..40361b6 100644 --- a/setup.py +++ b/setup.py @@ -1,18 +1,22 @@ from setuptools import setup, find_packages +from distutils.util import convert_path import pathlib import sys -import importlib.metadata + root = pathlib.Path(__file__).parent.resolve() sys.path.append(root.as_posix()) -version = importlib.metadata.version('torchflows') +main_ns = {} +ver_path = convert_path('torchflows/_version.py') +with open(ver_path) as ver_file: + exec(ver_file.read(), main_ns) long_description = (root / "README.md").read_text(encoding="utf-8") setup( name="Torchflows", - version=f"{version}", + version=main_ns['__version__'], description="Modern normalizing flows in Python", long_description=long_description, long_description_content_type="text/markdown", diff --git a/torchflows/_version.py b/torchflows/_version.py index febfdc1..c479a20 100644 --- a/torchflows/_version.py +++ b/torchflows/_version.py @@ -1,3 +1,12 @@ -import importlib.metadata +from pathlib import Path -__version__ = importlib.metadata.version('torchflows') \ No newline at end of file +try: + import toml + + pyproject_toml_file = Path(__file__).parents[1] / "pyproject.toml" + data = toml.load(pyproject_toml_file) + __version__ = data["project"]["version"] +except ImportError: + import importlib.metadata + + __version__ = importlib.metadata.version("torchflows") From 25179e8767d29df5fe30a099d1921b747d7ab38d Mon Sep 17 00:00:00 2001 From: David Nabergoj Date: Sat, 19 Oct 2024 20:45:28 +0200 Subject: [PATCH 5/5] Set version to v1.1.0 --- torchflows/_version.py | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/torchflows/_version.py b/torchflows/_version.py index c479a20..2f0abb8 100644 --- a/torchflows/_version.py +++ b/torchflows/_version.py @@ -1,12 +1 @@ -from pathlib import Path - -try: - import toml - - pyproject_toml_file = Path(__file__).parents[1] / "pyproject.toml" - data = toml.load(pyproject_toml_file) - __version__ = data["project"]["version"] -except ImportError: - import importlib.metadata - - __version__ = importlib.metadata.version("torchflows") +__version__ = "v1.1.0"