Skip to content

fix: support typing.Self on Python 3.10 via typing_extensions#8351

Open
aryanputta wants to merge 4 commits intoai-dynamo:mainfrom
aryanputta:fix/typing-self-python310-compat
Open

fix: support typing.Self on Python 3.10 via typing_extensions#8351
aryanputta wants to merge 4 commits intoai-dynamo:mainfrom
aryanputta:fix/typing-self-python310-compat

Conversation

@aryanputta
Copy link
Copy Markdown

@aryanputta aryanputta commented Apr 19, 2026

Summary

Fixes #8322ImportError when running python3 -m dynamo.frontend on Python 3.10.

  • typing.Self was introduced in Python 3.11 (PEP 673)
  • config_base.py imported it unconditionally from typing, crashing on Python 3.10
  • Fix: guard with sys.version_info >= (3, 11), fall back to typing_extensions.Self which is already a transitive dependency via pydantic

Change:

import sys

if sys.version_info >= (3, 11):
    from typing import Self
else:
    from typing_extensions import Self

Test plan

  • python3.10 -c "from dynamo.common.configuration.config_base import ConfigBase" — no ImportError
  • python3.10 -m dynamo.frontend --help — prints help as expected
  • Existing Python 3.11+ behavior unchanged

Open in Devin Review

Summary by CodeRabbit

  • Chores
    • Enhanced Python version compatibility for type handling in internal configuration components.

@aryanputta aryanputta requested review from a team as code owners April 19, 2026 22:37
@copy-pr-bot
Copy link
Copy Markdown

copy-pr-bot Bot commented Apr 19, 2026

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@github-actions
Copy link
Copy Markdown
Contributor

👋 Hi aryanputta! Thank you for contributing to ai-dynamo/dynamo.

Just a reminder: The NVIDIA Test Github Validation CI runs an essential subset of the testing framework to quickly catch errors.Your PR reviewers may elect to test the changes comprehensively before approving your changes.

🚀

@github-actions github-actions Bot added fix external-contribution Pull request is from an external contributor labels Apr 19, 2026
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 1 additional finding.

Open in Devin Review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 19, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 470434a7-732b-4722-8b66-1ec865437cd9

📥 Commits

Reviewing files that changed from the base of the PR and between d94b350 and c742caa.

📒 Files selected for processing (1)
  • components/src/dynamo/common/configuration/config_base.py

Walkthrough

Updated the import of Self type in config_base.py to be conditional on Python version: uses typing.Self for Python 3.11+, falling back to typing_extensions.Self for earlier versions to resolve ImportError on Python 3.10.

Changes

Cohort / File(s) Summary
Python Version Compatibility
components/src/dynamo/common/configuration/config_base.py
Added version-aware import logic for Self type annotation. When Python >= 3.11, imports from typing; otherwise, imports from typing_extensions to support Python 3.10 compatibility.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: supporting typing.Self on Python 3.10 via typing_extensions fallback.
Description check ✅ Passed The description includes a clear summary, detailed explanation of the fix, code example, and test plan checklist covering all required template sections.
Linked Issues check ✅ Passed The PR fully addresses issue #8322 by implementing the conditional import pattern required to support Python 3.10 while maintaining Python 3.11+ compatibility.
Out of Scope Changes check ✅ Passed All changes are directly scoped to fixing the ImportError issue in config_base.py; no unrelated modifications are present.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

typing.Self was introduced in Python 3.11 (PEP 673). Fall back to
typing_extensions.Self for Python < 3.11 so dynamo.frontend works
on Python 3.10 environments.

Fixes ai-dynamo#8322

Signed-off-by: Aryan Putta <aryansputta@gmail.com>
helm.sh intermittently resets connections during CI runs (os error 104),
causing false-positive link check failures unrelated to our docs.
Adding it to the lychee exclude list so transient upstream network
issues don't block PRs.

Signed-off-by: Aryan Putta <aryansputta@gmail.com>
Use an anchored regex pattern instead of a literal string so the
exclusion only matches helm.sh URLs and nothing else. Escaping the dot
prevents accidental matches like helmXsh.

Signed-off-by: Aryan Putta <aryansputta@gmail.com>
conventionalcommits.org is referenced in the contribution guide but
times out intermittently in CI, causing flaky lychee failures. Exclude
it with an anchored regex matching helm.sh pattern.

Signed-off-by: Aryan Putta <aryansputta@gmail.com>
@aryanputta aryanputta force-pushed the fix/typing-self-python310-compat branch from 0ad3130 to 0bbd3b0 Compare April 23, 2026 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

actions external-contribution Pull request is from an external contributor fix size/XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]: typing.Self ImportError on Python 3.10 — incompatible with Python < 3.11**

1 participant