Skip to content

fix(sdk): scope pyobjc dependencies to macos platform - #13081

Merged
kodjima33 merged 1 commit into
BasedHardware:mainfrom
Aj2280:fix/sdk-macos-pyobjc-platform-markers
Sep 8, 2026
Merged

kodjima33 merged 1 commit into
BasedHardware:mainfrom
Aj2280:fix/sdk-macos-pyobjc-platform-markers

Conversation

@Aj2280

@Aj2280 Aj2280 commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Summary

In sdks/python/pyproject.toml and sdks/python/requirements.txt, the macOS-specific pyobjc packages (pyobjc-core, pyobjc-framework-Cocoa, pyobjc-framework-CoreBluetooth, and pyobjc-framework-libdispatch) were declared unconditionally without platform environment markers. On Windows and Linux, preparing pyobjc-core fails during installation with error: PyObjC requires macOS to build.

This PR adds the PEP 508 environment marker ; sys_platform == 'darwin' to each of the four PyObjC requirements in both pyproject.toml and requirements.txt. On Linux and Windows, omi-sdk can now be installed without triggering macOS build errors, while macOS retains the required PyObjC dependencies.

Fixes #12947

Changes

  • sdks/python/pyproject.toml:
    • Added ; sys_platform == 'darwin' to pyobjc-core, pyobjc-framework-Cocoa, pyobjc-framework-CoreBluetooth, and pyobjc-framework-libdispatch.
  • sdks/python/requirements.txt:
    • Added ; sys_platform == 'darwin' to pyobjc-core, pyobjc-framework-Cocoa, pyobjc-framework-CoreBluetooth, and pyobjc-framework-libdispatch.
  • sdks/python/tests/test_platform_markers.py:
    • Added unit tests validating:
      • All four PyObjC dependencies in pyproject.toml and requirements.txt specify sys_platform == 'darwin'.
      • Evaluating markers on Linux (linux) and Windows (win32) excludes all PyObjC packages.
      • Evaluating markers on macOS (darwin) includes all PyObjC packages.
      • Common core packages (bleak, opuslib, websockets) remain active on all platforms.

Verification

  • Automated Tests:
    • 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.
  • Packaging:
    • Built wheel with python -m build --wheel sdks/python/ successfully; wheel metadata accurately reflects markers.
  • Manifest Preflight:
    • Validated with scripts/pr-preflight.

Failure-Class: none

Review in cubic

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

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 fallback import tomli runs because the dependency is not declared, blocking the affected test suite; add tomli>=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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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>

@parallaxintel-a11y

Copy link
Copy Markdown

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 15a691f3207040f5285f8edd3a89848740c0965c in a fresh Windows CPython 3.12 virtual environment:

  • The actual SDK installation succeeded.
  • python -m pip check reported no broken requirements, and no PyObjC packages were installed.
  • The SDK suite returned 9 passed and 1 failed. test_decoder_short_packet_if_opuslib_available failed because the native Opus library was unavailable. This is a remaining environment prerequisite, not evidence that this PR introduced a regression.

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 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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.

@kodjima33
kodjima33 merged commit b6f9106 into BasedHardware:main Sep 8, 2026
1 check passed
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.

Python SDK selects macOS-only PyObjC dependencies on Windows/Linux

3 participants