Skip to content

Fix Python 3.12 / Apple Silicon compatibility (pyobjc pin, keyring backend) - #23

Open
rpallred wants to merge 1 commit into
mhucka:mainfrom
rpallred:fix/python312-pyobjc-keyring-compatibility
Open

rpallred wants to merge 1 commit into
mhucka:mainfrom
rpallred:fix/python312-pyobjc-keyring-compatibility

Conversation

@rpallred

Copy link
Copy Markdown

Description:

This PR fixes three cascading failures that prevent Zowie 1.3.0 from installing or running on Apple Silicon Macs with Python 3.12.

Failure 1: pyobjc circular import (Issue #19)

The shiv binary bundles pyobjc-core 9.0.1, compiled for Intel. On Apple Silicon with Python 3.12, it raises:

ImportError: cannot import name '_objc' from partially initialized module 'objc'
(most likely due to a circular import)

Failure 2: pyobjc-core will not build from source under Python 3.12

Installing Zowie via pipx or pip triggers a build of pyobjc-core 9.0.1 from source, which fails because the pinned version's setup.py calls pkg_resources, a module removed from Python 3.12's default environment:

ModuleNotFoundError: No module named 'pkg_resources'
ERROR: Failed to build 'pyobjc-core' when getting requirements to build wheel

Failure 3: keyring.backends.OS_X removed in keyring ≥ 24

Once pyobjc is resolved by installing a newer version first, a third failure surfaces. keyring_utils.py imports directly from keyring.backends.OS_X, a backend removed in keyring 24.x:

ModuleNotFoundError: No module named 'keyring.backends.OS_X'

Changes in this PR

  • Relaxed pyobjc-core and related pyobjc framework version pins from ==9.0.1 to >=9.0.1, allowing pip to install a current, native ARM build that compiles cleanly against Python 3.12
  • Fixed the keyring.backends.OS_X import in keyring_utils.py with a try/except fallback to keyring.backends.macOS, preserving backward compatibility with older keyring versions

Tested environment

  • Hardware: MacBook Pro M4 Max
  • macOS: Tahoe 26.5
  • Python: 3.12 (Homebrew)
  • Zowie: 1.3.0

- Relax pyobjc version pins from ==9.0.1 to >=9.0.1;
  the pinned version fails to build on Python 3.12 due to
  a missing pkg_resources dependency in setup.py
- Fix keyring.backends.OS_X import removed in keyring 24.x;
  fall back to keyring.backends.macOS with try/except for
  backward compatibility

Tested on MacBook Pro M4 Max, macOS Tahoe 26.4.1, Python 3.12

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request relaxes the version constraints for pyobjc dependencies in requirements.txt from exact versions to >= 9.0.1 and updates keyring_utils.py to support importing from macOS keyrings with a fallback to OS_X. The reviewer recommends pinning the pyobjc dependencies to a specific newer version (such as 10.3) instead of using minimum version bounds to ensure reproducible builds and avoid potential breaking changes.

Comment thread requirements.txt
Comment on lines +26 to +28
pyobjc-core >= 9.0.1
pyobjc-framework-AppleScriptKit >= 9.0.1
pyobjc-framework-AppleScriptObjC >= 9.0.1

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

For applications, it is a best practice to pin dependencies to exact versions in requirements.txt to ensure reproducible builds and prevent unexpected breakages from future dependency updates.

Using >= 9.0.1 without an upper bound might install a much newer version of pyobjc (e.g., a future major release) that could introduce breaking changes.

Consider pinning to a specific newer version of pyobjc that supports Python 3.12 and Apple Silicon (such as 10.3).

pyobjc-core                      == 10.3
pyobjc-framework-AppleScriptKit  == 10.3
pyobjc-framework-AppleScriptObjC == 10.3

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.

1 participant