Skip to content

fix: correct import pattern for typing.Self within honcho python SDK for python 3.10#857

Open
hsaeed3 wants to merge 1 commit into
plastic-labs:mainfrom
hsaeed3:fix(3.10)
Open

fix: correct import pattern for typing.Self within honcho python SDK for python 3.10#857
hsaeed3 wants to merge 1 commit into
plastic-labs:mainfrom
hsaeed3:fix(3.10)

Conversation

@hsaeed3

@hsaeed3 hsaeed3 commented Jun 27, 2026

Copy link
Copy Markdown

Description

This PR corrects the pattern for importing typing.Self in Python 3.10 environments within sdks/python/src/honcho/types.py to prevent ImportError when importing the honcho Python
SDK.

Changes

Simple change of:

from collections.abc import AsyncIterator, Iterator
from typing import Self

to:

import sys
from collections.abc import AsyncIterator, Iterator

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

Summary by CodeRabbit

  • Bug Fixes
    • Improved Python version compatibility by ensuring Self type support works across supported runtime versions.
    • Preserved existing stream response behavior while avoiding import issues on older Python releases.

…thon 3.10 versions of honcho

Import Self from typing_extensions for compatibility with Python versions below 3.11.
@coderabbitai

coderabbitai Bot commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 16cb83fc-8f10-4947-a273-b87f6f1c3fb5

📥 Commits

Reviewing files that changed from the base of the PR and between eb386c3 and 641f5c3.

📒 Files selected for processing (1)
  • sdks/python/src/honcho/types.py

Walkthrough

Adds a sys.version_info guard in types.py to import Self from typing_extensions on Python < 3.11 and from the standard typing module otherwise.

Python Self import compatibility

Layer / File(s) Summary
Version-gated Self import
sdks/python/src/honcho/types.py
Adds sys import and a version check to source Self from typing_extensions on Python < 3.11, falling back to typing.Self on 3.11+.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

A rabbit hops through versions old and new,
typing_extensions for the ancient crew,
On 3.11 the stdlib shines bright,
Self finds its home, everything right,
🐇 One small guard keeps the warren tight!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the Python 3.10 compatibility fix for importing Self in the honcho SDK.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

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