Python 3.x Progress Update
Python 3.x support has been a topic of discussion here for years, and I finally have some news on that front. :)
As I've teased a bit earlier on Twitter, I'm working on a version of Pythonista that is based on Python 3.5.1 instead of the current 2.7.5. I've made pretty good progress recently, and the app is already in a completely usable state with most custom and third-party modules working. The app's UI is essentially identical to Pythonista 2.0.
Things that are working so far:
- Python 3.5.1 with all new syntax features and most standard library modules (exceptions are basically the same as in 2.x, i.e. mostly Tkinter)
- Numpy, matplotlib, Pillow, PyCrypto, and most other third-party modules that are currently included in Pythonista 2.0 (in some cases more recent versions than in 2.0)
- Most custom modules (
Not working yet:
- A few custom modules (currently only
- The app extension (invoking Pythonista from the share sheet)
- The URL scheme
- The documentation browser
- The example scripts aren't completely ported yet
- A couple of third-party modules that are included in Pythonista 2.0, but aren't (yet?) compatible with Python 3 (screenplain, midiutil, mechanize, xhtml2pdf)
There are probably still a few bugs in the ported versions of my custom modules. Getting the string/unicode handling to work right has been tricky in some cases, and I haven't tested all modules very thoroughly yet.
I expect that I'll have the first beta ready within the next week or so, hopefully without some of the limitations I've listed above. I'll post a new beta signup form here when I'm ready.
Lastly, this will be a separate app, or "paid upgrade" if you will. This is, by the way, one of the reasons I did not charge for the 2.0 update. It'll co-exist with Pythonista 2.x for a while because there are still valid reasons to prefer Python 2.7, and I don't want to force people to upgrade to a version that is not backwards-compatible.
As I've mentioned before, creating an app that supports both Python 2 and 3 would be very difficult, if not impossible. The only way this could theoretically work would require relaunching the app in order to switch versions, and I honestly think that having Python 3 in a separate app will result in a better user experience and less confusion. It will be possible to access files in Pythonista 2.x from 3.x though (and vice-versa).
@JonB Thanks for the recommendation - got the standard py2 version installed (which has the #!python2 already in launch_stash.py).
For others, if they want to install the py2 StaSh for py3 in the beta, be sure to switch the Console Interpreter Version to Python 2.7 before you install StaSh. After installing, restart Pythonista and switch back to 3.5 as the interpreter.
Overall, StaSh seems to be working well in the beta. I have seen some cases where Pythonista crashes when using StaSh. It seems to happen when an error message from StaSh is shown in the Pythonista console tab.
Anyway, I used StaSh's pip command to install NLTK and then used nltk.download() in the standard console to install the book corpora (using the default directory worked without needing to explicitly set the NLTK_DATA environment variable). So far, so good!
@omz not sure if the latest beta broke this, or if it is by design: when running the 2.7 interpreter, after running a script in Documents, site-packages is modified and no longer points to the pythonista3 site-packages.
This got me when installing pyimgur then was unable to import using 2.7 but was able to import with 3.5, or after restarting.
after running script:
private/var/mobile/Containers/Shared/AppGroup/C534C622-2FDA-41F7-AE91-E3AAFE5FFC6B/Pythonista3/Documents', '/private/var/mobile/Containers/Shared/AppGroup/C534C622-2FDA-41F7-AE91-E3AAFE5FFC6B/Documents/site-packages', '/var/mobile/Containers/Bundle/Application/94901C8E-7046-48FC-9BBC-5018FEB83CBF/Pythonista3.app/Frameworks/PythonistaKit.framework/pylib', '/var/mobile/Containers/Bundle/Application/94901C8E-7046-48FC-9BBC-5018FEB83CBF/Pythonista3.app/Frameworks/PythonistaKit.framework/pylib/site-packages', '/var/mobile/Containers/Bundle/Application/94901C8E-7046-48FC-9BBC-5018FEB83CBF/Pythonista3.app/Frameworks/PythonistaKit.framework/pylib/site-packages/PIL_compat']
['/private/var/mobile/Containers/Shared/AppGroup/C534C622-2FDA-41F7-AE91-E3AAFE5FFC6B/Documents/site-packages', '/var/mobile/Containers/Bundle/Application/94901C8E-7046-48FC-9BBC-5018FEB83CBF/Pythonista3.app/Frameworks/PythonistaKit.framework/pylib', '/var/mobile/Containers/Bundle/Application/94901C8E-7046-48FC-9BBC-5018FEB83CBF/Pythonista3.app/Frameworks/PythonistaKit.framework/pylib/site-packages', '/var/mobile/Containers/Bundle/Application/94901C8E-7046-48FC-9BBC-5018FEB83CBF/Pythonista3.app/Frameworks/PythonistaKit.framework/pylib/site-packages/PIL_compat', '/private/var/mobile/Containers/Shared/AppGroup/C534C622-2FDA-41F7-AE91-E3AAFE5FFC6B/Pythonista3/Documents/site-packages']
@omz Thanks - I have just done that
@omz I'm seeing an error when using 2to3 from the wrench on the example from the linguistictagger docs page. In editor.py it says "name 'os' is not defined" line 161. This is using the 300012 version just released.
@pvanallen You're not the only one, someone else has posted this elsewhere as well, probably in the Slack chat.
@farscapeone Thanks, I'll look into it.
- The following fails in python 3 ( works in py2). This causes doctests to fail
>>> import editor >>> editor.annotate_line(2) Traceback (most recent call last): File "_ctypes/callbacks.c", line 234, in 'calling callback function' File "/var/mobile/Containers/Bundle/Application/94901C8E-7046-48FC-9BBC-5018FEB83CBF/Pythonista3.app/Frameworks/PythonistaKit3.framework/pylib/site-packages/objc_util.py", line 885, in OMMainThreadDispatcher_invoke_imp retval = func(*args, **kwargs) File "/var/mobile/Containers/Bundle/Application/94901C8E-7046-48FC-9BBC-5018FEB83CBF/Pythonista3.app/Frameworks/PythonistaKit3.framework/pylib/site-packages/editor.py", line 226, in annotate_line filename = os.path.abspath(filename) NameError: name 'os' is not defined
(whoops, i see this was already mentioned)
- The path is not set for .doctests in the same way as py files or py files run as doctests. This is true for both py2 and py3 as far as i can tell. Makes it trickier to write doctests that rely on imports (can still be done via sys.path)
Very excited about the Pythonista 3. How do I sign up for beta?
Also, support writing and saving to Google Drive and or Drop Box????
I keep my source code their so I can work on my mac, ipad, surface, or Raspberry Pi.
I love Pythonista. It allows me to code at Starbucks on my ipad.
I found now way to rename a python file or to duplicate it in the script editor (beta pythonista)
Move, export, create do work.
@omz: Any chance to compile pythonista 2.0 with ipv6 support? AFAIK this should be no major problem.
I have been using an app called Working Copy which connects to repositories including github and bitbucket and clones them. Any changes locally can be committed and pushed. So far this has been working great and one of the editors I use Textastic has integrated with it to open files. Anything edited in textastic is updated in Working Copy and can then be pushed to, in my case, bitbucket.
Has there been any thought to integrating pythonista with Working Copy as they already have the repository syncing worked out? It would be great to clone my repository, edit/test/debug, and push from Pythonista :)
@ccc thanks for the link. I will add my vote for integration with Working Copy. The more I use it the more I like it no need know github/bitbucket access details.
I would also love to see native integration with Working Copy. It would make teaching Pythynista and Git to high school programming students much easier. As long as it also moves over any assets and *.pyui files in a directory, and not just the *.py files.
same issue here: Applied for the beta a few week ago, but I'm not on the list (nor did I receive a testflight invitation).
Can you héla me ?
Hi--is there an FAQ someplace on this subject? Confused about it all. Does the current version of the app support both 2.7 and 3? How? Thanks!
ETA: Oops. Just answered my own question (saw there's a new app version for 3).
This post is deleted!last edited by