Skip to content

Commit

Permalink
refactor: pkg_resources -> importlib.metadata (#24514)
Browse files Browse the repository at this point in the history
  • Loading branch information
cwegener authored Jun 28, 2023
1 parent 1e7ee8c commit f1b003f
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
4 changes: 3 additions & 1 deletion requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,9 @@ humanize==3.11.0
idna==3.2
# via email-validator
importlib-metadata==6.6.0
# via flask
# via
# apache-superset
# 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 @@ -37,7 +37,7 @@

import sqlalchemy.databases
import sqlalchemy.dialects
from pkg_resources import iter_entry_points
from importlib_metadata import 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

0 comments on commit f1b003f

Please sign in to comment.