Forum Archive

Python 3.x Progress Update

omz

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 (ui, scene, contacts, reminders, ...)

Not working yet:
* A few custom modules (currently only notification, editor, and canvas)
* 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).

Gerzer

Will Pythonista for Python 2.7 continue to be updated and receive new features?

Gerzer

Great news BTW!

omz

@Gerzer As I've said, the two versions will co-exist for a while. I don't know yet how long the transition phase will be, and it'll also depend on how much demand for the 2.x version there will still be of course.

Gerzer

Ok, thanks for the quick reply! I plan to buy the new Pythonista no matter what, of course. :)

ywangd

Thanks @omz This is now on my shopping list.

It would also be interesting to have a poll to see which version (2 or 3) is more preferred. I personally will most likely to stick to Python 2 for a while.

dgelessus

This is great news! Can't wait to play around with it. Are ctypes and objc_util working yet? ;)

I assume the device requirements will be the same as for Pythonista 2? (I'm still hoping for iOS 7 support to magically come back so my iPhone brick can run the new Pythonista, but somehow I think that is unlikely.)

omz

@dgelessus Yep, objc_util and ctypes are working well. objc_util was actually somewhat tricky to port because of the way strings are handled in ctypes, but I think that I have most of the kinks ironed out by now.

The requirements will likely be the same as for 2.0. iOS 7 support won't come back, I'm afraid.

athros

Great news @omz! I'm in for both buying and beta testing!

Webmaster4o

Curious as to how accessing files between versions will work…

omz

@Webmaster4o It'll technically be similar to how files are shared between the main app and the extension now. All documents already live in an "app group" folder that can be shared between multiple apps (you may have seen that the absolute paths of your documents contain "AppGroup").

So basically, if you have both versions installed, you'll see a "Pythonista 2" folder in Pythonista 3, and a "Pythonista 3" folder in Pythonista 2. That's my current plan anyway.

Webmaster4o

I really need to get some more iTunes gift cards. On my list of apps to buy include Textastic both for iPhone and iPad, as well as Codea, and now Pythonista 3 πŸ˜‚

OI

This is GREAT, I plan to buy the new Pythonista as well!!!! and join the Beta program

ccc

@omz Great news!! I look forward to moving as quickly as possible to Python 3 only. Pythonista was the last thing keeping me on Python 2. I run the Anaconda Python 3.5.1 distro on my Mac and just love it. It will be fun to unify on Python 3 on all platforms. I look forward to the beta program and to buying Pythonista 3 as soon as it is available. Congratulations!!!

Olaf

Great news!

JohnFinchPhoto

This is great news!

Moe

That's awesome! I'll definitely get that version as well, as I'll just switch to it asap :P

lukaskollmer

Great news @omz, can you share a link for beta signup?

dgelessus

@lukaskollmer

@omz said:

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.

Tizzy

Awesome. Now I'm going to have to change

 print "something"

statements in my scripts for months to come as I run them only to find my lazy ass didn't use

print("something")

But seriously I'm glad Pythonista is moving forward as it's probably for the best. Now when will OS X ship with Python 3 out of the box???

Also @ccc any reason in particular you use this Anaconda distribution? Is that what you would recommend for everyone on OS X?

omz

@Tizzy

Awesome. Now I'm going to have to change print "something" statements in my scripts for months to come as I run them only to find my lazy ass didn't use print("something")

There will be some way to automate this.

dgelessus

There's this thing called lib2to3, I hear it's part of the Python standard library. Perhaps that might be useful. ;)

@omz Maybe putting a lib2to3 thing in the action menu would be useful? Like the "Convert Indentation" option, except that it runs 2to3 on the file. Would probably be good to save the output to a different filename though, lib2to3 isn't perfect and doesn't always produce code that can run on Python 3 right away.

Webmaster4o

@Tizzy -

@omz said

It will be possible to access files in Pythonista 2.x from 3.x though (and vice-versa).

He said in more detail on twitter that there would likely be a folder in the file browser for the 3.x version which simply displayed all of the files from the 2.x version. I suggested on Twitter that a dialog could be displayed for importing files from the 2.x folder, which would contain an option to automatically run the 2to3 program on the files imported. We'll see if that's something @omz chooses to implement.

omz

@dgelessus said:

@omz Maybe putting a lib2to3 thing in the action menu would be useful? Like the "Convert Indentation" option, except that it runs 2to3 on the file. Would probably be good to save the output to a different filename though, lib2to3 isn't perfect and doesn't always produce code that can run on Python 3 right away.

Yes, I've implemented pretty much exactly that. Right now, it doesn't make a backup, but the changes are undo-able, and it shows a diff before applying them.

ccc

any reason in particular you use this Anaconda distribution?

http://docs.continuum.io/anaconda/pkg-docs lists all the superpowers that Anaconda adds to Python for free. 150 pre-tested, pre-configured modules. Just the IPython/Jupyter function alone is super cool but there is soooo much more in Anaconda.

Is that what you would recommend for everyone on OS X?

Mac OS X, Windoze, Linux. Yes!

wnMark

Great news!
Sure I will buy and will be available as beta tester!

Webmaster4o

@ccc does the conda utility include fewer packages than pip, or do they both scan the same index ?

ywangd

@Webmaster4o You can use pip with anaconda. I use conda for updating packaged stuff and pip for anything that is not included by default. pip list shows packages installed by both command.

ccc

Correct. http://conda.pydata.org/docs/using/pkgs.html#install-non-conda-packages

ccc

Given that we are going to need to make the transition to Python 3, could I make a few feature requests for the next version of Pythonista 2 to get us started on converting our own scripts?
* Pythonista settings already has a 'Use "true" division' switch but that only applies to the console and not to scripts. Would it be possible to add another switch(s) that would be the equivalent of adding the line: from __future__ import absolute_import, division, print_function, unicode_literals to the top of every script systemwide? See: http://python-future.org
* In type ahead, could we remove print but keep print()?
* While we are at it, would it be possible to add a shebang line to the Python new file template to ease the migration of our scripts to non-Pythonista platforms? This would make new Python files begin with #!/usr/bin/env python\n# coding: utf-8\n\nfrom __future__ import absolute_import, division, print_function, unicode_literals\n\n

ywangd

Since Pythonista 2 will be kept for Python 2.7, I don't see the reason to remove the print statement.

omz

@ccc I like the idea of a "future mode", will think about it. Should probably be optional though.

ccc

Agreed. A switch in Settings.

Phuket2

I am ready to purchase. It can't make me a worse Python programmer than I am already 😝

dgelessus

@ccc Just FYI, unicode_literals unfortunately doesn't always work well in Python 2. The main issue is that Python 2 allows only 8-bit str for identifier names, so getattr and such will fail with unicode_literals enabled, unless you wrap the strings in a str call, which is really ugly.

The way I use strings in Python 2 is:

  • unicode/u"..." for normal text
  • bytes/b"..." for binary data
  • str/"..." for things that are Python identifiers

This is almost fully forwards compatible with Python 3, except that you need to replace unicode with str.

Webmaster4o

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.

nathaniel

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!

omz

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").

dgelessus

@omz Though it would be nice to allow any __future__ option to be enabled in the console. Not having print as a function bugs me when I need more than the standard repr.

Somewhat related - since absolute imports are the default in Python 3, would it make sense to remove the root Documents folder from sys.path too? IMHO, having Documents on the sys.path is more confusing than useful. Importable modules should go into site-packages.

omz

@dgelessus ~/Documents isn't in sys.path by 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 ~/Documents.

dgelessus

Ah okay, I thought Documents was special-cased and was always there in addition to the current script location.

omz

@dgelessus It used to be that way in 1.5, I think.

omz

You can now sign up for the 3.x beta here: http://goo.gl/forms/DMpM7sBHhl

OI

I already signed up, thanks a lot

Webmaster4o

@omz Sent a request, and also retweeted on Twitter. I can run both betas at once, right?

omz

@Webmaster4o Yes, they're separate apps, you can install both at once.

Gerzer

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.

Webmaster4o

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

omz

...and the first build is up! If you signed up, and didn't get an invite, you'll get one soon.

Webmaster4o

Webmaster4o

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-packages to Pythonista 3, but then I found that they had all been removed from the Pythonista 2 app

ccc

Edit: Ignore this -- user error!

First bug report: import sympy

lukaskollmer

@omz can you add support for multiple documentation tabs (like in Editorial)

Webmaster4o

@ccc That works for me.

dgelessus

@ccc No problems here either:

>>> import sympy
>>> sympy.Matrix([[1, 0], [0, 1]]).det()
1

Perhaps you have a file called sympy.py in your Documents folder? ;)

At least the most important feature works - proper Unicode support:

>>> len("🐍")
1
ccc

Nice to see so many of the PyPI modules upgraded. Scroll down to the Python3 listing at https://github.com/cclauss/pythonista-module-versions

wsgiref and yaml are missing in addition to mechanize, midiutil, screenplain, and xhtml2pdf.

ywangd

@Webmaster4o said:

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

Totally agreed! Especially since now we have 2 separate products, I don't see why you have to bend Python 2 to fake it like Python 3. If you prefer Python 3, just buy the new Pythonista 3. In the spirit of Unix (from which iOS draws its root), it's better to "Do one thing and do it well".

ccc

How the heck does async/await work in Python 3.5? Is the iOS going to limit us on asyncio and the like?

disorientedp

Got the beta! This is exciting.

dgelessus

@ccc Why should it? asyncio already existed in earlier versions of Python based on decorators and generators, the async and await keywords only integrate it into the language better. There's no kind of threading or process spawning involved as I understand it.

marcus67

@omz They are seperate apps, alright. I was just able to install the 3.x version and I did not lose my 2.x version. :-) Thanks for sending the invitation!
However, in Testflight the 2.x version is gone. This may be problem when testers want to know what to test in both versions.

dgelessus

Random observations so far:

  • Startup time (the delay between the editor appearing and pythonista_startup being run) is much shorter on Pythonista 3 than on Pythonista 2. Not sure if that might be because my Pythonista 2 contains a ton of files and my Pythonista 3 is almost empty.
  • exit, sys.exit and SystemExit exceptions actually kill Pythonista, which only os._exit used to do.
  • async and await are not treated as keywords by Pythonista. It is true that they can still be used as normal identifiers (until Python 3.7) for backwards compatibility, but that doesn't mean that you should do that.
  • The behavior of editor.open_file was changed - previously it took a path relative to ~/Documents, now it expects an absolute path. (This probably changed in an earlier beta, but I only noticed it now.)
  • The "welcome" file seems to be missing in Pythonista 3.
ccc

You can crash P3 if you try to create a new file in the editor while you are in the P2 folder.

Tizzy

@omz What's going to happen with the template? Bake everything into one with some sort of switch/delete operation? Is it already secretly baked in? Will there be a separate one?

Webmaster4o

@Tizzy There will probably be a second one.

Webmaster4o

Hey, @omz, In some recent beta (maybe not this one) you changed the console text input to be something other than PA2PromptTextField. How can I find this view now, in objc_util? It doesn't have a distinct class name anymore.

omz

@dgelessus

Startup time (the delay between the editor appearing and pythonista_startup being run) is much shorter on Pythonista 3 than on Pythonista 2. Not sure if that might be because my Pythonista 2 contains a ton of files and my Pythonista 3 is almost empty.

I've optimised the importcompletion module a bit in Pythonista 3 by using a cache for modules that can't change (pylib). It has to load all available modules on startup for the console's autocompletion to work. For some reason (that I don't really understand), this was much slower using Python 3, so the optimisation was really necessary, but Pythonista 2 could probably also benefit from it. The fact that you don't have as much stuff in site-packages probably also helps quite a bit though.

exit, sys.exit and SystemExit exceptions actually kill Pythonista, which only os._exit used to do.

Thanks, I'll have to look into that.

async and await are not treated as keywords by Pythonista.

I have that on my todo list.

The behavior of editor.open_file was changed - previously it took a path relative to ~/Documents, now it expects an absolute path. (This probably changed in an earlier beta, but I only noticed it now.)

I actually re-implemented the entire module for Pythonista 3 using objc_util, and apparently forgot that open_file should be able to deal with relative paths...

The "welcome" file seems to be missing in Pythonista 3.

I'll write that when the app is finished.

@ccc

You can crash P3 if you try to create a new file in the editor while you are in the P2 folder.

Oops! Good to know.

@Tizzy

What's going to happen with the template?

I'll make a separate template when the app is done, but I don't really want to maintain that alongside the beta.

@Webmaster4o

Hey, @omz, In some recent beta (maybe not this one) you changed the console text input to be something other than PA2PromptTextField.

No, I haven't changed that, it should still be a PA2PromptTextField.

Tizzy

@omz importcompletion is not relevant for the template? if so is it removed?

omz

@Tizzy No, it's not relevant there, and I've essentially removed it to speed up launching standalone apps.

Tizzy

UPDATE: figured out there is a built in tool in sublime text to convert spaces to tabs in indentation.
View > Indentation > Convert Indentation to Spaces

PS - anyway to scale the size of images posted here?

Also, the traceback popover doesn't seem to let me jump to the actual spot of the error as it seems to usually do in Pytonista 2, but it does show the file and line number. The last spot it lets me jump to is the import statement of the module where the error is actually at, not the module itself...

Also noticed there is a "convert tabs" action built into Pythonista 3 not yet implemented....I'm guessing this will do the same thing.


Ok, so I just tried running my app in Pythonista 3 beta. The tool to 2to3 seems to work.

But I've bumped into something right away. Seems to be much less forgiving in terms of tabs/spaces? Can anyone recommend a tool for sublime text to fix this kind of stuff? I've looked at it and it looks alright. I might have copy pasted it from another part of the code...?

 "TabError: inconsistent use of tabs and spaces in indentation"

ccc

@Tizzy Check out tabnanny which is a Python standard library module. You gotta love the name!!

wnMark

I am using Pythonista since december 2015.

I am wondering a little bit about one behaviour of the editor. I just checked on iPhone4 with iOS7 and Pythonista 1.5 compared to Pythonista 2.0x and Pythonista 300001.

If I am on the beginning on a line with indent in v1.5 and press return it preserve the indent. But in all newer versions I am in column 1. I like the behaviour of version 1.5 in this case.
I am sure there is a good explanation why this have changed (and I am sure this was not accidentally).

cursor at position ^:
_ line1
_ ^ line2
____line3

after pressing return in version > 1.5
____line1

line2
____ line3

wnMark

I found an issue in ui editor. I have assigned an image to an button in the version 201002 or earlier. This button is no longer assigned in version 3000001. If I assign another image in version 2010004 (only) this image on the button is also available in version 300001.

And it would be great , if after assigning an image that the image is still selected in the image selection.

omz

@wnMark said:

I am sure there is a good explanation why this have changed (and I am sure this was not accidentally).

Well, to be honest, this is just something I haven't gotten round to yet. It's been on my todo list for a while. The reason it changed in 2.0 is basically that I re-wrote large parts of the editor to make it more modular and reusable, mostly so that I can share a larger code base with Editorial, but also to enable features like syntax highlighting for different languages. This has worked pretty well, but there are still a few little things that worked better in the old version.

omz

@wnMark said:

I found an issue in ui editor. I have assigned an image to an button in the version 201002 or earlier. This button is no longer assigned in version 3000001. If I assign another image in version 2010004 (only) this image on the button is also available in version 300001.

The image picker in 2.0 (and betas before 2010004) was extremely buggy, and it's difficult to maintain backwards-compatibility with that because it essentially saves incorrect image names to the pyui file. This should be fixed in 201004 (and 3.0), but it may unfortunately be necessary to fix old pyui files manually by re-selecting the images.

wnMark

@omz said:

The image picker in 2.0 (and betas before 2010004) was extremely buggy, and it's difficult to maintain backwards-compatibility with that because it essentially saves incorrect image names to the pyui file. This should be fixed in 201004 (and 3.0), but it may unfortunately be necessary to fix old pyui files manually by re-selecting the images.

@omz
I understand, not a big problem for me

tomkirn

Just tried the appex module. Using appex.get_url() from the extensions console I got the error:

Traceback (most recent call last):
File "", line 1, in
File "/var/mobile/Containers/Bundle/Application/3DC76E83-91BE-4A1F-A8A2-2A00120079CC/Pythonista3.app/Frameworks/PythonistaKit3.framework/pylib/site-packages/appex.py", line 114, in get_url
return _path2url(url)
File "/var/mobile/Containers/Bundle/Application/3DC76E83-91BE-4A1F-A8A2-2A00120079CC/Pythonista3.app/Frameworks/PythonistaKit3.framework/pylib/site-packages/appex.py", line 5, in _path2url
import urlparse
ImportError: No module named 'urlparse'

Webmaster4o

@tomkirn I believe that's a difference in Python 3, yeah. I believe it should be from urllib3 import urlparse. @omz will need to fix this.

dgelessus

Isn't it called urllib.parse in Python 3?

@omz Bug with ui.TableView.delete_rows: when deleting rows from a table with sections, the tuples indicating the rows to delete have to be reversed, i. e. currently you have to write tableview.delete_rows([(row, section)]), and what I would expect to be correct is tableview.delete_rows([(section, row)]) (as described in the docs for ui.TableView.insert_rows).

wnMark

I am missing the keyboard shortcuts (callable with COMMAND key) in 300001. They are available in 201004

Ole @Omz if you fix this, more shortcuts would be great. Like Page Up/Down (At the moment CONTROL-Up/Down and COMMAND-Up/Down do the same and go to start or end of file).
OPTION DOWN is going two lines downwards and only one line upwards. More lines would be great (or goto end/start of a logical "block")

Or instead of Page Up/Down, goto prev/next "def()"

OI

No shortcuts in V3? They are not working for me, thanks

filippocld

Doing the 2to 3 conversion with that file

OI
  • If you are in the Console and the press ? to get the Online Help
  • The press the top left button to open the split screen (the shaded one)
  • Then the right portion of the screen (Console) the fonts at the top/search bar and Help title "Overview" will all be overlapped and messed up
  • If you try to press again the split screen button (shaded one) you get the pull down menu for Overview
filippocld

Also, using appex.get_url fils because there is not urlparse

Webmaster4o

@filippocld This has been mentioned elsewhere.

wradcliffe

Congrats on finally getting this project done. I just signed up to beta test and would like to offer help specifically with the template and any feature that directly speaks to users who wish to use Pythonista to write their own Apps for the AppStore.

From a feature perspective:

1) I would like to see the template kept in sync with the build so that developers would get bug fixes as soon as any other user. I would love to hear about why this is such a problem but can surmise that the template project is currently "hand built" or requires a great deal of manual work for some reason. Let's fix that once and for all.

2) I would like to hear about any progress that has been made in supporting integration with third party projects like OpenCV. I have noticed that other development environments support "plug-ins" that seem to be shared libraries and manage to make it through the App/AppStore process just fine. I have no idea yet how they are accomplishing this but I would be happy to research this and report back if we could make it a project to get this done for Pythonista.

I have been thinking a lot about the template and it purpose and future and believe that it is actually a product all by itself. It needs to have a defined purpose and a set of use cases and then offered in the AppStore for a fair price for what it delivers. For anyone using it to do professional level App development you should be able to charge a hefty price and look at paying someone to maintain it for you.

I am going to stop writing now. This is getting too off topic.

UPDATE: I have been syncing up with all the posts from the last 4 days and notice that the template was updated on GitHub at the same time as the 3.x beta - so part of my question may already be answered there. I won't post again until I actually install the new beta and download that template.

dgelessus

@omz

  • All the built-in functions and types seem to be missing docstrings and signature info. In Pythonista 2, help(tuple) would print at least the docstrings, in Pythonista 3 only the method and attribute names are shown. Method signature info for built-in functions (part of the "argument clinic", which I think is an overhaul of function argument processing in C code) is a new feature in Python 3, which would be very nice to have.
  • Using an external Apple wireless keyboard, when typing dead keys (such as ^ or ~ or ` or Β΄) they appear once too often. For example, if I type ~-space, I get ~~, and when I type ~n I get ~Γ±. I've tried many combinations and there is no practical way to suppress the double character.
  • The Pythonista 3 share sheet action is elegantly named "PythonistaAction3".
wnMark

I tried to run some programs with 3000001, but I failed in some cases.

After fixing the errors, I tried to run a program, but it didnΒ΄t start and I also get no error message.

Then I tried to provocate some errors and deleted some double points and after I get the error hint, I added these double points back. And so I go down in the listing and suddenly the program starts.

Some hints?

mikeyleo

I've been playing around with the beta and I've been trying to get one of my programs to run. It seems to be getting hung up when I use the text routine. I get a NameError of name 'unicode' is not defined. The error occurs in the render_text routine. I don't know if this is a bug or I have to change my code to work with the PIL library.

Webmaster4o

@mikeyleo What's the text routine? unicode is a Python 2 thing.

omz

@mikeyleo @Webmaster4o Sounds like a bug in the scene module, I'll look into it.

AtomBombed

@Webmaster4o about your wish list for apps...

Yeah, I have had both of those apps that you want. Textastic is great, and Codea is AMAZING.

wnMark

If I create in Pythonista3 a new file in the Pythonista 2 folder, the app is crashing. The same if I try in Pythonista 2 in Pythonistas3 folder., Maybe I am not allowed to do this?

Phuket2

Is there a way to do a pip install with Pythonista 3 as yet?

dgelessus

@Phuket2 Go to https://pypi.python.org/ and copy the Python 3 source download link for the package you want, download it in Pythonista 2 using stash, extract the archive and move the module file or package folder into Pythonista 3's site-packages. It's by far not as nice as using stash's pip, but Pythonista 3 is literally a few days old, times are going to be a little rough :)

Phuket2

@dgelessus , thanks. I sort of thought you could do that also. It was not urgent otherwise I would have tried that way.
Have to say the folder system going on between the 2 apps is pretty cool.
IN Pythonista 3, I just added a script to the tool menu

import editor, clipboard

clipboard.set(editor.get_path())

Just nice simple way to get file path names from inside the 2 dir. Simple, but good at this early point

Phuket2

@dgelessus , look I am very new to this. But from searching on the web it appears to me that pip is included in the Python dist and has been for sometime. Not 2.7 but after.

athros

@omz signed up for the beta! Can't wait to get my existing code converted over to Python 3!

ywangd

@omz
I am aware that @dgelessus has reported issue for sys.exit. However my experience is a bit different. The sys.exit now seems to generate a KeyboardInterupt instead of the SystemExit exception. The code can be traced back to line 48 of pythonista3_startup.py, in _exitfunc.

If possible, I would like to have exit still generate SystemExit in future revision.

dgelessus

@Phuket2 pip is included in almost every normal Python distribution, but that doesn't make it part of the standard library. Besides, pip is written for normal computers and doesn't run well in the iOS/Pythonista sandbox. See https://github.com/dgelessus/fistutils for my less-than-perfect attempt to make distutils/setuptools/pip work on Pythonista.

Phuket2

@dgelessus , ok. As I say, I know I don't understand. It's all a layer cake 😱
There is so much context you have to sort of be aware of when reading about Python, and that's a shame.

wnMark

@wnMark said:

I tried to run some programs with 3000001, but I failed in some cases.

After fixing the errors, I tried to run a program, but it didnΒ΄t start and I also get no error message.

Then I tried to provocate some errors and deleted some double points and after I get the error hint, I added these double points back. And so I go down in the listing and suddenly the program starts.

Some hints?

In the meantime I was able to migrate my biggest Python program to Python 3.x (and it still runs on Pythonista 2)

  1. print must have brackets now: print ("Hello world") instead of print "Hello world"
  2. Unequal must be != instead of <>
  3. Und I must divide 10//5 instead of 10/5 to get 2 and not 2.0

So far so good. But the last point was a little bit more tricky
4. Some (not all) spaces instead of tabs prevent the program to run. But there was no hint or error message! If hope there will be a hint in next version!

omz

@wnMark said:

Unequal must be != instead of ==

What??

dgelessus

@omz In Python 2 you could write <> instead of !=, I think that's what @wnMark is referring to.

Also, more issues - when I use Pythonista 3 for a while (15 minutes or so?), it starts reacting slowly and crashes shortly after. I'm not exactly working with huge files - I have one tab with a short 5 line file, and a second one with an "average" Python file (stash's system/shio.py), and other than that I check things in the console and the Python docs every now and then. I don't have any such issues in Pythonista 2. My device is an iPad mini 1 running iOS 9.2.1 and I'm using an external Apple wireless keyboard.

Other minor issues:

  • The syntax highlighter considers the u prefix of unicode literals (as in u"ΓΌΓ±Γ¬cΓΈdΓ©") part of the string, but not the b prefix of bytes literals (as in b"PK\x03\x04").
  • In the interactive console, the tab key on hardware keyboards does not expand the first autocompletion suggestion, unlike in the editor.
Phuket2

@dgelessus , just as a side note. I read somewhere not to use the operators in Python unless some syntax requires it. Use 'not' instead. Was simple advice, but almost never need to use the in equality operators.

dgelessus

Using <> really is not recommended, it was only kept for bachward compatibility with Python 1. I have never seen any actual Python code use it. Though I don't see what's wrong with !=. Would you rather write not option == "default" instead of option != "default"? And would you write not option is None rather than option is not None?

Phuket2

@dgelessus , I would take option is not None. But when starting Python I was thinking c. So != && <> kept popping up in my mind

wnMark

@wnMark said:

  1. Some (not all) spaces instead of tabs prevent the program to run. But there was no hint or error message! If hope there will be a hint in next version!

I am fine with != instead of <>

But the issue are the spaces, that prevent the program to run

dgelessus

Python 3 is a little more picky when you use tabs and spaces in combination, and rightfully so. The issue when you mix tabs and spaces is that while a space has a fixed width (one character), a tab does not. Some people say tabs should be 8 characters, some say 4 or 2. This means that when you use spaces to indent one line and tabs to indent the next, everything will look fine to you, but someone else with a different tab width, or the Python interpreter, will be confused.

In Python 2 I think it was assumed that tabs are equivalent to 8 spaces, in Python 3 this was changed. Now tabs are considered a different type of indent that is not equivalent to any number of spaces. You can still mix tabs and spaces (but please don't) as long as it doesn't contradict any previous indentation. For example this is valid Python 3 (\t represents a tab):

if True:
    if True:
    \tprint("works")

But this is not:

if True:
    if True:
\tprint("doesn't work")

Normally Python 3 should raise a TabError for the second script, but for some reason that doesn't happen in Pythonista.

filippocld

You can't stop the script if an input() is running

filippocld

Also why does webbrowser open MobileSafari and not the inapp browser?

OI

Got the new Beta, all the issues I reported are already fixed, thanks a lot for the quick turn around

omz

Thanks for the feedback, everyone!

I've just uploaded a new build (300003) to address a lot of the bugs you reported. See the release notes in TestFlight for details.

@dgelessus

The syntax highlighter considers the u prefix of unicode literals (as in u"ΓΌΓ±Γ¬cΓΈdΓ©") part of the string, but not the b prefix of bytes literals (as in b"PK\x03\x04").

In the interactive console, the tab key on hardware keyboards does not expand the first autocompletion suggestion, unlike in the editor.

I have both of these on my todo list. Haven't looked at the double ~~ issue yet.

dgelessus

@omz

  • async, await and nonlocal are only suggested in the editor, not the interactive prompt
  • nonlocal is also missing syntax highlighting
  • Exceptions are only suggested in the interactive prompt, not the editor
omz

@dgelessus

async, await and nonlocal are only suggested in the editor, not the interactive prompt

True, I actually doubt that these will see much use in the REPL though.

nonlocal is also missing syntax highlighting

Ah, missed that.

Exceptions are only suggested in the interactive prompt, not the editor

Works for me. Note that exceptions are only suggested after the raise and except keywords though (would add too much clutter otherwise, especially as there are a lot more built-in exception types in Python 3).

dgelessus

@omz said:

Works for me. Note that exceptions are only suggested after the raise and except keywords though (would add too much clutter otherwise, especially as there are a lot more built-in exception types in Python 3).

Ah okay, I just typed somewhere in a file and they didn't come up. To be honest I'm not a big fan of hiding things that the user "probably" won't need - I understand that all the exception names clutter up the suggestions, but what if I do want to use an exception in a non-"normal" place? What if I want to extend an exception class, or do an isinstance check, or an assertRaises, or create an exception without raising it right away?

Now I noticed that Pythonista 2 behaves the same way. I always thought that exception names were never suggested and that it was a bug related to how they are avaliable both as builtins and via the exceptions module.

At the moment the autocompletion ignores case completely, perhaps it would help with the clutter if casing was taken into account. Or change the ordering of names based on whether their case matches what was typed - so (assuming you did import sys previously) if you type sy you get sys, SystemError, SystemExit, but when you type Sy you get SystemError, SystemExit, sys.

omz

@dgelessus said:

At the moment the autocompletion ignores case completely, perhaps it would help with the clutter if casing was taken into account. Or change the ordering of names based on whether their case matches what was typed - so (assuming you did import sys previously) if you type sy you get sys, SystemError, SystemExit, but when you type Sy you get SystemError, SystemExit, sys.

Interesting idea, I'll have to think about that.

OI

@omz Does Pythonista 3 support Type Hints?

omz

@OI You can annotate your functions with type hints if you like (the syntax and the typing module are supported), but Pythonista itself doesn't do anything with them.

wnMark

@omz
Thank you for updating the Beta3.
Now I was able to migrate a program to Python3 in just a few minutes. And there was a hint if I had mixed Spaces and Tabs!
And the Short-Cuts are back now!

dgelessus

@wnMark There's an option under the indentation settings to show mixed indentation in the editor, i. e. when you indent with tabs, spaces are made visible, and if you indent with spaces, tabs are made visible.

georg.viehoever

@ccc async, await, asyncio etc are not really about threading or multiprocessing. It is more like co-routines, running everything in a single thread and handing control to the next routine at defined scheduling points (the await statements).
Georg

fguillier

Hi @omz. Is there any reason why wsgiref didn't make it? It is no longer available not listed in Standard Library but when copied by hand it seems OK (used by bottle.py )

omz

@fguillier That was an oversight, thanks for letting me know. The latest build includes wsgiref now.

JonB

this is more of a python 3.x question, but whenever I try using urllib.request.urlopen, I get an SSL CERTIFICATE error. Is the p3 version properly hooked into the platform certificate provider?

omz

@JonB Looks like the certificate file isn't hooked up correctly, will be fixed in the next build, I'd recommend using requests in the meantime (comes with a bundled certificate file and works).

ccc

@omz The other missing Python3 compatible module is YAML. Is there a reason to leave that out of Pythonista3?

omz

@JonB Workaround:

import os
cert_path = os.path.join(os.path.split(os.__file__)[0], 'site-packages/requests/cacert.pem')
os.environ['SSL_CERT_FILE'] = cert_path
omz

@ccc

Is there a reason to leave that out of Pythonista3?

Not really, I'll put it in the next build.

tomkirn

Using the console in Sharing extension has an input area which is shown to high above the keyboard. (iPad Air 2 Landscape)

wnMark

@omz
Thank you again for the newest beta for Pythonista 3.

This is not new:
The additional keyboard disappears going to search line. I would appreciate the additional keyboard in search!

dgelessus

@omz Odd visual bug: Start with the file list open. "Flick" the editor to the left so it has enough "momentum" to fully close on its own. After letting go, but while it is still sliding, grab the editor again and slide the file list open. Now the file list is completely black. (If you don't understand what exactly I mean, try flicking the editor left and right quickly a few times without letting the file list fully close, then you'll probably see what I mean.)

filippocld

That also happens if you close(slide to the left)and you press the up left corner(where the button is when the files are not shown

JonB

One suggestion: use modernize rather than lib2to3, as this will result in code using six that is compatible with both pythonista versions. This should also be included in p2, to help folks write compatible code so we don't become TOO fractured.

Alternatively, python-future seems to result in clean code when python 2.6 or earlier does bot need to be supported, which seems to be the case here. (in which case futurize and pasteurize allow conversion of existing p2 or p3 to a compatible codebase). This might be a good addition to both versions.

Tizzy

Hey guys! Does anyone know what the url scheme looks like for accessing a file in the Pythonista 2 folder from Pythonista 3?

/* UPDATE * :

Thanks to the comments below @Webmaster4o and @dgelessus .

Tried

pythonista3://{{../../Documents/aaaFiveStarsProduction/destinationator.py}}?action=run

as per your suggestions... and that did the trick.

****/

Webmaster4o

The URL scheme starts in documents, I think. You'd have to do ../Pythonista/Documents. I don't know if this works, though. You could also os.symlink a folder inside Pythonista3's Documents to that of Pythonista 2

dgelessus

Pythonista 2's Documents folder is at pythonista3://../../Documents and Pythonista 3's Documents folder is at pythonista://../Pythonista3/Documents. The starting location is always the app's own Documents folder, which is why you need to go two steps up with Pythonista 3 and only one step up with Pythonista 2.

Tizzy

Just installed build 300004.

in 300003, importing scripts in the same folder as main script worked. Now it's throwing an
```
ImportError: No module named 'utilizer'

for everything that's not part of the built in stuff as far as I can tell.

for example given 2 files
Project/main.py
Project/other.py

this is main.py

import requests
import other

`` fails onimport other`

omz

@Tizzy Thanks, I'm aware of that, should be fixed in the next build.

omz

@JonB

One suggestion: use modernize rather than lib2to3, as this will result in code using six that is compatible with both pythonista versions. This should also be included in p2, to help folks write compatible code so we don't become TOO fractured.

In the new beta (300005), you can use either 2to3 or python-modernize. If I add this feature to P2 as well, it'll probably make sense to only use python-modernize there.

The various SSL certificate validation errors should be gone btw. (let me know if not).

@Tizzy
Importing from the same folder should be fixed in 300005 as well.

@ccc
yaml is in there too (though minor difference to P2: I didn't build the optional C extension, it was a bit difficult to get working, the module works without it, and I don't think anyone is really parsing huge amounts of yaml on iOS in a way that the performance difference would be noticeable).

ccc

@omz You continue to amaze us with these updates... Really impressive. The pep8 and flake sound great. I think we can all live with interpreted yaml. ;-)

OI

@omz I have to say that you are raising the bar, BIG TIME, P3 is becoming a real professional Python development tool, is there a way to do PayPal donations, I personally think Pythonista is undervalued in the App store, my personal opinion though.

Webmaster4o

For how long are you planning to keep the 2.0 version up to date?

The 3.0 beta just got a bunch of awesome features that are not in the 2.0 beta, such as style checking (yay \o/), fixing syntax highlighting for multiple imports on one line (something I've been complaining about for a while), as well as the built-in theme stuff, and line numbers on 6 and 6+.

How many of these features will make their way into the 2.0 beta, if any? For how long will you support both?

omz

@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.

Webmaster4o

Thanks, @omz. One more thing, both methods of 2to3 conversions are seem to be currently broken:

omz

@Webmaster4o Hmm, I have a suspicion that this might have to do with you using a custom theme. I have to admit that I didn't really test this properly. Could you check if that error goes away if you use one of the built-in themes?

Webmaster4o

@omz Yep, it does.

Another suggestion, I suggest that you implement syntax highlighting for the "confirm" screen with the 2to3 conversions.

dgelessus

@omz objc_util.on_main_thread (and possibly other decorators) should use functools.wraps to copy the old function's metadata to the new one. For example at the moment the help function is basically useless on functions decorated with `on_main_thread':

>>> import editor
>>> help(editor.annotate_line)
Help on function new_func in module objc_util:

new_func(*args, **kwargs)

>>> help(editor.annotate_line.__closure__[0].cell_contents)
Help on function annotate_line in module editor:

annotate_line(lineno, text='', style='warning', expanded=True, filename=None, scroll=False)
omz

@OI

@omz I have to say that you are raising the bar, BIG TIME, P3 is becoming a real professional Python development tool, is there a way to do PayPal donations, I personally think Pythonista is undervalued in the App store, my personal opinion though.

That's very kind of you, but I really wouldn't feel comfortable taking donations. Pythonista is doing quite well, actually – over the last 3 years, I've managed to convince an average of 50 people every day to buy the app, and as a solo developer without a lot of expenses, I think that's pretty good. :) There are a lot of projects that need donations much more than I do.

omz

@dgelessus

objc_util.on_main_thread (and possibly other decorators) should use functools.wraps to copy the old function's metadata to the new one.

Good point!

OI

@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%.

ywangd

@omz said:

@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?

omz

@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.

Olaf

@omz wow, 3 * 365 * 50 > 50,000 Pythonistas, that's quite a global tribe!

Phuket2

@OI. I think a key put off word for @omz here might be donation. I am just guessing, but I know for myself it would be. But I feel the same as you, I want to give more.

@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.

wradcliffe

@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.

wradcliffe

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 ...

1) 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.

2) 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.

3) 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.

4) 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.

Oscar

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.

OI

@Oscar me too, same day!!

Tizzy

@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.

Webmaster4o

@omz Thanks for the new features in Pythonista 2. I'm still using that as my primary version.

Tizzy

regarding StringIO and cStringIO. It's my understanding that in Python3 there is no cStringIO. It's also my understanding that in Python2 cStringIO.StringIO was faster than StringIO. Since in Pythonista3 cStringIO gives an ImportError, I'm wondering whether the faster cStringIO is gone or if StringIO is now that faster version by default with the simpler name.

I'm using this as
file=cStringIO.StringIO(urllib2.urlopen(url).read())
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)

filippocld

I like python 3.5 but my heart is for 2.7 <3

omz

@Tizzy There's just one StringIO implementation in Python 3, it's basically cStringIO with a different name, and it's been moved to the io module.

If you just want to use StringIO on 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[0] >= 3:
    from io import StringIO
else:
    from cStringIO import StringIO

You could also use the six compatibility layer:

from six import StringIO  # works for Python 2+3
Tizzy

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...

omz

@Tizzy said:

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.

Tizzy

@omz WOW. I feel stupid. I've been using it in tabbed mode for so long I forgot there was anything else.

due3die

@omz Applied kindly invite me.

wnMark

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.

zense

@omz said:

http://goo.gl/forms/DMpM7sBHhl

Have yet to get the invite for the Pythonista 3 beta. Is the form not working? Or is Ole on a well deserved break somewhere? ;)

ccc

Ole take a break?!? I doubt that ever happens! 😎

AtomBombed

@omz so I was just taking a little stroll through my iPad's filesystem, and I noticed in the Pythonista Python library that there is a file template for something called "SpriteKit". It's module is sk. Hopefully I didn't just spoil anything cool for the next update, but is this an old, deprecated feature?

omz

@AtomBombed It's a leftover from a discontinued feature (was part of a beta months ago).

omz

@zense I don't check every day if new people have signed up, and right now, iTunes Connect is down, so I can't send invites (or upload betas) at the moment.

Leva7

@omz, Hi, thx for the invite. Playing around with the new interface and trying out the example scripts on my iPod Touch 5 running iOS 8.4, I've experienced the following issues (really hope none of them were mentioned, if they were - excuse me :) ):

  • The font size selector in the general app settings is quite unresponsive - I press like 10 times in a short period of time and it slowly increases/decreases. Also the style of the selector is out of place - in the UI designer it is a draggable thing, but there it is an old +/- sign.

  • Sometimes (I don't really know what's causing this, the first time I got it was when I first loaded the demo script game_menu and switched to the Match3 script through the navigation sidebar) the file selector randomly turns completely black for a certain amount of time or until you close the sidebar.

  • The Camera Scanner crashes the app when I load in a pic, it might be because of the weakness of my iPod :).

  • The keyboard "tick" sound is disabled in my system and the keyboard doesn't "tick", however the top row of buttons does (e.g. when adjusting the typing position), that's kinda annoying.

  • All the plot scripts, even the simplest one, crash the app. I think the reason here is the same as that pic scanner script, but having MPL on an iPod would be cool, take a look to see what can be done here.

  • The keyboard dismissing button is gone, so pretty much I haven't been able to dismiss it except for just running the script or such. (It might just be my stupidity)

  • The undo button is very inconveniently placed, every time to undo you gotta hold the colon. I liked it more when you had a second button page, but there has to be a reason you did it this way, right?)

  • I haven't found a way to input a hex string to the UI color picker, there is just a big pallete and one slider (also I wish the scroll speed would adjust based on where you drag, you know, like iOS sliders in general). Is there one? Because if not, this is desperately needed.

  • The widgets in the UI designer are a little too easy to drag and resize, for example if it is positioned like 3 pixels off of where it would automatically stick, when pressing the widget for the bubble popup, it just jumps to the fixed place, which is not so handy. Also it would be nice to zoom out in the designer.

  • The new copying mechanic doesn't keep size. On one hand it is good, e.g. for a color copy, but when creating tons of similar sized buttons, the entire copying of the widget would be much more useful.

  • The main UI background & tint colors are nowhere to be seen. However, again, maybe I'm just blind (then excuse me :p)
    Wow, I've probably destroyed this message page. Accept apology because I'm sure most of the issues described above are my fault :) Peace!

dgelessus

@Leva7 To dismiss the keyboard you can swipe left to open the file list. Even on my iPad I use that instead of the iOS "hide keyboard" button - I usually have a Bluetooth keyboard connected, and in that case the button doesn't unfocus the current text field, but it disables the onscreen keyboard so you have more screen space when using the external keyboard. This is very annoying when I'm not using my external keyboard, because the only way to bring back the onscreen keyboard is to press the "eject" key on the external keyboard (or by turning off Bluetooth to forcibly disconnect the external keyboard).

Leva7

@dgelessus, Yea, it works, but I'd like something specifiaclly for that purpose

Webmaster4o

@Leva7 I can dismiss the keyboard on my phone by swiping from above the keyboard down onto the area the keyboard covers. Try this.

Leva7

@Webmaster4o, is it mentioned somewhere (like docs or smth like that)? It also works, but then first the keyboard disappears and after a little delay, the top row does. Also not a problem, but I think it would be better to dismiss the whole keyboard window at once. Also this way, we are forced to scroll up in the editor so that's not so convenient. A button would be perfect imho

Leva7

The UI designer should display a popup bubble after a single touch, so that the widget wouldn't stick to an unwanted position. Is there a reason you did it this way, @omz? Also, I believe this shouldn't happen (the bubble should disappear when selecting a different widget). Also, is there a possibillity to add the guidelines that will stick widgets directly to each other without gaps? It would also be quite useful (e.g. in creating a button panel of some sort)

AtomBombed

@omz oh ok. I was just wondering if it was something new I should be excited about. Thanks!

Leva7

@Leva7 said:

but then first the keyboard disappears and after a little delay, the top row does.

Here in the interactive prompt it is actually a noticeable delay. This is what I mean.

Leva7

Another thing. The ability to switch between the script and the associated UI file with a touch of a button. The tabs system is cool, but for switching between scripts. Separately opening a pyui file is a lot of work) Because I find the "+" button in the code editor rather useless, maybe there could be a shortcut to a UI file in its place?

P.S. Is this the official bug reporting topic? Cause I have a feeling it's not so I feel bad about flooding :p

AtomBombed

@omz so: your most recent update is amazing. I love it. But it came with a removed feature that was really amazing in the other versions. Alignment. In the UI designer it is so hard to align elements properly in relation to each other due to the removal of the alignment feature.

zense

@omz said:

@zense I don't check every day if new people have signed up, and right now, iTunes Connect is down, so I can't send invites (or upload betas) at the moment.

Ah...

Just did a quick check. Apparently there is a workaround. Just go via developer.apple.com rather than itunesconnect... Saw this via some tweets

https://twitter.com/steeg/status/705740591385190400

omz

@zense Yes, I saw that too (doesn't seem to be necessary anymore). You also should have gotten an invite already. Maybe check your spam folder?

wnMark

I discovered a very small issue in 3000005 (and same in 201005).

I have send some selected files and a sub folder with mail. The folder was summarized in one file without extention ZIP. No problem after I renamed the file everything worked fine!

wnMark

I am using iphone6 in "zoomed view mode". In this case in setup I am missing the option "Show Line Numbers". If I am in "standard view mode" I can switch to this option and the lines still remain in "zoomed mode". I suggest to ofer this option in every mode and also for other iphones in lower resolution.

Leva7

Moar stuff, this time it is about the docs in the new beta.
Slightest issue: raw_input is mentioned in the console module docs, however, as you know, it no longer exists.
The contacts module documentation badly needs renewing. First of, the examples are given in Python 2 so running them results in an error (mostly the prints). Then, the indentation is 2 spaces. Like wow, that just took me a second to deal with it and proceed :)
Also, the reminders module docs are in Python 2 as well.
That's not something that desperately needs fixing but it would be nice

wnMark

If I make a "Indent" on a marked text, it work fine with indent of context menu, but if I make the indent with the key on additional keyboard or with tab on a bluetooth keyboard, the selected text is deleted.

Skeo

Trying to get the dropbox sync script working in P3 and running into OAuth errors. Google is telling my its to do with dropbox not supporting python3 and that I need to install the new SDK https://github.com/dropbox/dropbox-sdk-python

Is this something I can install myself somehow or does pythonista need to be updated?

dgelessus

I thought @omz had included the Python 3 versions of all modules with Pythonista 3. Can you post the error that you get (and the code, if you made any changes)? Then we might be able to help you.

omz

I've updated most modules for Python 3, but I think I might have missed dropbox...

OI

Hi, any update or timeline on the new beta or final release? thanks

ccc

+1 @OI ... We are only 6 or 7 weeks away from Python 3.6 alpha 1 being released and it would be great to have Pythonista3 (.5.1) released before Python 3.5.1 is no longer the latest and greatest Python release. Pythonista is still Python 2.7.5 vs. 2.7.11 being current so it would be great to have a shipping Pythonista that is the current version of Python.

I really think that Pythonista3 is not perfect but it is good enough to ship and I doubt that users would be displeased by its current fit and finish. The perfect is the enemy of the good.

But of course the decision rests with @omz where it belongs.

omz

@ccc @OI

The final version of Python 3.6 is still quite a long way off, so I'm not too concerned about that...

The current beta is taking a bit longer because I'm in the process of making some pretty substantial changes. In short, I've found out that my assumptions about using Python 2 + 3 in the same app were incorrect, and that it is in fact possible to do this, even without having to restart the app when switching interpreters.

As I really only want to have one version of Pythonista, to avoid confusion and backwards-compatibility woes, my current plan is to make Pythonista 3 support both Python 2.7 and 3.5. It's actually working quite well already, but there are just a lot of little details to consider, things to move around, refactor, etc.

This doesn't change my plan to make this a paid upgrade btw.

ccc

You never cease to blow my mind! Super impressive. The duplicate standard library and duplicate docs size is not going to cause the combined app to be too big?!? Pythonista 2 on the App Store is already 236 MB.

omz

The duplicate standard library and duplicate docs size is not going to cause the combined app to be too big?!? Pythonista 2 on the App Store is already 236 MB.

I do think that 3.0 will end up being bigger than 2.0, there's probably no way around that, but I'm fairly optimistic that I can keep the size increase reasonable.

I've already optimized a couple of things, e.g. by compressing the documentation in recent betas, and parts of the documentation can probably be the same for 2 + 3 (e.g. matplotlib, which is actually the biggest part).

The standard library will have to be duplicated of course. I'll have to look at the third-party packages individually, to see which of them can be shared (some have separate Python 3 code bases).

Right now, my priority is to get everything working smoothly, so the first betas of this "universal" version will likely end up being bigger than they strictly need to be, but optimizing the size of the final app is definitely on my todo list.

dgelessus

Sounds great! This will probably make the move to Python 3 much easier for people who aren't used to it or have lots of Python 2 code. And it should make it quite obvious which version new people should buy, if PythonistaSix supports all of Pythonista 2's features and adds Python 3 support.

@omz If it's possible to switch between Python 2 and 3 interpreters without killing the app, would it be possible to do a proper interpreter restart before each script run? I do like keeping my interactive environment when running scripts, but having a proper reset function would also be useful. Lots of obscure bugs can happen when something unexpectedly isn't reset between runs (e. g. attributes of non-user modules) and some programs intended for "normal computers" can fail if they aren't run in a fresh environment (e. g. setuptools/pip caches package installation state in a global module).

OI

@omz, wow you never stop amazing me, you keep raising the bar!!! Looking forward for the paid upgrade.

Phuket2

@omz

I'll have to look at the third-party packages individually, to see which of them can be shared (some have separate Python 3 code bases).

@omz, just a thought. I am guessing you had it already. But a way for the user to download 3rd party documentation separate from the install. Could streamline a lot of things for you. I can't see that should be burdensome for the user. Also would give you a way to update the help without app updates. I am sure many other benefits.

Webmaster4o

@Phuket2 I don't think @omz wants to make his users download the core documentation. It'd be neat to have a way to extend the built-in docs with documentation for new libraries, but the goal of Pythonista is really to be "Batteries included" as much as possible.

Phuket2

@Webmaster4o said:

@Phuket2 I don't think @omz wants to make his users download the core documentation. It'd be neat to have a way to extend the built-in docs with documentation for new libraries, but the goal of Pythonista is really to be "Batteries included" as much as possible.

I agree. The core should be there. But a download and a update could be very beneficial.
But maybe I misunderstand what the the core is. For me it's just the std Libs and the iOS Libs for Pythonista.

But I can just image, the compile/submit process could just keep growing. I would go as far to say remove the grahics lib for icons etc except for what is needed by Pythonista itself and make them also downloadable.
My line of thinking is over time this will help the scaling of the project. In the end it will help us. If @omz can keep the main project at relatively constant size, but at the same time be able to add resources such as sound files, extra icon Libs etc without affecting his normal make/submit workflow, he will be a lot more open to doing it.

Yes, there a are some issues. First he has to write the mechanism, then we're are the files to be downloaded from.

But again, just thinking long term and scale

JonB

You can always download your own docs and create a script to open in a separate tab. Actually, i think with objc you could open in the docs tab as well, though this wouldn't be searchable.

Phuket2

@JonB , hmmm, I don't really know how to download my own docs. I hope I don't have to learn. But if it was just a button inside Pythonista , or several buttons based on the Libs installed, that would be fine.

But I am sure you understand all aspects of scalability. There are pros and cons of course in all aspects of it. Is not only help files, many other resources also. Even ones that don't exist in Pythonista today. I have also had to deal with these issues in the past. Not exactly the same , but same idea. It gets very complicated, as there are so many ways to skin the cat so to speak.

At the end of the day, personally I would like @omz to have a way to extend Pythonista in many ways without changing his workflow for the app. But I recognize to build in this functionality will not be trivial, of course if you can assume everything is local it's easier

omz

@dgelessus

If it's possible to switch between Python 2 and 3 interpreters without killing the app, would it be possible to do a proper interpreter restart before each script run?

This doesn't fundamentally change how scripts are run. The interpreter(s) still live in the same process as the main app, so shutting them down completely isn't really possible for a variety of reasons.

dgelessus

Ah okay. Do the Python 2 and 3 interpreters run at the same time, or can only one be "active" at once?

omz

@dgelessus They could theoretically run at the same time, but the UI doesn't allow this.

ccc

So I could run a Python3 AsyncIO backend with no UI and a Python2 UI rich frontend in parallel inside a single iOS process?? Hypercool.

Skeo

@dgelessus Do you know if there is a way to copy/paste the traceback error from in pythonista or do I just need to type it out by hand into the forum? It was a bunch of levels deep, but I don't have my ipad with my to copy it right now.

I didn't change any code as I couldn't figure out how to modify the dropbox module that is built in. Clicking on the links in the traceback shows the relevant files in read-only. That's why I posted here asking if updating the module using the new SDK is something I can actually do myself. I assume @omz has this on the to-do list now?

Webmaster4o

@Skeo You could traceback.print_stack() and copy that (that may not be the exact name, check the documentation for the traceback module.

dgelessus

@Webmaster4o I think you want traceback.print_exc or traceback.print_last. traceback.print_stack only prints the call stack, which you can do even if no exception is raised.

filippocld

How is the development going? It's been almost two weeks now

OI

Same here, I am really eager to test the next version !!!

omz

@filippocld @OI I've just uploaded a new build to TestFlight – it's still processing, so I probably can't push it until tomorrow (getting pretty late here). There are still some rough edges in the debugger and the whole Python 2+3 integration, but it should be usable overall.

OI

@omz Thanks

dgelessus

@omz When in doubt, blame daylight saving time. ;)

(Explanation for non-Europeans: Our DST just began last weekend.)

Webmaster4o

@dgelessus My DST started about 2-3 weeks ago I think. I can't remember. Just remember being tired :)

cook

I have no DST!
#whyisthesunupat4am

Webmaster4o

@omz Update looks really good! First things I noticed:

  1. Great new icon!
  2. The "Run with Python 2.7" option has to be selected every time. My idea on this is:
    • Have a small number 2 or 3 shown in the bottom right of the "Run" icon to show whether Python 2 or 3 is selected to run
    • If a user selects the "Run with Python 2.7" option manually, change the indicator to say 2.
    • The interpreter would run with Python 2.7 until the user long-pressed the run button and selected a "Run with Python 3.5" option.
    • This toggling behavior would make using Python 2 vs 3 easier if a user prefers one over the other but still wants to switch quickly. I think a user wants to use the same interpreter they just did a second ago more often than a user wants to switch interpreters.
  3. If I long-press the "Run" button and hold on an option, it becomes highlighted and changes color. If I slide up and down the options, they all become highlighted without the ones I've moved my finger off of becoming un-highlighted.
OI

I love the new icon, nonetheless after the app has been installed I still have the old icon from the previous beta. I tried removing and re-installing again, the same thing, still the old icon

alexquot

Hello. Is there any way to understand whether my beta request was abandoned or not?

filippocld

The icon is good! Now it's downloading :-)

filippocld

@omz Can you make a unified folder (now there is pythonista 2 and pythonista 3) Now that we can select the python version?

Image

OI

In the Task Manager (double click home button) the correct icon is displayed on my iPad Pro, but on my iPhone 6 Plus the task manager will show the old icon, it's weird because they are using the same iOS version.

dgelessus

@Webmaster4o Did you see the option to change the default Python version in the settings?

@OI That is probably the issue mentioned in the release notes, that the new icon is missing for some resolutions (probably the non-Retina ones) so the old one is displayed instead. And to be honest I like the old logo better... possibly because every other Python app uses the Python logo in the icon. The "prompt" icon is different and more recognizable IMHO.

@filippocld Agreed, though it would be good to have separate site-packages folders for the two versions (I think currently Python 2 uses the Pythonista 2 site-packages). Not all modules have a single codebase for Python 2 and 3, I think some projects just run 2to3 or 3to2 on their source code.

Webmaster4o

@alexquot It wasn't. He probably just hasn't gotten to it yet.

Webmaster4o

@dgelessus Yeah, I saw that. I just think my solution would be smoother

@omz Thanks so much for speeding up print!

filippocld

@Webmaster4o Honestly your solution does not make sense to me. If you really want to switch versions fast just put the

#!/usr/bin/env python3

line at line 1 of the script

dgelessus

@Webmaster4o I do like the idea with the small number showing what Python version will be used, even if there is no toggle in the run menu. (Then you could also see if Pythonista recognizes the script's shebang line correctly.) In the patchnotes omz said that the interactive console's version switching behavior might be changed in the future.

@omz Any chance that we could have interactive Python 2 and 3 in separate tabs, so we can use them in parallel and switch between them? I like @ccc's ideas for how that could be used to run two scripts at the same time.

tomkirn

@OMZ: Great new beta. Nice icon but to much "Python" and to less "Pythonista". Maybe an icon with both symbols (big old symbol and small python icon within) could do it.

Webmaster4o

@omz how do you plan to handle different versions of modules for Python 2 and 3? We may need two site-packages directories. Note that on desktop, pip will only install for Python 2 and pip3 will install for Python 3, keeping them separate…

filippocld

Yeah, like "site-packages" and "site-packages3" that's a simple and fast way

dgelessus

@omz console.write_link seems to be broken in this build. For example, print("foo", end=""); console.write_link("title", "http://example.com/") prints titlefoo instead of footitle.

PS:

Looks like a threading issue. print("foo", end=""); time.sleep(0.1); console.write_link("title", "http://example.com/") works as expected.

PPS:

And console.set_color doesn't work properly either in combination with console.write_link.

(Ignore the use of multiprocessing, that was just to generate a long traceback. I'm testing a custom sys.excepthook.)

filippocld

I'd like if you could add breakpoints by simply tapping on the line number ( like in Xcode)

filippocld

(Sorry for fragmentating the reports but i write them as i discover)

-The pythonista starting script apparently runs 2 times
-Some keys like <> are glitched when you longpress

omz

@Webmaster4o

The "Run with Python 2.7" option has to be selected every time.

I'll probably keep it this way. It's mostly intended for checking compatibility with the other version, if you want to run Python 2.7 more often, you can use a shebang line (btw. #!python2 is enough for Pythonista, you don't have to include /usr/bin/env if you don't plan to run the script on other platforms).

If I long-press the "Run" button and hold on an option, it becomes highlighted and changes color. If I slide up and down the options, they all become highlighted without the ones I've moved my finger off of becoming un-highlighted.

I'm aware of that, but it's not that easy to change, unfortunately (the control I'm using there (UIAlertController) doesn't really support theming, and while I could write my own alert popover implementation, it doesn't really seem worth it for this).

@alexquot

Hello. Is there any way to understand whether my beta request was abandoned or not?

I've just sent out a bunch of new invites. If you didn't get yours, please check your spam folder. If you sent me your request via email/twitter (and not this form), I may have overlooked it. Please use the beta signup form.

@dgelessus

console.write_link seems to be broken in this build

I'll look into that. I did some experiments to speed up print, it probably has to do with that somehow...

how do you plan to handle different versions of modules for Python 2 and 3?

I'm not completely sure yet. It'll probably be some variation of "two different site-packages" folders.

@OI

In the Task Manager (double click home button) the correct icon is displayed on my iPad Pro, but on my iPhone 6 Plus the task manager will show the old icon, it's weird because they are using the same iOS version.

As I mentioned in the release notes, I forgot to include the new icon for all sizes/resolutions (the iPhone 6 Plus uses 3x images, unlike every other iOS device).

I'm also not sure yet if I'll even keep that new icon...

@filippocld

I'd like if you could add breakpoints by simply tapping on the line number ( like in Xcode)

I don't know, it seems to me that this could easily conflict with putting the cursor at the start of a line, and setting breakpoints is probably not something you do often enough that it needs to be accessible with one tap.

-The pythonista starting script apparently runs 2 times

Yes, once for each interpreter.

Some keys like <> are glitched when you longpress

Hmm, could you clarify that, perhaps with a screenshot? I don't see any glitches here when I longpress the > key.

omz

Hmm, could you clarify that, perhaps with a screenshot? I don't see any glitches here when I longpress the > key.

@filippocld Actually, scratch that, I think I know what you mean now – it only happens when you use the two-row variant of the extended keyboard ("Extended Keyboard with Numbers" in the settings).

tomkirn

@OMZ: Is it possible to make the different Standard Libraries (PythonistaKit.framework / PythonistaKit3.framework) visible? I found that some modules have different versions (e.g. dropbox) but only the framework3 versions are shown via "show standard library" which can be confusing (especially for a beginner like me).

omz

@tomkirn

Is it possible to make the different Standard Libraries (PythonistaKit.framework / PythonistaKit3.framework) visible?

Yes, I have that on my todo list (I got very close to the character limit for the release notes, so I didn't mention it there).

filippocld

@omz about the breakpoints: maybe doing a long press would add a breakpoint and a single press just edit?

RedDrago

Just installed the new Beta and the change notes looked awesome but it crashes on launch. I'm on 8.4 on an iPad 3 for reference and the previous version was working fine. I am jailbroken and have CrashReporter but it doesn't seem to be recognizing the crash so identify an issue that way. Tried deleting and reinstalling and rebooting which don't seem to help. Any ideas anyone, thanks for the help.

omz

@RedDrago Thanks, I'll see if there is perhaps some incompatibility with iOS 8 (I don't test that very often, and I might actually drop iOS 8 support entirely in the final version).

ihf

I have tried several times on 2 iPads to use Testflight to install the latest beta of Pythonista 3 and each time it gets 95% (or so) done and then stops..the install never completes.

omz

@ihf How long have you waited? It's fairly common for the installation/download to take a pretty long time, and the progress display isn't always accurate (especially for an app like Pythonista that contains a very large number of small files).

dgelessus

@ihf How long did you wait? I remember in earlier Pythonista betas the install times could be quite long, at least 15 minutes or so). Then again, my iPad likes to crash when updating apps, so my install times are probably not normal either. The install times have improved with current betas though.

@omz On the progress meter on the app icon, the download phase is the first 2/3 and the install phase is the last 1/3. On the progress meter in the App Store (and probably TestFlight too), it only shows the download progress and shows 100% for the entire install phase. The displays aren't inaccurate, they are just very strange, and they only show progress, not time spent/remaining.

RedDrago

@omz "Dyld Error Message: Symbol not found: NSArray0" seems to be error I'm getting. I tried googling the error and it seems if you remove and add CoreFoundation it fixes it. Or if you make the build target 8.4 that seems to fix it for some. Hope that error helps somewhat. Also makes sense to not support 8 anymore especially since anyone who experienced the horrors of 8 upgraded to 9. I might upgrade soon too and it might be because of your awesome app

ihf

@dgelessus I have waited hours. It does not complete. I tried deleting the old copy and it still stops just before completing the install. I have not deleted the copy of Pythonista 2.7, is that necessary?

alexquot

@omz Thanks a lot, now the beta invite came to me too. Sorry for me being impatient.

I asked for this in the beta request, here is the duplicate. It would be great if there were more shortcuts for external keyboards in P3. For example, ctrl+tab for the tab switching would be a useful feature.

@ihf Beta works fine with the P2 installed. I think that the P2 existence doesn't matter for the P3 installation. Moreover, there's a P2 folder support in the P3, which means that P2+P3 should be ok.

omz

@RedDrago Thanks, the problem seems to be that I accidentally built one of the shared frameworks with a deployment target of iOS 9 (the default setting). Should be easy to fix, but you'll have to wait for the next build (but that shouldn't take as long as the last one).

RedDrago

@omz Oh awesome yea thats not a problem atleast you found the problem

Webmaster4o

@filippocld That breakpoint thing won't work well on small iPhones. But let's use this as an excuse to pressure @omz into letting me have line numbers on my iPhone 5! (please)

omz

@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)

ccc

@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.

userista

@omz @Webmaster4o +1 for line numbers (and/or wrap glyphs) pleeeease

ihf

@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.

omz

@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.

ccc

In Pythonista3 beta import sympy throws NameError: name 'long' is not defined.

omz

@ccc Not here. Are you sure you don't have a different version of SymPy in site-packages or something like that?

tomkirn

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.

dgelessus

Yes, the appex module 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.

dgelessus

@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.

omz

@RedDrago @ihf The new build should work with iOS 8 again.

wnMark

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.

dgelessus

@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).

wnMark

@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.

geo

While entering a multi-line command, pythonista chokes after the first line, so:

exec('for i in range(10):\n print(i)')
0
1
2
3
4
5
6
7
8
9
for i in range(10):
File "", line 1
for i in range(10):
^
SyntaxError: unexpected EOF while parsing

dgelessus

@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.

geo

Thanks, @dgelessus. Are the known issues accessible somewhere so I can read them and try not to clutter up this forum?

dgelessus

@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...

dgelessus

@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.)

disorientedp

@wnMark said:

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.

Here's a screenshot demonstrating this:
screenshot

dgelessus

@disorientedp That's kind of how it looks for me too, except that it's further down (probably because I use an external keyboard).

RedDrago

@omz Thank you!!! Yep its working again and wow that was fast.

RomSpy

I am not sure if it is intentional but on my iPad mini 2 running iOS 9.3 when I slide over the file explorer portion I loose all of the settings icons on the top right above the editor window. The old version did not do this.

JonB

@dgelessus said:

  • 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. :)

Wait... is that possible!? What about vice versa?

dgelessus

@JonB In Pythonista 3, probably yes. The two runtimes are always running in the background, though you can only interact with one through the interactive prompt. I'd assume that you can use the C API to exec code in the other one while it's inactive.

Phuket2

@dgelessus , does that mean one runtime could run say bottle or flask for example and stay alive so you could use the other runtime to code against it? maybe a stupid question. Just thinking out aloud

dgelessus

Possibly... I don't know how the two runtimes run threading-wise. The startup scripts are executed one after the other, so perhaps you can only run code in one interpreter at a time.

Phuket2

@dgelessus , ok thanks. Just interesting if can be done. I am sure with other things also

dgelessus

@JonB Definitely possible.

>>> print(".".join(str(x) for x in sys.version_info))
3.5.1.final.0
Out[19] = None
>>> state = py2.PyGILState_Ensure()
>>> py2.PyRun_SimpleString(b"import sys\nprint('Hello from ' + '.'.join(str(x) for x in sys.version_info))")
Hello from 2.7.5.final.0
Out[20] = 0
>>> py2.PyGILState_Release(state)
Out[21] = None
Webmaster4o

On iPhone, the scrollbar can slide behind the tab button. The scrollbar should probably go on top to remain visible.

Phuket2

@omz, sorry if this has be talked about. But, for those running the 2 betas, do we need to make sure we have switched over from the 2.7 beta to the 3 beta along with copying the code over before the 2.7 beta expires? Or are you releasing another 2.7 beta?

omz

@Phuket2 I think I'll make another 2.0.1 beta in the meantime, but even if it expires, you should be able to access your files via Pythonista 3 (launching the app wouldn't work, but your files wouldn't disappear).

Phuket2

@omz , ok. Thanks. Good to know

gebloom

@omz

New to the beta:

Is it so that you can't define functions in the console, or am I doing something wrong?

omz

@gebloom That's a known issue, still on my todo list.

OI

On the latest beta once I press the split screen (editor and console) icon on the top left (half blank half shade) it will open the split screen but the icon will disappear and there is no way to set the console or editor to full screen again, it will be split screen forever. I did not find a way to fix it, I had to uninstall the app and install it again.

omz

@OI
Oops, sorry! If you have a split-screen capable iPad (Air 2 or later), you can work around this by putting Pythonista in split-screen mode (this will automatically undock the console).

Otherwise, you can run the following code and restart the app afterwards (just as a temporary workaround until I can get a new build up):

from objc_util import ObjCClass
ObjCClass('NSUserDefaults').standardUserDefaults().setBool_forKey_(False, 'DockedAccessoriesPanel')
wradcliffe

Example Music Stats.py does not run. Throws an Attribute Error on the NSBundle call. Can be fixed by changing

NSBundle.bundleWithPath('/System/Library/Frameworks/MediaPlayer.framework').load()

to

ObjCClass('NSBundle').bundleWithPath_('/System/Library/Frameworks/MediaPlayer.framework').load()

omz

@wradcliffe I already fixed that, but the sample code doesn't update automatically during the beta (if you select "Restore Examples" from the settings, you should get the correct version).

OI

@omz I have an iPad Pro, I love the Split-Screen mode, thanks for that.

I also noticed that the Extended Keyboard with numbers option does not apply for the iPad Pro because the keyboard already has numbers.

wnMark

On 300008 all additional keyboards works fine again. I am also happy with the number keyboard on iPad Pro (2015). Most time I am using the Apple Smartkeyboard and in this case the number row of additional keyboard helps very much!

Skeo

@dgelessus @omz Apologies for my delays replies. Been very busy.
Here is my traceback error for the dropbox module

Getting request token...
>>> import traceback
>>> traceback.print_last()
Traceback (most recent call last):
  File "/var/containers/Bundle/Application/A9B030F9-D4F9-4655-98F2-138229441753/Pythonista3.app/Frameworks/PythonistaKit3.framework/pylib/site-packages/dropbox/session.py", line 325, in _parse_token
    key = params['oauth_token'][0]
KeyError: 'oauth_token'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/private/var/mobile/Containers/Shared/AppGroup/E1A188D0-4D1B-4343-8EB4-AB6ECC41AA73/Pythonista3/Documents/dropbox_sync/dropboxlogin.py", line 55, in <module>
    main()
  File "/private/var/mobile/Containers/Shared/AppGroup/E1A188D0-4D1B-4343-8EB4-AB6ECC41AA73/Pythonista3/Documents/dropbox_sync/dropboxlogin.py", line 50, in main
    dropbox_client = get_client()
  File "/private/var/mobile/Containers/Shared/AppGroup/E1A188D0-4D1B-4343-8EB4-AB6ECC41AA73/Pythonista3/Documents/dropbox_sync/dropboxlogin.py", line 40, in get_client
    access_token = get_access_token()
  File "/private/var/mobile/Containers/Shared/AppGroup/E1A188D0-4D1B-4343-8EB4-AB6ECC41AA73/Pythonista3/Documents/dropbox_sync/dropboxlogin.py", line 32, in get_access_token
    request_token = get_request_token()
  File "/private/var/mobile/Containers/Shared/AppGroup/E1A188D0-4D1B-4343-8EB4-AB6ECC41AA73/Pythonista3/Documents/dropbox_sync/dropboxlogin.py", line 21, in get_request_token
    request_token = sess.obtain_request_token()
  File "/var/containers/Bundle/Application/A9B030F9-D4F9-4655-98F2-138229441753/Pythonista3.app/Frameworks/PythonistaKit3.framework/pylib/site-packages/dropbox/session.py", line 222, in obtain_request_token
    self.request_token = self._parse_token(response.read())
  File "/var/containers/Bundle/Application/A9B030F9-D4F9-4655-98F2-138229441753/Pythonista3.app/Frameworks/PythonistaKit3.framework/pylib/site-packages/dropbox/session.py", line 327, in _parse_token
    raise ValueError("'oauth_token' not found in OAuth request.")
ValueError: 'oauth_token' not found in OAuth request.

It appears to be a simple case of using a bytestring as the dictionary lookup key, but according to this, there are more issues than just that and ultimately dropbox module v1 is incompatible with python3. The new SDK however (module v2) is compatible and backward compatible with old code too, so it should be a simple case of updating the module in pythonista. As I mentioned in my first post, I'm not sure I can do that myself, I've been reading around about installing modules with pipista etc, but it seems like its pretty hit and miss and I don't have heaps of time to spend messing around getting dropbox syncing to work.

Should I assume that the module will be updated at some point before P3 is released from beta, and I just need to wait? Would it be possible for me to update the module myself? How would one do that?

wnMark

In beta 300008 I am missing the "Hamburger Symbol" if I am editing a PYUI File in the upper left corner!

JonB

@Skeo
install stash, then from stash, use

pip install dropbox
JonB

console.quickview does not seem to support all of the types supported by the editor's quickview button. For instance, using console.quickview with a pdf just shows the name of thr pdf in a window.

Latest beta seems to be missing the 2to3 conversions from the play menu. This was still really useful even with the two interpreters.

omz

@JonB

console.quickview does not seem to support all of the types supported by the editor's quickview button. For instance, using console.quickview with a pdf just shows the name of thr pdf in a window.

Are you sure that you passed an absolute path to console.quicklook()?

Latest beta seems to be missing the 2to3 conversions from the play menu. This was still really useful even with the two interpreters.

That's in the wrench menu (and I think it was always there, not completely sure).

Tizzy

@omz if it's not too much trouble could you add the toggle to disable file thumbnails like In Pythonista 2 into 3? ( long term would be great to specify to only have thumbnails for images and/or .pyui files)

omz

@Tizzy You can disable thumbnails in Pythonista 3 by tapping the "..." button in the library.

Webmaster4o

@omz Would it be possible to implement as-you-type linting? Atom-linter has this, and I really like it.

The way Atom's linter package does this is by allowing a user to specify how often to lint while typing, so that it won't re-lint after every character even you're typing fast (So if this value is 300ms, for example, Atom will lint when you type but only if it's been more than 300ms since the last lint). I think one second would be a good default value on Pythonista for this, because of slow processors.

If implemented in Pythonista, this would probably be a toggleable option.

What do you think? Would automatic as-you-type linting be practical in Pythonista?

omz

@Webmaster4o It's definitely possible, and I've actually experimented a bit in that direction.

I personally found it a bit annoying, and less useful than I originally thought. The problem is that I usually type more slowly on a touch screen than I would in a desktop IDE, and that often results in warnings and syntax errors that are essentially meaningless because I've just not finished typing yet...

That might also have to do with a lack of UI polish in my implementation of course (it was just a rough prototype), and I'll probably continue experimenting with this.

dgelessus

Agree with @omz regarding "real-time linting". It always feels unnecessary to me - when I'm typing in a line, it should not be checked, because obviously it's not complete yet. And even checking the line after moving the cursor can be too early, sometimes I change other code before I finish typing my current line, for example to add an import.

JonB

Speaking of.... it would be nice if the console auto-complete was in some sort of background thread, or is delayed/cancelled by typing. In the console, especially, on my Ipad3 things really slow to a crawl when dealing with complex objects. A classic case, requests response objects take 3 or 4 seconds after typing a period before i can keep typing.

Phuket2

@omz, maybe something has been mentioned along these lines before. But given you have now managed to get both versions of Python running in the same app, can understand it will be just a matter of time before the 2.xx app goes away. For good reason of course. But it also has some great testing potential/advantages.
Could you possibly release a server version of Pythonista that could still share the same sand box as you are doing now with the 2 versions? Extra income for you and an excellent testing Environment for us.The diff between the apps could be one integer somewhere.
Food for thought 😱

Skeo

@JonB I haven't been able to get stash to work. Fixed a bunch of python3 incompatibilities by running 2to3 over it, but I still can't get a functional command line from it.

JonB

For python3, you would start with the py3 branch of stash. Some things are still incompatible, such as the git command, whose dependencies are not py3 compatible.

I would suggest simply putting #!python2 at the start of launch_stash.py, to force stash to use the python2 interpreter. you can still keep your default interpreter as py3, but run stash using py2.

khilnani

@omz glad to hear the theme, line number and other features will make it over to 2 as well!!! That was half of my feature ask list :)

khilnani

@Oscar said:

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.

I agree. I think what this may translate into is that there are some people willing to pay more than what you charge. Since everyone appreciates the single price model and features being available to all, we want to find a way to invest in Pythonista - to show appreciation and support the pace at which you innovate and keep the app around for a long time!

I'm starting to write a lot of scripts for pythonista and soon it will be a cornerstone of my iPhone experience. I already use it as my mobile notepad, ios workflow automation, custom extensions that make using my phone wayyyyy more efficient and save me a lot of time - clicks/select/click/launch/app/click/paste etc. becomes share and click or just click homescreen shortcut.

Phuket2

Maybe it's been reported, a lot in this thread.
It appears that the editor is not showing the iter functions for dicts.
Eg, if I do kwargs. In the editor No iteritems is in the list.

dgelessus

If you're using Python 3 for your script, dicts have no iterwhatever and viewwhatever methods. The normal whatever methods now all return lightweight "views" like viewwhatever did in Python 2.

Phuket2

@dgelessus , ok thanks. My default interpreter is set to 2.7. But it explains what is happening. Guessing it's not the wanted behavior in this case

Skeo

@JonB It occurred to me I could run it in python2 now that the beta supports both. Then it occurred to me that I could run the old dropbox module using python2 (until dropbox deprecate it at least), so I tried that and got it working. Win. Thanks for your help.

btw, I tried pip install dropbox in stash under 2.7, but it didn't work. It seemed to complete the install, but I still got the same errors from the dropbox sync script (under 3.5), I'm guessing pythonista keeps seperate modules for the two versions or something? I'm not too fussed because I have a working solution now, but I figured it was worth mentioning.

JonB

yes.. python3 has a different site-packages. You can copy the folder in stash

ywangd

@JonB said:

I would suggest simply putting #!python2 at the start of launch_stash.py, to force stash to use the python2 interpreter. you can still keep your default interpreter as py3, but run stash using py2.

This is probably a much better solution than porting the whole thing to py3?

A follow-up question is : how can stash run a python script with the other Python interpreter (3.5) while stash itself is running in 2.7? Or vice versa, what if stash is running with Python 3.5 and the script has a python2 shebang?

Currently stash just uses the exec function to run a python script which does not seem to honour the shebang. I'd guess this is possible with objc_util, but I am not sure where to start. Any tips are appreciated.

Maybe @omz can provide a formal API to allow this kind of cross interpreter call?

JonB

The editor delegate (_editor_pythonista._get_editor_tab()) has a few new methods

void    runScriptAtPath_withInterpreterVersion_arguments_( object, int, object )
void    runScriptAtPath_withInterpreterVersion_scriptForShebang_arguments_( object, int, object, object )
void    runScriptWithNonDefaultPythonVersion(  )

i have used the last, which runs the current editor script in the other interpreter, but not been able to get the first two working. (Though I now think this maybe runs the current script with a different path, as opposed to running a different script)

I suspect exploring the wrench menu might yield some clues, but i have not done that yet.

There is also a PythonInterpreter ObjCClass('PythonInterpreter').sharedInterpreter() which looks promising, but i have not explored.

JonB

oh, i see,there is also a PA3PythonInterpreter which provides access to the p3 interpreter. I have not yet tried any of the runScript commands, I assume they take an NSURL.

>>> print_methods('PA3PythonInterpreter')
PA3PythonInterpreter
Class Methods______
object sharedInterpreter(  )
_______Instance Methods______
object  completionsForREPL_( object )
object  defaultPythonPath(  )
void    dispatchBlockOnInterpreterThread_( @? )
void    doDispatchBlockOnInterpreterThread_( @? )
void    doJediCompletion_( object )
object  documentsDirectory(  )
void    evaluateLineInteractively_( object )
object  filteredCompletions_withPrefix_( object, object )
object  init(  )
char    interpreterReady(  )
object  interpreterThread(  )
void    jediComplete_( object )
object  jediThread(  )
object  libPath(  )
void    pythonInterpreterTimerAction(  )
void    runLineWithOptions_( object )
void    runScriptWithFileAtPath_argv_( object, object )
void    runScriptWithOptions_( object )
char    running(  )
void    setInterpreterReady_( char )
void    setInterpreterThread_( object )
void    setJediThread_( object )
void    setRunning_( char )
void    setupInterpreterThreadRunLoop(  )
void    setupJediThreadRunLoop(  )
void    startInterpreter(  )
void    staticAnalysisForScript_completion_( object, @? )
void    stop(  )
omz

@JonB To be honest, I'm not sure if I really want to expose this functionality via Python. I can see a couple of things that could go wrong, e.g. the console's implementation of raw_input/input isn't really prepared for two interpreters running at the same time, and there are probably other issues that I'm not thinking of now.

You're right that PA3PythonInterpreter is the one responsible for running Python 3. PythonInterpreter has a slightly different interface (for "historical reasons") and is Python 2-only.

runScriptWithFileAtPath_argv_ is its primary method. The path should be a string, and the file should actually exist. argv can be nil/None, otherwise it's a list of strings (the script path is added to it implicitly). Most of the other stuff is internal, and shouldn't be called directly.

Edit: One more thing: You shouldn't try to instantiate any of the interpreter classes, they're essentially singletons, use sharedInterpreter() to get the global instance.

JonB

Right. The main use case I think would be for stash-- to allow keeping the main codebase written in py2 without having to port everything to six, which has been iffy. on launch we'd maybe launch a worker thread in the py3 interpteter, and then py2 stash could send commands to the py3 worker when encountering a py3 shebang.

Moe

One bug I noticed is that when you press Tab in the console it will be converted to soaces, regardless of the 'soft-tabs' option.

userista

Bug: when running a script via the url scheme (pythonista3://) it ignores the default interpreter setting and runs the script as 3.5. It also ignores the shebang - #!python2

Phuket2

@omz, sorry another question about colliding betas so to speak. I seen yesterday we got a new thing (well for me it was new, a renew on the 2.x beta for 7 days , instead of an update in TestFlight). Great idea btw. Not sure if that's a new thing apple opened up to you or if it's been there all the time.
But if at anytime the 2.x beta is expired or not, if I delete it and install the App Store version will it just take the place of the beta leaving all my files intact?
Just want to make sure what will happen

dgelessus

@Phuket2 If you delete the app (tap and hold, then tap the delete icon) then your files will be deleted. If you install the App Store version over the beta, the data will probably stay in place, I don't think there were any major changes to Pythonista's data structure in the beta.

Phuket2

@dgelessus , ok thanks for that. I would have done it the wrong way and lost my data 😱 I should know better, but it appears I don't. Thanks again, makes sense

mfkilgore

@omz - Just signed up for the beta, hope its not to late to test it out and provide feedback!

Webmaster4o

Hey, this topic just hit 20k views!

Skeo

Seem to me the split-screen toggle is broken in the beta.

I had a full screen console and I could swipe left and right between it and the editor, then I pushed the split screen button and now swiping left/right transitions between either the editor with the file browser on the left or the editor with the (narrow) console on the right. Problem is, the split screen button seems to have disappeared now and I can't for the life of me figure out how to get the full screen console back.

Just went and checked in version 2 and the toggle remains after switching to split-screen. In the beta it disappears and only the help button remains at the top left of the console pane.

JonB

@Skeo

see https://forum.omz-software.com/topic/2747/python-3-x-progress-update/289

from objc_util import ObjCClass
ObjCClass('NSUserDefaults').standardUserDefaults().setBool_forKey_(False, 'DockedAccessoriesPanel')

then restart the app

mfkilgore

Any idea when the next beta will be, or better yet a release?

Skeo

@JonB Thanks. I missed that post.

Webmaster4o

New beta literally fixes all the worst bugs, I'm so happy :D

  • Improved console prompt: the text input area now expands automatically for multi-line statements
  • Improved auto-indentation (also works when splitting a line now)

And also it also has most of my most-wanted editor features!

  • Some improvements for external keyboard users 😍
  • Experimental Today widget for running scripts in notification center
  • Code completions can now be suggested based on fuzzy-matching

Thanks a lot, @omz, this is great work πŸ‘

Tizzy

@omz Nice update! Excited to mess around with the today widget, and look forward to integration into the Xcode template.

Tizzy

Is there a way to print out how much memory your script is using?

Bo_Ty

@omz Will you use a bundle to give a discount to existing users? (A bundle including Pythonista 2 and 3 allows customers who purchased 2 at full price to subtract $10 from the bundle price.)

Ivoah

I just messed around with the new beta, and the today widget is great! I also love the new icon, I wasn't a fan of using the python logo, and really like that you switched back to the old style. As a quick test I changed the calculator example to run from the today widget and it worked fine, so that's nice :) one suggestion I have is the ability to remove the play button from the widget. It takes up the entire column, and makes the view not be centered.

Ivoah

@Tizzy said:

Is there a way to print out how much memory your script is using?

You might want to take a look at the resource module

filippocld

I noticed that running a script after running it in the today widget gives the notimplementederror if the script has a non supported module (the interpreter thinks you are still in the widget)

omz

@filippocld I can't reproduce that, and I'm not even sure how that would be possible at all, given that the widget runs in an entirely different process. Do you have a short example perhaps? Maybe there's something wrong with the way I check if the widget is running in some cases, but not others...

filippocld

Maybe it is only the notification module...

omz

@filippocld I see... It actually looks like the notification module doesn't work at all in Python 2 mode (I assume that's what you've selected as the default interpreter). Thanks for noticing, I'll look into it.

Leva7

I noticed this in 09 but it still seems to stay in 10. When I type the first symbol in the console, the auto-complete window is shown with a little offset, that makes some letters unreadable. However, when I type the next symbol, everything's fine. I'm using an iPod 5 with iOS 8.4. Here is the screenshot of the issue.

omz

@Leva7 Thanks, I have to admit that I didn't really test this on a 4 inch device so far, but I can reproduce the problem here.

Leva7

@omz Also, I'd love if you would synchronize the sound of the buttons above the keyboard with the system settings or add a switch to turn it off. It's very odd and a little annoying when the system keyboard is silent but the extra buttons are "ticking".

omz

@Leva7 I'll add a setting for that. It's unfortunately not possible to use the system setting.

davidskeck

Still accepting new beta testers? I've applied but not yet been accepted. Excited to try this! I've been wanting 3 forever 😊

Webmaster4o

@davidskeck said:

Still accepting new beta testers? I've applied but not yet been accepted. Excited to try this! I've been wanting 3 forever 😊

so has my friend. Normally new ones are sent out at every new beta release, but he hasn't gotten it in the last two releases.

omz

@Webmaster4o I've actually checked the signups an hour ago or so, and I've added everyone on the list (I've also added about 100 people yesterday). Could you ask your friend to check his spam folder or send me his email address privately, so I can check if he's on the list?

Webmaster4o

No, he hasn't got it. I'll have him resubmit.

jmas

@omz I also applied for beta testing some days ago using Google Forms, but neither have I received an invitation. I have just re-applied.

We use Python 3 as main programming language for our EE, math and physics grades (since 2010) so I have a high interest in the new Pythonista with Python 3.x support.

davidskeck

Just wanted to chime in and say thanks! Just got the beta and it's great! I've been wanting this ever since I learned Python could be interpreted on iOS, and this is a lovely implementation of it.

omz

@Webmaster4o @jmas I've just sent invites to these email addresses (I've obfuscated them, but I hope you're able to tell if yours is on the list):

niβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆes@gmaill.com
pβ–ˆ.tβ–ˆ.gβ–ˆ@gmaill.com
jβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆe@gmaill.com
jβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆa.aβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆe@eβ–ˆu.es
bβ–ˆβ–ˆβ–ˆn.hβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆn@uβ–ˆβ–ˆc.uβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆo.ca
bβ–ˆy@eβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆo.com

deloz

Hi omz,
same issue here: Applied for the beta a few days ago, but I'm not on the list (nor did I receive a testflight invitation).
Unlucky me :/

jmas

@omz Invitation received, thanks!

Webmaster4o

@omz I believe his is the second one. I'll ask if he got it.

MartinPacker

@omz really 2 ll's in "gmaill" ?

Webmaster4o

@MartinPacker No, I think that's a mistake.

Leva7

@omz By the way, how about that keyboard dismiss? The way it is now is not so convenient since it actually makes you scroll the code and lose the position. A button or something like that would be great :) Is that a possibility or you've completely switched to swiping down?

omz

@Leva7 I think I'll keep it the way it is. It's pretty difficult to find a place for a "dismiss keyboard" button on such a small screen.

zielperson

@omz

I just registered here after seeing this thread.
I am a new python programmer and am - right now - shunning 2.7 as I am starting to learn python on 3.x

This is the best news ever and I am anciously awaiting the full release.

Best,
zielperson

dgelessus

@omz A few suggestions regarding the new autocomplete feature:

  • When the user has fully typed a suggestion out by hand, then make Enter behave like normal and insert a newline. The current behavior can be a little surprising, for example when typing return self you need to hit Enter twice to insert a newline - first to accept the suggestion, then for the newline. Same goes for typing a bare variable name in the interactive prompt to display it.
  • Related to the previous suggestion - when there is only one suggestion and that has been fully typed out, hide the suggestion popup entirely.
  • Allow dismissing the suggestion popup with Escape on an external keyboard.
  • Please take the caps of what the user typed in account when showing suggestions. When I write typ, I probably want type, and when I write Typ, I probably want TypeError.
Webmaster4o

Also, how hard would it be to check for a @property decorator in the autocomplete and then not put in parentheses?

dgelessus

Any decorator really should not have parentheses added automatically. Some decorators allow arguments using closures, but there are many that do not take arguments and do not even allow empty parens. This includes most built-in decorators, like property, classmethod and staticmethod.

Speaking of parens - when editing an already typed line, the autocompletion often inserts extra parens before an existing function call. For example, say I have this line of code:

mylist.append("foo")

Then I decide I want to use insert instead. I double-tap append, type ins, and hit Enter to accept the suggestion. The output I get is

mylist.insert()("foo")

In this case I would expect it to detect the existing parens and not add extra ones.

JonB

I will admit I didn't like the insensitive matching originally, but zi do find it useful in objc... though I agree the typed case should be given priority to other matches.
Also, i think attributes starting with underscores should have lower priority (unless user starts typing an underscore). Pretty much every object has a dozen magic double underscore attributes which are rarely needed -- put _ and __ at the end of the non-matching list.

JonB

Idea: add "show docstring", or else when using help on a non builtin, show the docstring. It might also be neat to show a "ghost" of the signature when typing a method to remind one of the arguments and ordering.

Webmaster4o

@JonB Both awesome ideas.

dgelessus

@omz objc_util.on_main_thread still doesn't use functools.wraps to copy docstrings and such:

>>> help(notification.schedule)
Help on function new_func in module objc_util:

new_func(*args, **kwargs)

Out[0] = None
>>> help(notification.schedule.__closure__[0].cell_contents)
Help on function schedule in module notification:

schedule(message, delay=0, sound_name=None, action_url=None)
    Note: Sounds from the 'digital' and 'game' collections ate supported

Out[1] = None

Also, "ate supported". ;)

Phuket2

@omz is there a way to kill rogue scripts that call ui.Delay for example. In py2 you could keep hitting the close button until,it finally stopped. This seems not to work now. I have to force quit and restart py3. Maybe there is a new way I don't know about

JonB

If you are still,able to type in the console, ui.cancel_all_delays might work. Alternatively, deleting a module that the function depends on is a sure way to induce an Exception that stops it. e.g
del sys.modules ['ui']

Phuket2

@JonB l well I got around it by just making sure it didn't go rogue 😜
But honestly, I can force quit Pythonista and restart it quicker than I can type cmds into the console. My iPad Pro is lighting fast, also helps with the animations turned off globally

JonB

you could always create an editor action script that cancels all delays!

pvanallen

@ywangd Is the Stash branch py3 still recommended, or is the master release now working well in pythonista 3 using #!python2?

JonB

@pvanallen i have not gotten around to porting git to handle py3. Also, I don't think there are any py3 only commands -- So #!python2 is currently the best option, unless you want you use the python command to run py3 scripts.

farscapeone

Hi. Is it possible to get onto the beta list ? I have just bought 2.0 and am loving it. I would love to have the Python 3.x version as my 10 year old son is learning Python ATM and the book he is using needs Python 3.x. Please help :)

omz

@farscapeone You can use this form to sign up (it might take a couple of days until you actually get an invite, I'm not checking the responses all the time): https://docs.google.com/forms/d/10qRhNIvk7WzcR5_DsQSRNIqLkIqeTYYafbPi9bjj_cw/viewform

zielperson

I'd rather like an ETA, to be honest.

Any idea?

::z::

pvanallen

@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!

lukaskollmer

@omz you could use boarding to automate inviting new beta testers.

Example:
https://tf-boarding-grades-ios.herokuapp.com/

JonB

@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']

before


['/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']
farscapeone

@omz Thanks - I have just done that

pvanallen

@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.

dgelessus

@pvanallen You're not the only one, someone else has posted this elsewhere as well, probably in the Slack chat.

omz

@farscapeone Thanks, I'll look into it.

JonB

1) 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)

2) 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)

m16bishop

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.

Thank you!!

oflebbe

I found now way to rename a python file or to duplicate it in the script editor (beta pythonista)

Move, export, create do work.

oflebbe

@omz: Any chance to compile pythonista 2.0 with ipv6 support? AFAIK this should be no major problem.

mfkilgore

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 :)

Thanks

ccc

@mfkilgore https://forum.omz-software.com/topic/1848/working-copy-integration-sidebar

mfkilgore

@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.

mrcoxall

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.

ccc

See https://forum.omz-software.com/topic/2712/bug-missing-feature-pythonista-is-missing-from-airdrop/2 and rule 2.7 of https://developer.apple.com/app-store/review/guidelines/#functionality

Webmaster4o

@ccc Did that section of developer.apple.com just get a redesign? It looks nice.

oboudou_

@omz

Hi omz,
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 ?

oboudou@gmail.com

wreichard

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).

GxAl2aa

@omz said:

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 (ui, scene, contacts, reminders, ...)

Not working yet:
* A few custom modules (currently only notification, editor, and canvas)
* 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
* ```

  • list item
    ```
    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).