From 0300a20df19f7316a14a3d2bd0a519eb717fba6d Mon Sep 17 00:00:00 2001 From: Sean Freeman Date: Fri, 1 Nov 2024 14:11:48 -0500 Subject: [PATCH 1/8] add pyproject.toml --- pyproject.toml | 44 ++++++++++++++++++++++++++++++++++++++++++++ setup.py | 16 ---------------- 2 files changed, 44 insertions(+), 16 deletions(-) create mode 100644 pyproject.toml diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..530f8763 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,44 @@ +[build-system] +requires = ["setuptools"] +build-backend = "setuptools.build_meta" + +[project] +name = "tobac" +authors = [ + { name="Max Heikenfeld", email="max.heikenfeld@physics.ox.ac.uk" }, + { name="William Jones", email="william.jones@physics.ox.ac.uk" }, + { name="Fabian Senf", email="senf@tropos.de" }, + { name="Sean Freeman", email="sean.freeman@uah.edu" }, + { name="Julia Kukulies", email="kukulies@ucar.edu" }, + { name="Kelcy Brunner", email="Kelcy.Brunner@ttu.edu" }, +] +description = "A package for identifying and tracking atmospheric phenomena" +readme = "README.md" +requires-python = ">=3.7" +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Environment :: Console", + "Intended Audience :: Education", + "Intended Audience :: Science/Research", + "Intended Audience :: Developers", + "License :: OSI Approved :: BSD License", + "Operating System :: POSIX :: Linux", + "Operating System :: MacOS :: MacOS X", + "Operating System :: Microsoft :: Windows", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Topic :: Scientific/Engineering", + "Topic :: Scientific/Engineering :: Atmospheric Science", +] + +[project.urls] +Homepage = "http://github.com/tobac-project/tobac" +Documentation = "http://tobac.io" +Issues = "http://github.com/tobac-project/tobac/issues" diff --git a/setup.py b/setup.py index 2339a6ca..de9cb549 100644 --- a/setup.py +++ b/setup.py @@ -77,22 +77,6 @@ def get_packages(package_name): description="Tracking and object-based analysis of clouds", url="http://github.com/tobac-project/tobac", classifiers=CLASSIFIERS, - author=[ - "Max Heikenfeld", - "William Jones", - "Fabian Senf", - "Sean Freeman", - "Julia Kukulies", - "Peter Marinescu", - ], - author_email=[ - "max.heikenfeld@physics.ox.ac.uk", - "william.jones@physics.ox.ac.uk", - "senf@tropos.de", - "sean.freeman@uah.edu", - "julia.kukulies@gu.se", - "peter.marinescu@colostate.edu", - ], license="BSD-3-Clause License", packages=get_packages(PACKAGE_NAME), install_requires=get_requirements("requirements.txt"), From 673aa2718cd350824f7e105f04f9a5fffb39a758 Mon Sep 17 00:00:00 2001 From: Sean Freeman Date: Fri, 1 Nov 2024 14:27:42 -0500 Subject: [PATCH 2/8] add version number to toml file --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 530f8763..7d85d40a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,6 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "tobac" +version = "1.5.4" authors = [ { name="Max Heikenfeld", email="max.heikenfeld@physics.ox.ac.uk" }, { name="William Jones", email="william.jones@physics.ox.ac.uk" }, From 92accea201a13862bb71b821397ae3ef5ae85ff5 Mon Sep 17 00:00:00 2001 From: Sean Freeman Date: Fri, 1 Nov 2024 14:45:20 -0500 Subject: [PATCH 3/8] fixes to setup.py with definitions moved to pyproject.toml --- setup.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/setup.py b/setup.py index de9cb549..ae802c64 100644 --- a/setup.py +++ b/setup.py @@ -72,12 +72,6 @@ def get_packages(package_name): setup( - name=PACKAGE_NAME, - version=get_version(PACKAGE_NAME), - description="Tracking and object-based analysis of clouds", - url="http://github.com/tobac-project/tobac", - classifiers=CLASSIFIERS, - license="BSD-3-Clause License", packages=get_packages(PACKAGE_NAME), install_requires=get_requirements("requirements.txt"), test_requires=["pytest"], From 04f09e0777a172f3d6ea0d2b15f5617070139b96 Mon Sep 17 00:00:00 2001 From: Sean Freeman Date: Wed, 16 Jul 2025 09:45:41 -0500 Subject: [PATCH 4/8] update init to pull version from pyproject.toml --- pyproject.toml | 2 +- tobac/__init__.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 7d85d40a..24d5617a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "tobac" -version = "1.5.4" +version = "1.6.0" authors = [ { name="Max Heikenfeld", email="max.heikenfeld@physics.ox.ac.uk" }, { name="William Jones", email="william.jones@physics.ox.ac.uk" }, diff --git a/tobac/__init__.py b/tobac/__init__.py index 646e620a..d7c548b1 100644 --- a/tobac/__init__.py +++ b/tobac/__init__.py @@ -81,6 +81,7 @@ from .wrapper import maketrack from .wrapper import tracking_wrapper from . import merge_split +import importlib.metadata # Set version number -__version__ = "1.6.0" +__version__ = importlib.metadata.version("tobac") From 11eeffc55bccd6f171060884408a03214f38bb0a Mon Sep 17 00:00:00 2001 From: Sean Freeman Date: Wed, 16 Jul 2025 09:49:59 -0500 Subject: [PATCH 5/8] fix to make sure it works with package install --- tobac/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tobac/__init__.py b/tobac/__init__.py index d7c548b1..d06b40f5 100644 --- a/tobac/__init__.py +++ b/tobac/__init__.py @@ -84,4 +84,5 @@ import importlib.metadata # Set version number -__version__ = importlib.metadata.version("tobac") +# This version should work without needing the package installed +__version__ = importlib.metadata.version(__package__ or __name__) From 0289b6c4ce1a0d86f65151317c5da4bbf4a3ad09 Mon Sep 17 00:00:00 2001 From: Sean Freeman Date: Thu, 17 Jul 2025 16:13:55 -0500 Subject: [PATCH 6/8] fix to version to read toml without installing --- tobac/__init__.py | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/tobac/__init__.py b/tobac/__init__.py index d06b40f5..c9cb928d 100644 --- a/tobac/__init__.py +++ b/tobac/__init__.py @@ -82,7 +82,28 @@ from .wrapper import tracking_wrapper from . import merge_split import importlib.metadata +import pathlib + +# default version number +__version__ = "unknown_dev_version" # Set version number # This version should work without needing the package installed -__version__ = importlib.metadata.version(__package__ or __name__) +try: + __version__ = importlib.metadata.version(__package__ or __name__) +except importlib.metadata.PackageNotFoundError: + # need to get version directly from text file + try: + import tomllib + + pyproject_toml_file_name = pathlib.Path(__file__).parent / "pyproject.toml" + if pyproject_toml_file_name.exists() and pyproject_toml_file_name.is_file(): + toml_data = tomllib.load(pyproject_toml_file_name) + if "project" in toml_data and "version" in toml_data["project"]: + version = toml_data["project"]["version"] + + except ImportError: + # on python <3.11 but not installing tobac. + # don't bother giving precise version number. + __version__ = "unknown_dev_version" + pass From 9ab6082f524247fb7db38fd6633ed1c0fafad182 Mon Sep 17 00:00:00 2001 From: Sean Freeman Date: Thu, 17 Jul 2025 16:17:49 -0500 Subject: [PATCH 7/8] add alternative version option --- tobac/tests/test_import.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tobac/tests/test_import.py b/tobac/tests/test_import.py index 03528ca9..d35ef0ff 100644 --- a/tobac/tests/test_import.py +++ b/tobac/tests/test_import.py @@ -18,4 +18,7 @@ def test_version(): # Make sure that we are following semantic versioning # i.e., our version is of form x.x.x, where x are all # integer numbers. - assert re.match(r"[0-9]+\.[0-9]+\.[0-9]+", tobac.__version__) is not None + assert ( + re.match(r"[0-9]+\.[0-9]+\.[0-9]+", tobac.__version__) is not None + or tobac.__version__ == "unknown_dev_version" + ) From b270b29a1f5a8dea4f2d7bbb02ec25b905704163 Mon Sep 17 00:00:00 2001 From: Sean Freeman Date: Fri, 18 Jul 2025 11:21:36 -0500 Subject: [PATCH 8/8] update version number --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 24d5617a..0cad0248 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "tobac" -version = "1.6.0" +version = "1.6.1" authors = [ { name="Max Heikenfeld", email="max.heikenfeld@physics.ox.ac.uk" }, { name="William Jones", email="william.jones@physics.ox.ac.uk" },