Skip to content

Commit

Permalink
Merge pull request #130 from bioimage-io/fix-python-3.13
Browse files Browse the repository at this point in the history
Support python 3.13+
  • Loading branch information
oeway authored May 20, 2024
2 parents 50b0d70 + 2eececd commit 1803c1c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion bioimageio_chatbot/chatbot_extensions/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import asyncio
import re
import pkgutil
import importlib.util
from pydantic import BaseModel
from bioimageio_chatbot.utils import ChatbotExtension
from bioimageio_chatbot.jsonschema_pydantic import json_schema_to_pydantic_model
Expand All @@ -10,7 +11,13 @@ def get_builtin_extensions():
extensions = []
for module in pkgutil.walk_packages(__path__, __name__ + '.'):
if module.name.endswith('_extension'):
ext_module = module.module_finder.find_module(module.name).load_module(module.name)
if hasattr(module.module_finder, 'find_module'):
ext_module = module.module_finder.find_module(module.name).load_module(module.name)
else:
# for newer python versions, find_spec is used instead of find_module
module_spec = importlib.util.find_spec(module.name)
ext_module = importlib.util.module_from_spec(module_spec)
module_spec.loader.exec_module(ext_module)
exts = ext_module.get_extension() or []
if isinstance(exts, ChatbotExtension):
exts = [exts]
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ requires = ["setuptools", "wheel"]

[project]
name = "bioimageio-chatbot"
version = "0.1.98"
version = "0.1.99"
readme = "README.md"
description = "Your Personal Assistant in Computational BioImaging."
dependencies = [
Expand Down

0 comments on commit 1803c1c

Please sign in to comment.