PEP730 has now been submitted to the steering council for acceptance.
Thanks to everyone for the feedback and suggestions!
PEP730 has now been submitted to the steering council for acceptance.
Thanks to everyone for the feedback and suggestions!
Hi everyone,
Iām sorry Iām late for the discussion, I only became aware of this PEP when it was submitted to the steering council.
First of all, thank you very much for this; you did a great job in building and submitting this proposal, and I support it completely. I am the author of a terminal-like app (a-Shell) and a local Jupyter notebook app (Carnets), so this will make my life a lot easier.
I have few comments, questions and answers to complete this discussion.
--undefined error
instead of --undefined dynamic_lookup
, so the issue about possible obsolescence of that flag goes away.pip
works for pure Python packages. Thatās what Pythonista, Juno, Pyto, a-Shell and Carnets use, to the best of my knowledge. Downloading and loading Arm64 binaries is both forbidden and technically impossible (the app will only load binary code that has been signed with the developer certificate and placed in a specific directory that can only be accessed at install time, and never modified later).fork()
wonāt work and that dynamic libraries wonāt load. As a result, a lot of existing Python packages written for OSX work āas isā on iOS, by going through the platform == "darwin"
branch. This proposal will break that, and packages will have to be rewritten to expand the test: (platform == "darwin") or (platform == "ios")
. Itās not a major issue for me, just a point to mention.~
, only in ~/Documents
. Itās not an issue for Python itself, but it is for many packages that store configuration files or caches in ~
. We will need to edit the code for these packages, but thatās not a major issue (and definitely not an issue for Python).Thanks for the feedback @holzschu. Great to have another ālegacyā Python on iOS user voice in the mix.
I wasnāt aware of the -undefined error
alternative. While it presents an interesting alternative, my inclination is to leave the PEP as it stands, recommending dynamic linking as the only supported target.
The macOS usage of -undefined
is (as I understand it) entirely driven by the need to support a static linked libpython3.X.a
. My impression is that nobody is happy the flag is needed - it allows for a successful compile and link of a binary module that references a symbol that wonāt exist at runtime. However, on macOS, itās needed because we canāt link against libpython
because of the static libpython3.X.a
use case, which needs to exist for historical reasons.
Thereās no historical baggage in the iOS support case, and thereās no especially compelling use case for supporting a static libpython3.X
on iOS (that Iām aware of, anyway). On that basis, we can do the ārightā thing: require a dynamic libpython3.X.dylib
, link binary modules against that dylib, and avoid the dangling link reference problem entirely. As noted in the PEP, this is what Windows does, so thereās precedent for this approach.
@nad @ronaldoussoren @misl6 Do you have any thoughts on this?
ā¦pray they donāt clarify it any further
Itās definitely good news that this is a supported mode of operation (at least for now); however, I donāt think it substantially impacts on this PEP as it stands. There might be an argument to add a --only-pure
option to pip that only allows py3-none-any
wheels (--no-binary
exists, but will fall back to tarballs if theyāre available), but thatās an issue for the packaging ecosystem once iOS support is possible.
This is, for me the single most important reason why sys.platform
needs to return a non-ādarwinā value. Yes, a lot of code will work āout of the boxā by inheriting macOS behavior - but a lot of code will break by making the same assumption. There needs to be a way to differentiate iOS from macOS so that code can easily opt out of iOS-incompatible behavior - and sys.platform
is how Python spells that.
Yes, this does mean thereās going to be a migration path for some code to run on iOS - but the fix is straightforward, and an analog of the same fix would be required for people migrating code that runs on Linux to also run on FreeBSD - two Unix operating systems that are substantially similar⦠until they arenāt.
Strictly speaking, every operating system has the same restriction, in theory. Thereās no reason to believe an arbitrary Python program can write to any arbitrary file system location - even the location where the Python source itself is located.
Hi, thanks for the answer. I realize that I should have been more explicit: none of what I wrote is in any way an objection to this PEP. Some of it is an attempt to give answers to some questions that appeared in the discussion, some of it is an attempt to point potential issues that will occur further down the line, but in packages, not in Python itself.
For the issues that will occur in packages, having this PEP will actually make our life easier: we will be able to submit proposals of changes to the package maintainers, that will make explicit the changes we had to do, and allow us to share our workload (Iām thinking about all the packages that try to write some cache or configuration file in ~/
. There are really a lot of these (Jupyter, astropy, bokeh, seaborn,ā¦)).
For the main issue, I am strongly in favour of having libpython
as a dynamic library (because thatās what Iām using alreadyā¦). Like you said, having a static library is only for historical reasons, and since we donāt have any historical baggage, letās go with dylib at the start.
To clarify, --undefined error
is used when you are creating another dynamic library (say, libpackage.dylib
), linking against existing dylibs (say, libpython3.13.dylib
). It stops the compilation if there are any symbols in libpackage.dylib
that are not defined in the other dynamic libraries. Itās to make sure that your new dynamic library is not referencing some unknown symbol. I think itās the default when linking for iOS.
I agree with your reasoning on sys.platform
. I will have to rewrite some code, but thatās OK.
Hey @freakboy3742 and everyone ā thank you so much for putting this together. I think itās a great idea, which I wholeheartedly support. Iām the author of several Python-related apps for iOS, Tinkerstellar (educational app with coding tutorials) and Juno (Python and Jupyter IDE). The proposal and the discussion here sound very sensible, and I donāt have much to add at this point. I will certainly need to change a few things in my apps, but these are primarily changes that Iāve been planning anyway (e.g., switching from static to dynamic libraries).
I agree with @holzschu that the App Store rules seem to allow downloading pure Python packages (i.e., pip) ā or at least they can be interpreted that way in their current form. I also like the idea of a --only-pure
option in pip, as this would make my life much easier, specifically regarding the work around Junoās package manager.
The SC has accepted this PEP! Our full response from GitHub is included below:
Thanks for the very thorough and well-written PEP! The SC is happy to accept it.
We arenāt worried about the lack of x86_64 hardware (though perhaps this will be a push to get some old hardware donated) nor the deprecation warning for the
--undefined dynamic_lookup
flag ā these are technical details that we can find solutions to in the future as needed.