beeware / Python-Apple-support

A meta-package for building a version of Python that can be embedded into a macOS, iOS, tvOS or watchOS project.
MIT License
1.1k stars 159 forks source link

urllib proxy support is broken with 3.9-b4 #127

Closed layday closed 3 years ago

layday commented 3 years ago

Extension modules in the stdlib were removed as part of https://github.com/beeware/Python-Apple-support/commit/7b35fc56c993bb9115f516f69a8321ea91b121ce which shipped with 3.9-b4. The urllib module on macOS relies on the _scproxy extension module for proxy support. Code which uses urllib.request has stopped working with this version. To repro, create a new briefcase project and import urllib.request in __main__.

layday commented 3 years ago

If shared libraries are unacceptable then perhaps _scproxy could be reimplemented in pure Python e.g. using rubicon-objc and placed in app_packages (but that would only work with briefcase).

freakboy3742 commented 3 years ago

Thanks for the report. Looks like there's a macOS-specific submodule that needs to be compiled in. I think I know what is required; watch this space...

freakboy3742 commented 3 years ago

I've just published updated support packages that include _scproxy on macOS.

layday commented 3 years ago

Great, thanks!

lukasvasadi commented 3 years ago

Cheers! Thanks for the fast work. Sadly, I now have another module causing trouble: blosc. I believe this support module is another C extension that requires a similar patch as with _scproxy. Please let me know if you think this could be incorporated!

Traceback:
ImportError: cannot import name 'Blosc' from 'numcodecs' (/Users/lukasvasadi/viewer/macOS/app/Viewer/Viewer.app/Contents/Resources/app_packages/numcodecs/__init__.py)
freakboy3742 commented 3 years ago

@lukasvasadi Thanks; however, this time, I think the problem is outside the scope of this specific project - if we're talking about the same module, blosc is a [third party module] (https://pypi.org/project/blosc/), not something that is part of the core CPython.

Supporting 3rd party binary modules is a known issue, and something we'd like to address; but it's not an easy fix.

lukasvasadi commented 3 years ago

@freakboy3742 Understood. Just to clarify, it seems that Python developers can use Blosc either from the blosc Python wrapper that you linked, or from the numcodecs library. In either case, this module would be considered third party and therefore not easily packaged by briefcase?

freakboy3742 commented 3 years ago

Correct - either case would be third party libraries.

To be clear, they could be packaged for use in iOS; it's just not trivial (and I can't point you at a simple set of instructions).