From 8a9a4fd48d6fb8fbf2832c3bd85c347adf51fb19 Mon Sep 17 00:00:00 2001
From: Padraig Gleeson
Date: Wed, 29 Apr 2026 17:32:08 +0100
Subject: [PATCH 1/2] Update contribs
---
docs/sphinx/source/api/Contributors.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/sphinx/source/api/Contributors.md b/docs/sphinx/source/api/Contributors.md
index 93c1be9..c2d3f40 100644
--- a/docs/sphinx/source/api/Contributors.md
+++ b/docs/sphinx/source/api/Contributors.md
@@ -3,7 +3,7 @@
# Modelspec contributors
This page list names and Github profiles of contributors to Modelspec, listed in no particular order.
-This page is generated periodically, most recently on 2026-03-18.
+This page is generated periodically, most recently on 2026-04-29.
- Padraig Gleeson ([@pgleeson](https://github.com/pgleeson))
- Manifest Chakalov ([@mqnifestkelvin](https://github.com/mqnifestkelvin))
From ed1552c61ac83dc81097b4ce15bd16adc717d841 Mon Sep 17 00:00:00 2001
From: Padraig Gleeson
Date: Wed, 29 Apr 2026 17:38:31 +0100
Subject: [PATCH 2/2] Fix for longstanding documentation generation issue in
py3.10+
---
src/modelspec/base_types.py | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/src/modelspec/base_types.py b/src/modelspec/base_types.py
index 7b15e6c..9b31e9c 100644
--- a/src/modelspec/base_types.py
+++ b/src/modelspec/base_types.py
@@ -665,12 +665,10 @@ def _type_to_str(type_: Any) -> str:
A string with a prettier format of the type annotation.
"""
- # If the type as a __name__ attribute, use that
- if hasattr(type_, "__name__"):
- return type_.__name__
-
- # If its a Generic type
- elif get_origin(type_) is not None:
+ # If it's a Generic type, unwrap it first.
+ # Note: on Python 3.10+, typing aliases like List[X] have a __name__ attribute
+ # ("List"), so this must be checked before the __name__ shortcut below.
+ if get_origin(type_) is not None:
if get_origin(type_) is list and len(get_args(type_)) > 0:
return Base._type_to_str(get_args(type_)[0])
elif get_origin(type_) is dict and len(get_args(type_)) > 0:
@@ -682,6 +680,10 @@ def _type_to_str(type_: Any) -> str:
+ "]"
)
+ # If the type has a __name__ attribute, use that
+ if hasattr(type_, "__name__"):
+ return type_.__name__
+
# Fallback to returning just the string representation. Drop any occurrence of typing
return str(type_).replace("typing.", "")