Skip to content

Commit

Permalink
Support python 3.12 for the entry points (#188)
Browse files Browse the repository at this point in the history
* Support Python 3.12 for the entry points
* add test for Python 3.12 and AiiDA 2.6
  • Loading branch information
superstar54 authored Jul 19, 2024
1 parent 5937b88 commit 50728f6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: ci

on: [push, pull_request]
on: [pull_request]

jobs:

Expand Down Expand Up @@ -36,8 +36,8 @@ jobs:

strategy:
matrix:
python-version: ['3.9', '3.11']
aiida-core-version: ['2.4', '2.5']
python-version: ['3.9', '3.11', '3.12']
aiida-core-version: ['2.5', '2.6']

services:
postgres:
Expand Down
8 changes: 7 additions & 1 deletion aiida_workgraph/orm/serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from importlib.metadata import entry_points
from typing import Any
from aiida_workgraph.config import load_config
import sys


def get_serializer_from_entry_points() -> dict:
Expand All @@ -14,8 +15,13 @@ def get_serializer_from_entry_points() -> dict:
serializers = configs.get("serializers", {})
excludes = serializers.get("excludes", [])
# Retrieve the entry points for 'aiida.data' and store them in a dictionary
eps = entry_points()
if sys.version_info >= (3, 10):
group = eps.select(group="aiida.data")
else:
group = eps.get("aiida.data", [])
eps = {}
for ep in entry_points().get("aiida.data", []):
for ep in group:
# split the entry point name by first ".", and check the last part
key = ep.name.split(".", 1)[-1]
# skip key without "." because it is not a module name for a data type
Expand Down

0 comments on commit 50728f6

Please # to comment.