Skip to content

Commit

Permalink
Merge pull request #68 from vreuter/vr/issue67
Browse files Browse the repository at this point in the history
Try `importlib.metadata` as alternative to `pkg_resources`
  • Loading branch information
donaldcampbelljr authored Mar 5, 2024
2 parents f31c3bf + fc7006c commit 68ac5b2
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 12 deletions.
15 changes: 9 additions & 6 deletions eido/conversion.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import inspect
import sys
import os
from logging import getLogger

from pkg_resources import iter_entry_points
if sys.version_info < (3, 10):
from importlib_metadata import entry_points
else:
from importlib.metadata import entry_points
import inspect
from logging import getLogger
import os
from typing import NoReturn

from .exceptions import *
from typing import NoReturn

_LOGGER = getLogger(__name__)

Expand All @@ -21,7 +24,7 @@ def pep_conversion_plugins():
:raise EidoFilterError: if any of the filters has an invalid signature.
"""
plugins = {}
for ep in iter_entry_points("pep.filters"):
for ep in entry_points(group="pep.filters"):
plugin_fun = ep.load()
if len(list(inspect.signature(plugin_fun).parameters)) != 2:
raise EidoFilterError(
Expand Down
15 changes: 9 additions & 6 deletions eido/conversion_plugins.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
""" built-in PEP filters """

from typing import Dict
from .output_formatters import MultilineOutputFormatter

Expand Down Expand Up @@ -73,10 +74,12 @@ def processed_pep_filter(p, **kwargs) -> Dict[str, str]:

return {
"project": str(prj_repr),
"samples": str(p.samples)
if samples_as_objects
else str(p.sample_table.to_csv()),
"subsamples": str(p.subsamples)
if subsamples_as_objects
else str(p.subsample_table.to_csv()),
"samples": (
str(p.samples) if samples_as_objects else str(p.sample_table.to_csv())
),
"subsamples": (
str(p.subsamples)
if subsamples_as_objects
else str(p.subsample_table.to_csv())
),
}
1 change: 1 addition & 0 deletions requirements/requirements-all.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
importlib-metadata; python_version < '3.10'
jsonschema>=3.0.1
logmuse>=0.2.5
pandas
Expand Down

0 comments on commit 68ac5b2

Please sign in to comment.