From 411f5763eeccb49b88036a7f82d14b06ebd3899b Mon Sep 17 00:00:00 2001 From: Torsten Stoeter Date: Wed, 11 Dec 2024 17:18:58 +0100 Subject: [PATCH 1/3] Replace entrypoints module with importlib --- pyproject.toml | 3 +-- src/omero_rdf/__init__.py | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 420abd8..2f5db02 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -19,8 +19,7 @@ requires-python = ">3.8" dependencies = [ "omero-py>=5.8", - "entrypoints", - "types-entrypoints", + "importlib-metadata", "future", "rdflib", "pyld", diff --git a/src/omero_rdf/__init__.py b/src/omero_rdf/__init__.py index 3bf69ab..76ecc4f 100644 --- a/src/omero_rdf/__init__.py +++ b/src/omero_rdf/__init__.py @@ -28,7 +28,7 @@ from functools import wraps from typing import Any, Callable, Dict, Generator, List, Optional, Set, Tuple, Union -import entrypoints +from importlib.metadata import entry_points from omero.cli import BaseControl, Parser, ProxyStringType from omero.gateway import BlitzGateway, BlitzObjectWrapper from omero.model import Dataset, Image, IObject, Plate, Project, Screen @@ -318,7 +318,7 @@ def descending(self): def load_handlers(self) -> Handlers: annotation_handlers: Handlers = [] - for ep in entrypoints.get_group_all("omero_rdf.annotation_handler"): + for ep in entry_points(group='omero_rdf.annotation_handler'): ah_loader = ep.load() annotation_handlers.append(ah_loader(self)) # We know there are some built in handlers From 0f9c725d071ccf7e5f3908a78cfef063d127151e Mon Sep 17 00:00:00 2001 From: Josh Moore Date: Wed, 11 Dec 2024 17:40:23 +0100 Subject: [PATCH 2/3] Attempt to make black happy --- src/omero_rdf/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/omero_rdf/__init__.py b/src/omero_rdf/__init__.py index 76ecc4f..97783b5 100644 --- a/src/omero_rdf/__init__.py +++ b/src/omero_rdf/__init__.py @@ -318,7 +318,8 @@ def descending(self): def load_handlers(self) -> Handlers: annotation_handlers: Handlers = [] - for ep in entry_points(group='omero_rdf.annotation_handler'): + eps = entry_points() + for ep in eps.select(group='omero_rdf.annotation_handler'): ah_loader = ep.load() annotation_handlers.append(ah_loader(self)) # We know there are some built in handlers From be2805bae9e20a7c1392edc1b887cc8ebb0d3e74 Mon Sep 17 00:00:00 2001 From: Josh Moore Date: Wed, 11 Dec 2024 17:50:37 +0100 Subject: [PATCH 3/3] Use deprecated dict interface for 3.9 compatibility --- src/omero_rdf/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/omero_rdf/__init__.py b/src/omero_rdf/__init__.py index 97783b5..9f8c84b 100644 --- a/src/omero_rdf/__init__.py +++ b/src/omero_rdf/__init__.py @@ -319,7 +319,7 @@ def descending(self): def load_handlers(self) -> Handlers: annotation_handlers: Handlers = [] eps = entry_points() - for ep in eps.select(group='omero_rdf.annotation_handler'): + for ep in eps.get("omero_rdf.annotation_handler", []): ah_loader = ep.load() annotation_handlers.append(ah_loader(self)) # We know there are some built in handlers