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

refactor: pkg_resources -> importlib.metadata #24514

Merged
merged 2 commits into from
Jun 28, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 3 additions & 1 deletion requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,9 @@ humanize==3.11.0
idna==3.2
# via email-validator
importlib-metadata==6.6.0
# via flask
# via
# apache-superset
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes!

# flask
importlib-resources==5.12.0
# via limits
isodate==0.6.0
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ def get_git_sha() -> str:
"hashids>=1.3.1, <2",
"holidays>=0.23, <0.24",
"humanize",
"importlib_metadata",
"isodate",
"Mako>=1.2.2",
"markdown>=3.0",
Expand Down
6 changes: 3 additions & 3 deletions superset/db_engine_specs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@
import pkgutil
from collections import defaultdict
from importlib import import_module
from importlib_metadata import entry_points
from pathlib import Path
from typing import Any, Optional

import sqlalchemy.databases
import sqlalchemy.dialects
from pkg_resources import iter_entry_points
from sqlalchemy.engine.default import DefaultDialect
from sqlalchemy.engine.url import URL

Expand Down Expand Up @@ -74,7 +74,7 @@ def load_engine_specs() -> list[type[BaseEngineSpec]]:
if is_engine_spec(getattr(module, attr))
)
# load additional engines from external modules
for ep in iter_entry_points("superset.db_engine_specs"):
for ep in entry_points(group="superset.db_engine_specs"):
try:
engine_spec = ep.load()
except Exception: # pylint: disable=broad-except
Expand Down Expand Up @@ -150,7 +150,7 @@ def get_available_engine_specs() -> dict[type[BaseEngineSpec], set[str]]:
drivers[attr].add(attribute.dialect.driver)

# installed 3rd-party dialects
for ep in iter_entry_points("sqlalchemy.dialects"):
for ep in entry_points(group="sqlalchemy.dialects"):
try:
dialect = ep.load()
except Exception as ex: # pylint: disable=broad-except
Expand Down
1 change: 0 additions & 1 deletion tests/unit_tests/db_engine_specs/test_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@


import pytest
from pkg_resources import EntryPoint
from pytest_mock import MockFixture

from superset.db_engine_specs import get_available_engine_specs
Expand Down