Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try importlib.metadata as alternative to pkg_resources #68

Merged
merged 1 commit into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading