From d691242b2e3a200faba174a2dc46a24d70f83826 Mon Sep 17 00:00:00 2001
From: Eric Gallimore <egallimore@whoi.edu>
Date: Fri, 23 Feb 2024 16:42:26 -0500
Subject: [PATCH] Updated setup to use pyproject.toml with setuptools_scm so
 that versions are automatically determined from git tags.

---
 .gitignore           |  2 +-
 acomms/micromodem.py |  9 +++++++++
 pyproject.toml       | 43 +++++++++++++++++++++++++++++++++++++++++++
 setup.cfg            | 27 ---------------------------
 setup.py             |  3 ---
 5 files changed, 53 insertions(+), 31 deletions(-)
 create mode 100644 pyproject.toml
 delete mode 100644 setup.cfg
 delete mode 100644 setup.py

diff --git a/.gitignore b/.gitignore
index da5de58..4c89c8d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,4 +3,4 @@
 /.idea
 /dist
 /*.egg-info
-
+acomms/_version.py
diff --git a/acomms/micromodem.py b/acomms/micromodem.py
index 2340dca..69d3e28 100644
--- a/acomms/micromodem.py
+++ b/acomms/micromodem.py
@@ -31,6 +31,13 @@ try:
 except ImportError:
     pass
 
+try:
+    from . import _version
+    pyacomms_version = _version.version
+except ImportError:
+    pyacomms_version = "unknown"
+
+
 # Convert a string to a byte listing
 toBytes = lambda inpStr: map(ord, inpStr)
 # Convert a list to a hex string (each byte == 2 hex chars)
@@ -193,6 +200,8 @@ class Micromodem(object):
         self.unified_log = unified_log
         self.config_data = {}
 
+        self._daemon_log.info(f"pyacomms version {pyacomms_version}")
+
     @property
     def api_level(self):
         return self._api_level
diff --git a/pyproject.toml b/pyproject.toml
new file mode 100644
index 0000000..98966d9
--- /dev/null
+++ b/pyproject.toml
@@ -0,0 +1,43 @@
+[project]
+name = "acomms"
+dynamic = ["version"]
+description = "WHOI Micromodem Interface Library and Tools"
+readme = "README.txt"
+keywords = ["Library", "Python Modules", "Scientific/Engineering"]
+classifiers = [
+    "Development Status :: 5 - Production/Stable",
+    "Intended Audience :: Developers",
+    "Intended Audience :: Science/Research",
+    "Programming Language :: Python :: 3.6",
+    "Topic :: Software Development :: Libraries :: Python Modules",
+    "Topic :: Scientific/Engineering",
+]
+requires-python = ">=3.6"
+dependencies = ["bidict", "bitstring >=3.0.0", "pyserial >=2.6", "isodate >=0.4.9", "crcmod >=1.7"]
+
+[[project.authors]]
+name = "Eric Gallimore"
+email = "egallimore@whoi.edu"
+
+[[project.authors]]
+name = "Caileigh Fitzgerald"
+email = "cfitzgerald@whoi.edu"
+
+[project.license]
+text = "LGPLv3+"
+
+[project.urls]
+homepage = "http://acomms.whoi.edu"
+
+[project.scripts]
+# No scripts for now; we may add scripts in /bin in a future release
+
+[project.optional-dependencies]
+# No optional dependencies
+
+[build-system]
+requires = ["setuptools>=64", "wheel", "setuptools_scm>=8"]
+build-backend = "setuptools.build_meta"
+
+[tool.setuptools_scm]
+write_to = "acomms/_version.py"
\ No newline at end of file
diff --git a/setup.cfg b/setup.cfg
deleted file mode 100644
index 0b38a15..0000000
--- a/setup.cfg
+++ /dev/null
@@ -1,27 +0,0 @@
-[metadata]
-name = acomms
-version = 2.6.0
-author = Eric Gallimore, Caileigh Fitzgerald
-author_email = pyacomms@whoi.edu, cfitzgerald@whoi.edu
-url = http://acomms.whoi.edu/
-license = LGPLv3+
-description = WHOI Micromodem Interface Library and Tools
-long_description = file: README.txt
-classifiers =
-    Development Status :: 5 - Production/Stable
-    Intended Audience :: Developers
-    Intended Audience :: Science/Research
-    License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)
-    Programming Language :: Python :: 3.6
-    Topic :: Software Development :: Libraries :: Python Modules
-    Topic :: Scientific/Engineering
-
-[options]
-python_requires = >=3.6
-packages = find:
-install_requires =
-    bidict
-    bitstring >= 3.0.0
-    pyserial >= 2.6
-    isodate >= 0.4.9
-    crcmod >= 1.7
diff --git a/setup.py b/setup.py
deleted file mode 100644
index e31fce4..0000000
--- a/setup.py
+++ /dev/null
@@ -1,3 +0,0 @@
-from setuptools import setup
-
-setup()
\ No newline at end of file
-- 
GitLab