fix(sdk): scope pyobjc dependencies to macos platform - #13081
Conversation
In `sdks/python/pyproject.toml` and `sdks/python/requirements.txt`, the four `pyobjc` packages were declared unconditionally. On Windows and Linux, installing `omi-sdk` fails because `pyobjc-core` requires macOS to build. Add PEP 508 environment marker `; sys_platform == 'darwin'` to those dependencies so they are only selected on macOS. Fixes BasedHardware#12947
There was a problem hiding this comment.
1 issue found across 3 files
Confidence score: 4/5
- In
sdks/python/tests/test_platform_markers.py, Python 3.10 environments can fail when the fallbackimport tomliruns because the dependency is not declared, blocking the affected test suite; addtomli>=2.0; python_version < '3.11'to the project development requirements.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="sdks/python/tests/test_platform_markers.py">
<violation number="1" location="sdks/python/tests/test_platform_markers.py:22">
P3: On Python 3.10 (supported via requires-python >=3.10) the fallback `import tomli` fails because tomli is not declared in the dev extras or requirements. Add `tomli>=2.0; python_version < '3.11'` to [project.optional-dependencies].dev so the test module imports on 3.10.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| try: | ||
| import tomllib | ||
| except ImportError: | ||
| import tomli as tomllib # type: ignore |
There was a problem hiding this comment.
P3: On Python 3.10 (supported via requires-python >=3.10) the fallback import tomli fails because tomli is not declared in the dev extras or requirements. Add tomli>=2.0; python_version < '3.11' to [project.optional-dependencies].dev so the test module imports on 3.10.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At sdks/python/tests/test_platform_markers.py, line 22:
<comment>On Python 3.10 (supported via requires-python >=3.10) the fallback `import tomli` fails because tomli is not declared in the dev extras or requirements. Add `tomli>=2.0; python_version < '3.11'` to [project.optional-dependencies].dev so the test module imports on 3.10.</comment>
<file context>
@@ -0,0 +1,86 @@
+ try:
+ import tomllib
+ except ImportError:
+ import tomli as tomllib # type: ignore
+
+ with open(PYPROJECT_PATH, "rb") as f:
</file context>
|
Would the Omi maintainers approve a US$5 PayPal bounty for independent Windows installation validation of this PR under the published contribution process? I tested commit
I can provide the reproducible validation report and sanitized installation evidence if this independent testing contribution is useful. No hardware, audio recording, or transcription service was tested. The implementation credit belongs to this PR's contributor; my contribution is the independent Windows check, performed with AI assistance. This is a request for agreement, not a claim that payment is owed. Payment details would be supplied privately only after acceptance. |
kodjima33
left a comment
There was a problem hiding this comment.
Real bug: pyobjc-* deps declared unconditionally break pip install on Windows/Linux. Confirmed unconditional on main. Scoped fix (102 loc) with platform-marker tests. Confidence 5/5.
Summary
In
sdks/python/pyproject.tomlandsdks/python/requirements.txt, the macOS-specificpyobjcpackages (pyobjc-core,pyobjc-framework-Cocoa,pyobjc-framework-CoreBluetooth, andpyobjc-framework-libdispatch) were declared unconditionally without platform environment markers. On Windows and Linux, preparingpyobjc-corefails during installation witherror: PyObjC requires macOS to build.This PR adds the PEP 508 environment marker
; sys_platform == 'darwin'to each of the four PyObjC requirements in bothpyproject.tomlandrequirements.txt. On Linux and Windows,omi-sdkcan now be installed without triggering macOS build errors, while macOS retains the required PyObjC dependencies.Fixes #12947
Changes
sdks/python/pyproject.toml:; sys_platform == 'darwin'topyobjc-core,pyobjc-framework-Cocoa,pyobjc-framework-CoreBluetooth, andpyobjc-framework-libdispatch.sdks/python/requirements.txt:; sys_platform == 'darwin'topyobjc-core,pyobjc-framework-Cocoa,pyobjc-framework-CoreBluetooth, andpyobjc-framework-libdispatch.sdks/python/tests/test_platform_markers.py:pyproject.tomlandrequirements.txtspecifysys_platform == 'darwin'.linux) and Windows (win32) excludes all PyObjC packages.darwin) includes all PyObjC packages.bleak,opuslib,websockets) remain active on all platforms.Verification
PYTHONPATH=sdks/python sdks/python/venv/bin/pytest sdks/python/tests/test_platform_markers.py -v: 3/3 passed.PYTHONPATH=sdks/python sdks/python/venv/bin/pytest sdks/python/tests/: 10/10 passed.python -m build --wheel sdks/python/successfully; wheel metadata accurately reflects markers.scripts/pr-preflight.Failure-Class: none