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).
@Webmaster4o If you really really want line numbers on the small screen, here you go:
from objc_util import ObjCClass ObjCClass('NSUserDefaults').standardUserDefaults().setBool_forKey_(True, 'EditorShowLineNumbersOnPhone')
(takes effect for editor tabs that are opened afterwards)
@ihf I had the same problem that you had in installing the new Pythonista3 beta on two of our four iPads here. No problems at all with the other two iPads.
After several failed attempts, I tried the pythonista3:// trick but that failed to work.
I went into Pythonista 2 and opened the Pythonista3 folder can copied over a few files and folders that I really wanted to preserve.
I then deleted all files in the Pythonista3 and then tried to reinstall. That failed.
Finally, I deleted the Pythonista3 app and reinstalling the app. That succeeded.
@ccc I deleted Pythonista 3 and reinstalled from testflight. The install completed this time. Now when I start the app it dies immediately (goes straight to the IOS homescreen). Perhaps this is due to my iPad 3 running 8.1.2 and is JB? Pythonista (2.7) runs fine. Pythonista3 runs on my iPad mini.
@ihf Due to an oversight on my part, the current beta doesn't work on iOS 8, I'll try to make a new build available soon.
In Pythonista3 beta
NameError: name 'long' is not defined.
@ccc Not here. Are you sure you don't have a different version of SymPy in site-packages or something like that?
I have a problem with appex module. In actual Pythonista 3 Beta appex.get_url() does not get back with the actual URL from Safari. Anyone else got this?
Edit: This happens only while Python 3.5 is selected as default interpreter. Python 2.7 is working fine.
appexmodule seems to have some issues under Python 3:
>>> import appex >>> appex.get_attachments()  >>> appex.is_running_extension() False
Yes, this was run in the app extension.
@omz Another console-related issue - AFAICT since Pythonista 2.0,
console.set_color()with no arguments does not reset the text color to default, like it did in Pythonista 1.5. This is especially an issue because there are light and dark themes - there is no text color that is easy to read on both light and dark backgrounds, so it's impossible to write a script that changes text color in a way that works with all themes.
Thank you for the update to 300007.
I do not know, it was the same in 300006, but now I have a problem with the additional keyboard on my iPad Pro.
If I Press "+" I get an "%" and "+" and a rectangle witout content on the top of the screen. Pressing "/" I get an rectancle without content. Pressing "=" nothing else happens.
@wnMark For me the extended keyboard has some issues too. The top row's keys work fine when long-pressed, but for the bottom ones the popup is hidden behind the second keyboard row (in portrait mode) or completely out of place (in landscape mode).
@dgelessus for me the top line (1,2,3..=) worked like decribed in landscape mode. In portrait it works fine. The bottom line works fine in landscape and portrait mode.
While entering a multi-line command, pythonista chokes after the first line, so:
exec('for i in range(10):\n print(i)')
for i in range(10):
File "<string>", line 1
for i in range(10):
SyntaxError: unexpected EOF while parsing
@geo This is a known issue, @omz mentioned this in one of the earlier beta release notes. Though it would be nice to have support for multiline statements in Pythonista 3. Even nicer would be if the input text box became a multiline text field when a multiline statement is entered.
Thanks, @dgelessus. Are the known issues accessible somewhere so I can read them and try not to clutter up this forum?
@geo This one looks like it was only listed in the release notes for an old version, and not on the forum. The Pythonista 2 betas had a "Beta Release Notes" file that was updated with every build, but the Pythonista 3 beta doesn't seem to have that...
@omz This is not specific to Pythonista 3, but a few useful sections of the Python docs are included, but not easily accessible, i. e. you need to use search or the global index to get to them.
- Complete Table of Contents - this alone would be enough, then everything would be accessible.
- Python HOWTOs - this includes things like porting to Python 3 and Unicode which are useful for people new to Python 3, but also some generally useful tutorials.
- FAQs - needless to say, those are always good to have.
- Things related to Python's C API - some things are included, some aren't. Of course those aren't of interest to the average user, but definitely useful to the non-average user trying to call the Python 2 API from Python 3 and such.
:)As mentioned above, if the TOC were linked from the main page of the docs, then this would also be accessible without needing to clutter up the main page.
For iPad users it would also be nice to have the main page in two-column form like on a normal PC. I think in Pythonista 1.5 this was the case, but I may be misremembering that. (And my only device running 1.5 is my old iPhone.)