Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Klaus Zimmermann
climix
Commits
2572e947
Commit
2572e947
authored
Jul 16, 2021
by
Klaus Zimmermann
Browse files
Replace pkg_resources with importlib.metadata for entry points (closes
#225
)
parent
cf550abf
Changes
2
Hide whitespace changes
Inline
Side-by-side
climix/metadata.py
View file @
2572e947
...
...
@@ -9,10 +9,10 @@ import logging
import
os
import
re
import
string
import
sys
from
typing
import
Any
,
List
,
Mapping
,
Optional
,
Union
import
iris
import
pkg_resources
import
xdg.BaseDirectory
import
yaml
...
...
@@ -20,6 +20,13 @@ from .index import Index
from
.period
import
PeriodSpecification
if
sys
.
version_info
[:
2
]
>=
(
3
,
10
):
# pylint: disable=no-name-in-module
from
importlib.metadata
import
entry_points
else
:
from
importlib_metadata
import
entry_points
@
dataclass
class
CellMethod
:
name
:
str
...
...
@@ -355,9 +362,7 @@ class IndexCatalog:
def
build_index_function
(
spec
):
name
=
spec
.
name
candidates
=
list
(
pkg_resources
.
iter_entry_points
(
"climix.index_functions"
,
name
=
name
)
)
candidates
=
list
(
entry_points
(
group
=
"climix.index_functions"
,
name
=
name
))
if
len
(
candidates
)
==
0
:
raise
ValueError
(
f
"No implementation found for index_function <
{
name
}
>"
)
elif
len
(
candidates
)
>
1
:
...
...
setup.py
View file @
2572e947
...
...
@@ -36,6 +36,7 @@ setuptools.setup(
"dask>=2.4.0"
,
"dask-jobqueue"
,
"distributed>=2.4.0"
,
'importlib_metadata>=4.4; python_version < "2.10"'
,
"numpy"
,
"pyxdg"
,
"PyYAML"
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment