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).
@ccc Just FYI,
unicode_literalsunfortunately doesn't always work well in Python 2. The main issue is that Python 2 allows only 8-bit
strfor identifier names, so
getattrand such will fail with
unicode_literalsenabled, unless you wrap the strings in a
strcall, which is really ugly.
The way I use strings in Python 2 is:
u"..."for normal text
b"..."for binary data
"..."for things that are Python identifiers
This is almost fully forwards compatible with Python 3, except that you need to replace
I'm looking at Anaconda now. Looks awesome. I'm installing it in my personal school-provided network drive, as it seems to allow installation to a custom directory (yay). Before I was using PortablePython at school, which also came with a lot of useful modules, but Anaconda looks like it offers much more, as well as having a much larger community around it.
I'm looking forward to it (even if it's only a "beta" version). Am perfectly fine to pay for it. Keep up the great work!
I've just submitted the first beta to Apple. The first build needs app review approval, so it'll take a couple of days until I can actually invite external beta testers. I've already addressed most of the limitations I mentioned above, i.e. app extension, URL scheme, documentation etc. should all be working in the first beta. There are probably bugs though (it's a beta after all).
@ccc Now that I think a little more about the "future mode" setting, I'm not sure anymore that it's a good idea. The problem I see is that it would potentially introduce incompatibilities when you share scripts with someone who has different settings, and it would be a hassle to switch settings when using different scripts. The current "true division" setting only applies to the console, so it's not really an issue there. I think it might be better to use explicit
__future__imports in scripts ("explicit is better than implicit").
@omz Though it would be nice to allow any
__future__option to be enabled in the console. Not having
Somewhat related - since absolute imports are the default in Python 3, would it make sense to remove the root
sys.pathtoo? IMHO, having
sys.pathis more confusing than useful. Importable modules should go into
sys.pathby default – it only is if the script you're running also happens to be there. The current directory is added to the path automatically, but it's not necessarily
Ah okay, I thought
Documentswas special-cased and was always there in addition to the current script location.
@dgelessus It used to be that way in 1.5, I think.
You can now sign up for the 3.x beta here: http://goo.gl/forms/DMpM7sBHhl
I already signed up, thanks a lot
@omz Sent a request, and also retweeted on Twitter. I can run both betas at once, right?
@Webmaster4o Yes, they're separate apps, you can install both at once.
Ok, just applied for the beta! Can't wait! Also, regarding a "future" setting in the 2.7 Pythonista, I think that would be great, but only for the console. The setting, if implemented, should not apply to editor scripts.
IMHO we should keep the Python 2 app as Python-2-esque as possible. It's for a different audience than the Python 3 app, and the people who continue to use it probably will use it because they prefer Python 2, and if they want Python 3 features they can buy the app. It's fine that future exists, I don't think an option for automatically using it will be in the spirit of Python 2
...and the first build is up! If you signed up, and didn't get an invite, you'll get one soon.
My one comment is that there needs to be a way to copy files between the apps, not just move. The first thing I tried to do was copy my
site-packagesto Pythonista 3, but then I found that they had all been removed from the Pythonista 2 app
Edit: Ignore this -- user error!
First bug report:
@omz can you add support for multiple documentation tabs (like in Editorial)
@ccc That works for me.