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).
objc_util.on_main_thread (and possibly other decorators) should use functools.wraps to copy the old function's metadata to the new one.
@omz Well, I am glad the App is selling so well, a very well deserve recognition to a flawless execution and plenty of very powerful functionality, for a very limited and constrained environment, aka iOS Sandbox, but at the same time, thanks to Pythonista with a lot of potential. I use my iPad Pro as my main device 70% of the time, looking forward to increase it to 90%.
@Webmaster4o I don't know yet for how long P2 will be around after I release P3; probably a while though. As for the new features in the latest 3.0 beta: those will all be in the next 2.0.1 beta as well.
I guess this means P2 will gradually retire after P3 is released? Future updates are only for P3?
@ywangd A lot of this depends on how well the Py3 edition is received, whether a lot of people are still buying the Py2 edition afterwards, etc. In the Python community as a whole, the transition to Python 3 has been slow, but I don't really know what that means for Pythonista. It's a very specific environment, and a lot of the concerns people have about Python 3 might just not apply to an iOS app.
To be honest, I don't really like the idea of having two very similar apps. I'm a bit worried that some people might not read the description, get the wrong version, write angry reviews, email me that I'm greedy, etc.
From a technical standpoint, it's not that hard for me to keep both versions updated – apart from the underlying Python implementation, 99% of the code (UI etc.) is shared, and modifying the custom modules in a way that they work in both versions was honestly not as hard as I expected.
@omz wow, 3 * 365 * 50 > 50,000 Pythonistas, that's quite a global tribe!
@omz you really do go out of your way to continually upgrade and expand everything about Pythonista, let alone the support you provide.
Maybe funds you collect from contributions via PayPal could be used by you to outsource things like icon collection/cataloging, or other edge type tasks you don't really have time for. Well, they could be used for anything. Should be up to you.
@omz, sorry to bring it up again. I think it embarrasses you. It's not meant to. I think there are some very well meaning people out there that want to contribute more on the financial side. The reality is some people are further along in thier careers and can afford to put in more than others.
The contributions never need to be made public, nor should it imply and type of service from you.
Anyway, if you decide to do such a thing, I would just feel I am investing in something that gives me a lot of pleasure. Just the amout of help you have given me here in the forum, both directly and indirectly is mind blowing when you look at how much I have paid for the software. There is no correlation actually. Pythonista being under valued does even come close to expressing the reality.
I hope you reconsider. I personally think there in a reasonable case to let those who can afford it to contribute more without belittling anyone else who can not.
@omz - I think that you should just do a bundle that includes both the 2 and 3 versions but discounted appropriately. This will serve to illuminate new users about the 2 vs 3 issue with Python as a language and show new users how it is the definitive choice on IOS.
This thread is getting really long so I may just start another about the new template you posted to github. I am coming at this with virtually no knowledge of XCode development so my feedback should be taken in that context. At this point I have simply setup for XCode development on a squeaky clean Mac Mini. I read the Reame on the Github site but it had nothing about how to "install" the template. I spent a few days researching this and learned that it depends on a number of factors. So my feedback for now would be to add some text to the Readme to discuss this. I think the Readme should state the 3 or 4 ways to download the package and install it and why you would pick each of the methods. Something along these lines ...
Checkout the distribution using XCode source code control and recommend a destination location and then how to do a build using the stock XCode dev environment (not the command line) - then run in the simulator and then deploy to your device.
Download the distribution as a ZIP file, unpack it and then move the pieces into their "correct" locations. This one would probably best be done using the command line only.
Install the distribution using CocoPod? I have no experience with this yet and don't know what is involved. However - this seems to be one of the most modern methods for keeping the dependencies between all the parts of your App under control and easy to maintain.
Other? Maybe document the tools you are specifically using in your development environment as it might be illuminating.
New users of the template may also be wondering what the supplied process does anywhere the result end up. Does it produce universal binaries or only ones targeting IOS. Mac OSX support? etc. I am just looking at this as if this is a SDK offering and that Pythonista is the demo app for this SDK. You have mentioned that at least one developer has taken the framework out of your distribution and put it into another project so this seems appropriate.
On the donation/financial contribution topic. I can understand that @omz feels uncomfortable taking donations, this brings notions of charity. But me and many other are more than willing to contribute financially to the apps, to show appreciation for this wonderful tool and to help with/speed up future development. If there would be an anti-sale day for the new Python 3 version with a higher price (5x?) I would buy it that day.
@Oscar me too, same day!!
@omz Even though I realize this has been discussed as likely very problematic I really do think the ultimate solution is to sunset Pythonista 2.7-only version, and bake a python 2.7 mode into Pythonista 3 even if it requires a toggle and an app restart because as you mention yourself there will be people who are like "I got the wrong version, 1 star!!!!" Or maybe just a superficial 2.7 compatibility mode where it runs 2to3 tools , and some module compatibility tool I've read about in a new directory.
@omz Thanks for the new features in Pythonista 2. I'm still using that as my primary version.
regarding StringIO and cStringIO. It's my understanding that in Python3 there is no
cStringIO. It's also my understanding that in Python2
cStringIO.StringIOwas faster than
StringIO. Since in Pythonista3
ImportError, I'm wondering whether the faster
cStringIOis gone or if
StringIOis now that faster version by default with the simpler name.
I'm using this as
as part of a circle mask view from url function made with (I believe) the help of @jonb and/or possibly @ccc. (They're both so damn helpful)
I like python 3.5 but my heart is for 2.7 <3
@Tizzy There's just one
StringIOimplementation in Python 3, it's basically
cStringIOwith a different name, and it's been moved to the
If you just want to use
StringIOon Python 3, use
from io import StringIO. If you want compatibility with both versions, you could use something like:
import sys if sys.version_info >= 3: from io import StringIO else: from cStringIO import StringIO
You could also use the
from six import StringIO # works for Python 2+3
great thanks @omz. also Thanks for the line numbers!!!
What is "show tab bar"???? Can't figure out what changes when toggling this in settings...
What is "show tab bar"???? Can't figure out what changes when toggling this in settings...
It changes how multiple editor tabs are shown. With "show tab bar" on, you'll get an "add tab" button in the top-right corner, and you can select tabs like on the iPad. Without it, the button in the top-right corner shows an overview of all tabs, but the tab bar is not visible normally.
It doesn't really make a difference if you only have one tab open, of course.
@omz WOW. I feel stupid. I've been using it in tabbed mode for so long I forgot there was anything else.
@omz Applied kindly invite me.
I mentioned this before. I am using scrollview in UI editor. After leaving the subview sometimes the changes going lost. I thought this was fixed in the meantime, but the problem is still there.
It would be nice to get an feedback on this.