Fix Python 3.10 unified CLI imports - #560
Conversation
Fall back to importlib.abc.Traversable on Python 3.10, where importlib.resources is a module rather than a package. This restores every unified CLI command while preserving the Python 3.11+ import path.
There was a problem hiding this comment.
Pull request overview
This pull request restores compatibility of the unified python -m embodichain ... CLI on Python 3.10 by conditionally importing Traversable from the appropriate stdlib location, preventing import-time failure before subcommand dispatch.
Changes:
- Add a
try/exceptimport fallback forTraversableto support Python 3.10 whenimportlib.resources.abcis unavailable. - Preserve the existing Python 3.11+ import path for
Traversablewhen available.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Greptile SummaryRestores unified CLI imports on Python 3.10 while preserving the existing Python 3.11+ path.
Confidence Score: 5/5The PR appears safe to merge with no actionable correctness, compatibility, or security issues identified. The fallback catches the Python 3.10 missing-module condition and resolves the equivalent standard-library type, while Python 3.11 and later retain the existing import path.
|
| Filename | Overview |
|---|---|
| embodichain/main.py | Adds a correct version-compatible Traversable import fallback; no actionable defects were identified. |
Reviews (1): Last reviewed commit: "fix(cli): support Python 3.10 resource i..." | Re-trigger Greptile
Description
Restore the unified
embodichainCLI on Python 3.10 by falling back toimportlib.abc.Traversablewhenimportlib.resources.abcis unavailable.Commit
1352f988introduced the Python 3.11+ import path while the project still declaresrequires-python = ">=3.10". On Python 3.10, everypython -m embodichain ...command failed during module import before subcommand dispatch. Python 3.11+ keeps using the existing resource import path.Dependencies: none.
Issue: none.
Type of change
Screenshots
Not applicable; this is a CLI import compatibility fix.
Validation
conda run -n embodichain040 black --check --diff --color ./(811 files unchanged)python docs/scripts/check_api_docs.py(1714/1714 exports documented)python -m embodichain --helppython -m embodichain preview-asset --helppytest tests/test_main.py -q(11 passed)git diff --checkChecklist