-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #43 from mxstack/42
fixes #42: no pkg_resources on Python 3.12
- Loading branch information
Showing
13 changed files
with
80 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,5 +10,5 @@ build/ | |
constraints-mxdev.txt | ||
example/*-outfile.txt | ||
requirements-mxdev.txt | ||
venv/ | ||
.venv/ | ||
dist/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# this is a helper to load entrypoints with importlib, since pkg_resources | ||
# is deprecated. In Python 3.12 an API incompatible change was introduced, | ||
# so this code is that ugly now. | ||
from importlib.metadata import entry_points | ||
|
||
|
||
try: | ||
# do we have Python 3.12+? | ||
from importlib.metadata import EntryPoints # type: ignore # noqa: F401 | ||
|
||
HAS_IMPORTLIB_ENTRYPOINTS = True | ||
except ImportError: | ||
HAS_IMPORTLIB_ENTRYPOINTS = False | ||
|
||
|
||
def load_eps_by_group(group: str) -> list: | ||
if HAS_IMPORTLIB_ENTRYPOINTS: | ||
eps = entry_points(group=group) # type: ignore | ||
else: | ||
eps_base = entry_points() | ||
if group not in eps_base: | ||
return [] | ||
eps = eps_base[group] # type: ignore | ||
# XXX: for some reasons entry points are loaded twice. not sure if this | ||
# is a glitch when installing with uv or something related to | ||
# importlib.metadata.entry_points | ||
return list(set(eps)) # type: ignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,8 @@ envlist = | |
py38 | ||
py39 | ||
py310 | ||
py311 | ||
py312 | ||
minversion = 3.25.0 | ||
requires = | ||
virtualenv >= 20.14.1 | ||
|