Skip to content

Commit

Permalink
🔧🚧 version sensible Py3.11/12
Browse files Browse the repository at this point in the history
  • Loading branch information
vokimon committed Dec 4, 2024
1 parent feb0491 commit e97ab14
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
#- '3.8' # oldest supported Py3 gha
#- '3.9' # newest passing Py3, reason: pyyaml binaries
- '3.11' # newest passing Py3, reason: pyyaml binaries
#- '3' # newest supported Py3
- '3' # newest supported Py3
name: Python ${{ matrix.python-version }}
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
Expand Down
37 changes: 28 additions & 9 deletions customblocks/entrypoints.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,35 @@
import sys

def load_entry_points(group):
# The api that allows selecting groups more easily
# is not available in Py3.9 and earlier.
# The api that allows selecting groups more easily
# is not available in Py3.9 and earlier.

def iter_entry_points_group__pkg_resources(group):
""" This is the old version, everyone loved, or not
but now is deprecated in setuptools. It worked
in Py2.7 and older Py3
"""

from pkg_resources import entry_points
for entry in entry_points(group=group):
yield entry

def iter_entry_points_group__importlib_selectable(group):
""" This is the brand new api that does not
work in all still supported Py3 versions."""

from importlib.metadata import entry_points
for entry in entry_points(group=group):
yield entry

def iter_entry_points(group):
if sys.version_info < (3,0):
return iter_entry_points_group__pkg_resources(group)
return iter_entry_points_group__importlib_selectable(group)

def load_entry_points(group):
return dict(
(entry.name, entry.load())
for entry in entry_points()
if entry.group == group
for entry in iter_entry_points(group)
)






0 comments on commit e97ab14

Please sign in to comment.