Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pyobjc-framework-ApplicationServices crashes on import without pyobjc-framework-CoreText but does not include Python dependency metadata about it #581

Closed
glyph opened this issue Nov 30, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@glyph
Copy link

glyph commented Nov 30, 2023

Describe the bug

pyobjc-framework-ApplicationServices should install_requires pyobjc-framework-CoreText, since pip install-ing it by itself causes an error.

Platform information

  • Python version

3.11.6

  • How was python installed (python.org, anaconda, homebrew, ...)

python.org

  • macOS version
ProductName:		macOS
ProductVersion:		14.1.1
BuildVersion:		23B81

To Reproduce

In a new virtualenv:

$ pip install pyobjc-framework-ApplicationServices
Looking in indexes: http://127.0.0.1:3141/root/plus/+simple/
Collecting pyobjc-framework-ApplicationServices
  Downloading http://127.0.0.1:3141/root/pypi/%2Bf/ebb/e656c8b1a8fb3/pyobjc_framework_ApplicationServices-10.0-cp311-cp311-macosx_10_9_universal2.whl (33 kB)
Collecting pyobjc-core>=10.0 (from pyobjc-framework-ApplicationServices)
  Downloading http://127.0.0.1:3141/root/pypi/%2Bf/99b/72cda4593e0c6/pyobjc_core-10.0-cp311-cp311-macosx_10_9_universal2.whl (738 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 738.6/738.6 kB 583.6 MB/s eta 0:00:00
Collecting pyobjc-framework-Cocoa>=10.0 (from pyobjc-framework-ApplicationServices)
  Downloading http://127.0.0.1:3141/root/pypi/%2Bf/018/7cba228976a45/pyobjc_framework_Cocoa-10.0-cp311-cp311-macosx_10_9_universal2.whl (391 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 391.2/391.2 kB 599.5 MB/s eta 0:00:00
Collecting pyobjc-framework-Quartz>=10.0 (from pyobjc-framework-ApplicationServices)
  Downloading http://127.0.0.1:3141/root/pypi/%2Bf/528/48a5e283a508c/pyobjc_framework_Quartz-10.0-cp311-cp311-macosx_10_9_universal2.whl (230 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 230.6/230.6 kB 629.3 MB/s eta 0:00:00
Installing collected packages: pyobjc-core, pyobjc-framework-Cocoa, pyobjc-framework-Quartz, pyobjc-framework-ApplicationServices
Successfully installed pyobjc-core-10.0 pyobjc-framework-ApplicationServices-10.0 pyobjc-framework-Cocoa-10.0 pyobjc-framework-Quartz-10.0
$ python -c 'import ApplicationServices'          
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Users/glyph/.virtualenvs/tmp-571af869e15bf2/lib/python3.11/site-packages/ApplicationServices/__init__.py", line 31, in <module>
    globals().pop("_setup")()
  File "/Users/glyph/.virtualenvs/tmp-571af869e15bf2/lib/python3.11/site-packages/ApplicationServices/__init__.py", line 10, in _setup
    import CoreText
ModuleNotFoundError: No module named 'CoreText'
$ pip install pyobjc-framework-CoreText           
Looking in indexes: http://127.0.0.1:3141/root/plus/+simple/
Collecting pyobjc-framework-CoreText
  Downloading http://127.0.0.1:3141/root/pypi/%2Bf/c8e/c3d634b440b53/pyobjc_framework_CoreText-10.0-cp311-cp311-macosx_10_9_universal2.whl (32 kB)
Requirement already satisfied: pyobjc-core>=10.0 in ./.virtualenvs/tmp-571af869e15bf2/lib/python3.11/site-packages (from pyobjc-framework-CoreText) (10.0)
Requirement already satisfied: pyobjc-framework-Cocoa>=10.0 in ./.virtualenvs/tmp-571af869e15bf2/lib/python3.11/site-packages (from pyobjc-framework-CoreText) (10.0)
Requirement already satisfied: pyobjc-framework-Quartz>=10.0 in ./.virtualenvs/tmp-571af869e15bf2/lib/python3.11/site-packages (from pyobjc-framework-CoreText) (10.0)
Installing collected packages: pyobjc-framework-CoreText
Successfully installed pyobjc-framework-CoreText-10.0
$ python -c 'import ApplicationServices'
$ 

Expected behavior

I would not expect to see those tracebacks.

@glyph glyph added the bug Something isn't working label Nov 30, 2023
ronaldoussoren added a commit that referenced this issue Dec 1, 2023
This also adds a new test to "pyobjc/setup.py" to detect
missing install_requires to framework bindings. The test
is fairly crude, but good enough for the coding style used
in PyObjC.
@ronaldoussoren
Copy link
Owner

Thanks for the report! This was the only significant missing requirement, but I found some more when scanning for the issue:

* pyobjc-framework-ApplicationServices depends on pyobjc-framework-CoreText but doesn't require it
* pyobjc-framework-CoreServices depends on pyobjc-framework-Cocoa but doesn't require it
* pyobjc-framework-ScreenCaptureKit depends on pyobjc-framework-Cocoa but doesn't require it
* pyobjc-framework-libdispatch depends on pyobjc-framework-Cocoa but doesn't require it
* pyobjc-framework-libxpc depends on pyobjc-framework-Cocoa but doesn't require it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants