Skip to content

Fix Python 3.9 type hint syntax evaluation errors - #1

Merged
thesk7828 merged 1 commit into
mainfrom
fix/python-39-type-hints
Apr 15, 2026
Merged

thesk7828 merged 1 commit into
mainfrom
fix/python-39-type-hints

Conversation

@thesk7828

Copy link
Copy Markdown
Owner

Reference: Fail to launch the server

  • Updates all SQLAlchemy models to use Optional[X] instead of X | None to maintain backwards compatibility with Python 3.9 when Mapped type hints are dynamically evaluated.
  • Installs eval-type-backport in requirements.txt to allow Pydantic to safely parse X | None types dynamically under Python 3.9.

Background: While Python 3.9 supports the PEP 563 stringified union type hints natively when skipping evaluation, robust systems like SQLAlchemy 2.0 and Pydantic dynamically invoke eval() on these annotations at runtime. Evaluating str | None using type objects without Python 3.10 produces an immediate TypeError. This was silently preventing developers on Python 3.9 from successfully executing scripts/start.sh during the SQLite database schema setup and artifact seeding.

- Updates all SQLAlchemy models to use Optional[X] instead of X | None to maintain backwards compatibility with Python 3.9 when Mapped type hints are dynamically evaluated.
- Installs eval-type-backport in requirements.txt to allow Pydantic to safely parse X | None types dynamically under Python 3.9.
@thesk7828
thesk7828 merged commit db3f0ae into main Apr 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant