Skip to content

Require typing_extensions with Self support on Python 3.10 - #233

Open
Doribelove wants to merge 1 commit into
rai-opensource:masterfrom
Doribelove:codex/typing-extensions-self
Open

Doribelove wants to merge 1 commit into
rai-opensource:masterfrom
Doribelove:codex/typing-extensions-self

Conversation

@Doribelove

Copy link
Copy Markdown

Summary

On Python 3.10, spatialmath.base._types_39 imports Self from typing_extensions. The current unbounded dependency allows typing_extensions==3.10.0.2, which lacks Self and makes import spatialmath fail. Require typing_extensions>=4.0.0, the first release with Self, so the package metadata reflects this import requirement.

Validation

  • With typing_extensions==3.10.0.2, reproduced ImportError: cannot import name 'Self' from 'typing_extensions' before the metadata change.
  • Reinstalled the editable package after the change; dependency resolution upgraded typing_extensions to 4.16.0 and import spatialmath succeeded.
  • Also checked that import spatialmath succeeds with the minimum allowed version, 4.0.0.
  • With the resolved current dependency set, pytest -q --disable-warnings: 347 passed, 3 skipped (Python 3.10.12); git diff --check passed.

Fixes #78. Prepared and validated with OpenAI Codex assistance.

Python 3.10 imports Self from typing_extensions. Require the first release that provides it so dependency resolution cannot silently install an incompatible older version.

Assisted-by: OpenAI Codex
Signed-off-by: 李永祺 <doribelove@gmail.com>
@petercorke

Copy link
Copy Markdown
Collaborator

Thank you for tracking this down — #78 has been open since May 2023 with the root cause already correctly diagnosed in the comments, but nobody ever followed through with a fix. Nice to see it closed out.

I reproduced it independently before approving: a genuinely isolated Python 3.10 venv, typing_extensions==3.10.0.2 forced in last (so nothing else silently re-resolved it), gives exactly the ImportError: cannot import name 'Self' from #78. With this change, both reinstalling into that same venv and a completely fresh pip install -e . resolve typing_extensions to 4.16.0 and import cleanly.

For reference, this doesn't overlap with #212 (which collapses the per-Python-version type shim into one file) — that PR keeps the same unconditional typing_extensions import on 3.10 and doesn't touch this dependency pin, so the two are complementary rather than conflicting.

Approving — thanks for the fix.

This branch has not been deployed

No deployments
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.

spatialmath import error on Ubuntu 22.04

2 participants