diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 70e02b5..b767a42 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -15,7 +15,7 @@ jobs: strategy: matrix: - python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12'] + python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12', '3.13'] steps: - name: Git checkout @@ -44,4 +44,4 @@ jobs: # stop the build if there are Python syntax errors or undefined names flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - flake8 . --count --exit-zero --max-complexity=12 --max-line-length=127 --statistics \ No newline at end of file + flake8 . --count --exit-zero --max-complexity=12 --max-line-length=127 --statistics diff --git a/CHANGELOG.rst b/CHANGELOG.rst index ecc8b13..c011e7f 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -12,10 +12,12 @@ This change log uses principles from `keep a changelog = Python 3.8 Deprecated ^^^^^^^^^^ diff --git a/dtoolcore/__init__.py b/dtoolcore/__init__.py index 9e4cc76..7516612 100644 --- a/dtoolcore/__init__.py +++ b/dtoolcore/__init__.py @@ -3,6 +3,7 @@ """ import os +import sys import datetime import logging @@ -11,7 +12,6 @@ import tempfile import uuid -from pkg_resources import iter_entry_points from collections import defaultdict import dtoolcore.utils @@ -59,7 +59,19 @@ def _generate_storage_broker_lookup(): """Return dictionary of available storage brokers.""" logger.debug("In _generate_storage_broker_lookup...") storage_broker_lookup = dict() - for entrypoint in iter_entry_points("dtool.storage_brokers"): + + if sys.version_info >= (3, 8): + from importlib.metadata import entry_points + eps = entry_points() + if sys.version_info >= (3, 10): + entrypoints = eps.select(group="dtool.storage_brokers") + else: + entrypoints = eps.get("dtool.storage_brokers", []) + else: + from pkg_resources import iter_entry_points + entrypoints = iter_entry_points("dtool.storage_brokers") + + for entrypoint in entrypoints: StorageBroker = entrypoint.load() key = StorageBroker.key logger.debug("_gnerate_stroage_broker_lookup.key: {}".format(key))