Skip to content

Commit

Permalink
fix the version comparison for importlib usage
Browse files Browse the repository at this point in the history
This commit uses the python version 3.8 as
last version to use `importlib_metadata`.
The previous code tried to use
`importlib_metadata` on python 3.9, which
fails.

The commit also adapts the `entry_points()`
calls in  `get_extractor_class` to python 3.9,
where `entry_points` does not support
keyword-arguments
  • Loading branch information
christian-monch committed Jan 16, 2024
1 parent 398445c commit ad855b8
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion datalad_metalad/extractors/tests/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import sys

import pytest
if sys.version_info < (3, 10):
if sys.version_info < (3, 9):
from importlib_metadata import entry_points
else:
from importlib.metadata import entry_points
Expand Down
2 changes: 1 addition & 1 deletion datalad_metalad/filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ def run_filter(filter_name: str,

def get_filter_class(filter_name: str) -> Type[MetadataFilterBase]:
""" Get a filter class from its name"""
if sys.version_info < (3, 10):
if sys.version_info < (3, 9):
from importlib_metadata import entry_points
else:
from importlib.metadata import entry_points
Expand Down
2 changes: 1 addition & 1 deletion datalad_metalad/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from pathlib import Path
from typing import Dict, List, Union

if sys.version_info < (3, 10):
if sys.version_info < (3, 9):
from importlib_resources import files
else:
from importlib.resources import files
Expand Down
1 change: 1 addition & 0 deletions requirements-devel.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ coverage
datalad>=0.18
datalad-metadata-model>=0.3.10
importlib-resources
importlib-metadata
sphinx>=1.7.8
sphinx-rtd-theme
pre-commit
Expand Down
8 changes: 5 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
datalad>=0.18
sphinx>=1.7.8
sphinx-rtd-theme
datalad-metadata-model>=0.3.10
importlib-resources
importlib-metadata
pytest
pyyaml
datalad-metadata-model>=0.3.10
sphinx>=1.7.8
sphinx-rtd-theme

0 comments on commit ad855b8

Please sign in to comment.