From 9c690805fbb9cba842210111a079f932fccca159 Mon Sep 17 00:00:00 2001
From: Daniel Nilsson <daniel.k.nilsson@gmail.com>
Date: Thu, 24 Oct 2024 13:01:30 +0200
Subject: [PATCH] latest major in docker, actions. releasing most requirement
 constraints. pkg_resources deprecated - move version.

---
 .github/workflows/build_and_publish.yml |  4 ++--
 Dockerfile.pytest                       |  2 +-
 genmod/__init__.py                      | 18 +++++-------------
 genmod/__version__.py                   |  1 +
 requirements.txt                        | 16 ++++++++--------
 setup.py                                |  5 ++++-
 6 files changed, 21 insertions(+), 25 deletions(-)
 create mode 100644 genmod/__version__.py

diff --git a/.github/workflows/build_and_publish.yml b/.github/workflows/build_and_publish.yml
index 95331bb..c4e62f1 100644
--- a/.github/workflows/build_and_publish.yml
+++ b/.github/workflows/build_and_publish.yml
@@ -15,10 +15,10 @@ jobs:
    - name: Check out git repository
      uses: actions/checkout@v4
 
-   - name: Set up Python 3.12
+   - name: Set up Python 3.13
      uses: actions/setup-python@v5
      with:
-      python-version: 3.12
+      python-version: 3.13
 
    - name: Install build tools
      run: >-
diff --git a/Dockerfile.pytest b/Dockerfile.pytest
index 6935d10..5043d01 100644
--- a/Dockerfile.pytest
+++ b/Dockerfile.pytest
@@ -1,5 +1,5 @@
 # Dockerfile to run genmod pytest suite
-FROM python:3.12
+FROM python:3.13
 
 RUN mkdir -p /genmod
 
diff --git a/genmod/__init__.py b/genmod/__init__.py
index 9a5e744..e30b8ca 100644
--- a/genmod/__init__.py
+++ b/genmod/__init__.py
@@ -1,14 +1,6 @@
-from __future__ import (print_function, absolute_import)
-from logging import getLogger
-from pkg_resources import get_distribution, DistributionNotFound
-from os import environ
-
-logger = getLogger(__name__)
-
 try:
-    __version__ = get_distribution("genmod").version
-except DistributionNotFound as error:
-    # Genmod is not installed (as the case for docker test suite)
-    if 'GENMOD_DOCKER_TEST' not in environ.keys():
-        raise error
-    __version__ = '-1.-1.-1'
+    from importlib.metadata import version
+except ImportError:  # Backport support for importlib metadata on Python 3.7
+    from importlib_metadata import version
+
+__version__ = version("genmod")
diff --git a/genmod/__version__.py b/genmod/__version__.py
new file mode 100644
index 0000000..bbb7fa0
--- /dev/null
+++ b/genmod/__version__.py
@@ -0,0 +1 @@
+__version__ = "3.9"
\ No newline at end of file
diff --git a/requirements.txt b/requirements.txt
index 6028fc9..24cea6e 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,10 +1,10 @@
-ped_parser == 1.6.6
-pytabix == 0.1
-pytest == 7.3.1
+ped_parser
+pytabix
+pytest
 interval_tree == 0.3.4
-click == 8.1.3
-configobj == 5.0.8
+click
+configobj
 intervaltree == 3.1.0
-extract_vcf == 0.5
-vcftoolbox == 1.5.1
-six == 1.16.0
+extract_vcf
+vcftoolbox
+six
diff --git a/setup.py b/setup.py
index 4140e42..1528a45 100644
--- a/setup.py
+++ b/setup.py
@@ -5,7 +5,10 @@
     from setuptools import setup, find_packages
 except ImportError:
     from distutils.core import setup
-import pkg_resources
+
+about = {}
+with open(os.path.join(os.path.abspath(os.path.dirname(__file__)), "genmod", "__version__.py")) as f:
+    exec(f.read(), about)
 
 # Shortcut for building/publishing to Pypi
 if sys.argv[-1] == 'publish':