-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Description
I encountered the following error when running a Django project that uses Wireup on Python 3.14:
TypeError: Cannot subclass ForwardRef
This occurs because the eval_type_backport package, which Wireup depends on, tries to subclass typing.ForwardRef. In Python 3.14, subclassing ForwardRef is no longer allowed, causing this TypeError.
Traceback (excerpt)
File ".../wireup/ioc/util.py", line 95, in ensure_is_type
import eval_type_backport
...
File ".../eval_type_backport/eval_type_backport.py", line 174, in <module>
class ForwardRef(typing.ForwardRef, _root=True): # type: ignore[call-arg,misc]
...
File ".../cpython@3.14.0/Lib/annotationlib.py", line 96, in __init_subclass__
raise TypeError("Cannot subclass ForwardRef")
TypeError: Cannot subclass ForwardRef
Environment
- Python:
3.14.0 - Django:
5.2.8 - Wireup:
wireup[eval-type] >= 2.1.0
Steps to Reproduce
- Install and use Python 3.14.
- Set up a Django project with Wireup integration (including the
[eval-type]extra). - Start the server or trigger app registry loading.
- The error appears during startup.
Workarounds & Solution
Attempted (but failed)
- Disabling the
[eval-type]extra:
Installingwireupwithout[eval-type]avoids importingeval_type_backport, but results in a new error:wireup.errors.WireupError: Using __future__ annotations in Wireup requires the eval_type_backport package to be installed. See: https://maldoinc.github.io/wireup/latest/future_annotations/
(because Wireup still tries to import it internally when type evaluation is needed.)
Working Solution
Downgrade to Python 3.13
After switching to Python 3.13, the error disappears completely, and the application starts normally.
Thank you in advance.
Metadata
Metadata
Assignees
Labels
No labels