diff --git a/environment-dev.yml b/environment-dev.yml index c866439c..2e11fe35 100644 --- a/environment-dev.yml +++ b/environment-dev.yml @@ -3,7 +3,7 @@ channels: - conda-forge - defaults dependencies: - - python>=3.6,<3.11 + - python>=3.8,<3.11 - progressbar2 - numpy - spatialist>=0.12.1 diff --git a/environment-doc.yml b/environment-doc.yml index 59fe761d..509b43f6 100644 --- a/environment-doc.yml +++ b/environment-doc.yml @@ -3,7 +3,7 @@ channels: - conda-forge - defaults dependencies: - - python>=3.6,<3.11 + - python>=3.8,<3.11 - matplotlib - numpy - sphinx<7.0 # https://github.com/readthedocs/sphinx_rtd_theme/issues/1463 diff --git a/environment.yml b/environment.yml index 03a8b1f7..6a212bcc 100644 --- a/environment.yml +++ b/environment.yml @@ -3,7 +3,7 @@ channels: - conda-forge - defaults dependencies: - - python>=3.6,<3.11 # https://github.com/kvesteri/sqlalchemy-utils/issues/716 + - python>=3.8,<3.11 # https://github.com/kvesteri/sqlalchemy-utils/issues/716 - progressbar2 - numpy - spatialist>=0.12.1 diff --git a/pyproject.toml b/pyproject.toml index 91b9d243..950d8cb9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ requires = ["setuptools>=45", "setuptools_scm[toml]>=6.2", "wheel"] [project] name = "pyroSAR" description = "a framework for large-scale SAR satellite data processing" -requires-python = ">=3.6,<3.11" +requires-python = ">=3.8,<3.11" license = { file = "LICENSE.txt" } maintainers = [ { name = "John Truckenbrodt", email = "john.truckenbrodt@dlr.de" } diff --git a/pyroSAR/__init__.py b/pyroSAR/__init__.py index b7d839bf..5a6c08eb 100644 --- a/pyroSAR/__init__.py +++ b/pyroSAR/__init__.py @@ -1,18 +1,10 @@ from .drivers import * -import sys from . import ancillary, drivers -if sys.version_info >= (3, 8): - from importlib.metadata import version, PackageNotFoundError - try: - __version__ = version(__name__) - except PackageNotFoundError: - # package is not installed - pass -else: - from pkg_resources import get_distribution, DistributionNotFound - try: - __version__ = get_distribution(__name__).version - except DistributionNotFound: - # package is not installed - pass +from importlib.metadata import version, PackageNotFoundError + +try: + __version__ = version(__name__) +except PackageNotFoundError: + # package is not installed + pass diff --git a/pyroSAR/examine.py b/pyroSAR/examine.py index 33504f8d..01837d36 100644 --- a/pyroSAR/examine.py +++ b/pyroSAR/examine.py @@ -1,6 +1,6 @@ ############################################################################### # Examination of SAR processing software -# Copyright (c) 2019-2023, the pyroSAR Developers. +# Copyright (c) 2019-2024, the pyroSAR Developers. # This file is part of the pyroSAR Project. It is subject to the # license terms in the LICENSE.txt file found in the top-level @@ -19,7 +19,7 @@ import subprocess import warnings import subprocess as sp -import pkg_resources +import importlib.resources from pyroSAR._dev_config import ConfigHandler from spatialist.ancillary import finder, run @@ -71,14 +71,14 @@ def __init__(self): # point it to the default file delivered with pyroSAR if not hasattr(self, 'properties'): # log.info('using default properties file..') - template = os.path.join('snap', 'data', 'snap.auxdata.properties') - self.properties = pkg_resources.resource_filename(__name__, template) + dir_data = importlib.resources.files('pyroSAR') / 'snap' / 'data' + self.properties = str(dir_data / 'snap.auxdata.properties') # if the SNAP suffices attribute was not yet identified, # point it to the default file delivered with pyroSAR if not hasattr(self, 'suffices'): - template = os.path.join('snap', 'data', 'snap.suffices.properties') - fname_suffices = pkg_resources.resource_filename(__name__, template) + dir_data = importlib.resources.files('pyroSAR') / 'snap' / 'data' + fname_suffices = str(dir_data / 'snap.suffices.properties') with open(fname_suffices, 'r') as infile: content = infile.read().split('\n') self.__suffices = {k: v for k, v in [x.split('=') for x in content]} @@ -381,6 +381,7 @@ class ExamineGamma(object): >>> print(config.version) """ + def __init__(self): home_sys = os.environ.get('GAMMA_HOME') if home_sys is not None and not os.path.isdir(home_sys):