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

Revert importlib.metadata workaround #9658

Merged
merged 5 commits into from Nov 16, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 3 additions & 5 deletions dask/compatibility.py
@@ -1,8 +1,6 @@
import importlib.metadata
import sys

# FIXME importing importlib.metadata fails when running the entire test suite with UPSTREAM_DEV=1
from importlib import metadata as importlib_metadata

from packaging.version import parse as parse_version

_PY_VERSION = parse_version(".".join(map(str, sys.version_info[:3])))
Expand All @@ -18,9 +16,9 @@ def entry_points(group=None):
This compatibility utility can be removed once Python 3.10 is the minimum.
"""
if _PY_VERSION >= parse_version("3.10"):
return importlib_metadata.entry_points(group=group)
return importlib.metadata.entry_points(group=group)
else:
eps = importlib_metadata.entry_points()
eps = importlib.metadata.entry_points()
if group:
return eps.get(group, [])
return eps
12 changes: 5 additions & 7 deletions dask/tests/test_cli.py
@@ -1,10 +1,8 @@
import importlib.metadata
import json
import platform
import sys

# FIXME importing importlib.metadata fails when running the entire test suite with UPSTREAM_DEV=1
from importlib import metadata as importlib_metadata

import click
import pytest
from click.testing import CliRunner
Expand Down Expand Up @@ -64,13 +62,13 @@ def good_command_2():
def test_register_command_ep():
from dask.cli import _register_command_ep

bad_ep = importlib_metadata.EntryPoint(
bad_ep = importlib.metadata.EntryPoint(
name="bad",
value="dask.tests.test_cli:bad_command",
group="dask_cli",
)

good_ep = importlib_metadata.EntryPoint(
good_ep = importlib.metadata.EntryPoint(
name="good",
value="dask.tests.test_cli:good_command",
group="dask_cli",
Expand All @@ -92,13 +90,13 @@ def dummy_cli_2():
def test_repeated_name_registration_warn():
from dask.cli import _register_command_ep

one = importlib_metadata.EntryPoint(
one = importlib.metadata.EntryPoint(
name="one",
value="dask.tests.test_cli:good_command",
group="dask_cli",
)

two = importlib_metadata.EntryPoint(
two = importlib.metadata.EntryPoint(
name="two",
value="dask.tests.test_cli:good_command_2",
group="dask_cli",
Expand Down