New Beta for Pythonista 3.3
-
There's now a public beta for the upcoming Pythonista 3.3. If you signed up for a Pythonista 3 beta previously, you should have received a notification from TestFlight. If you're not a beta tester yet, but would be interested in testing, you can just use this link to sign up (I no longer need to collect your email address for this):
https://testflight.apple.com/join/qDkBu2ur
It's a beta, and I wanted to have it out before the holidays, so some things aren't quite done yet, others aren't polished yet, but it should overall be quite usable and not worse than the App Store version in any significant way. If you're new to this: If you install the beta, it replaces the App Store version on your device, but you won't lose data. It works like a regular App Store update in that regard.
I'm really curious what you'll create with the custom keyboard extension!
Full release notes below:
New Features
-
New scriptable keyboard extension and associated
keyboard
module:- First off, this is not intended to replace the system keyboard or your preferred third-party keyboard for most of your typing. It's much more like the emoji picker, i.e. you'd typically switch to it just for specific tasks. The keyboard does not support any kind of AutoCorrect or QuickType suggestions. Just switch to the system keyboard if you need those (hold the 'globe' key).
- You can enable the keyboard in the Settings app (General > Keyboard > Keyboards > Add New Keyboard). It already includes various script shortcuts from the examples folder that you can try right away. If you want to add your own scripts, use the new "Shortcuts..." option from the 'wrench' menu.
- You can use the keyboard for simple things, like quickly inserting the current date/time in your favorite format, or even show a custom UI, like a calculator, in the keyboard view (or above a standard QWERTY keyboard). Have a look at the included examples to get an idea of what's possible.
- The
keyboard
module includes keyboard-specific functionality for inserting text, modifying the cursor position, showing user interfaces in the keyboard, and more. - Generally, the Pythonista keyboard does not require that you enable 'Full Access', but you can't use some functionality in your scripts then (e.g. clipboard or network access).
- Note: If you have a hardware keyboard connected to your iPad, and the Pythonista keyboard does not show up on screen when you select it, please tap and hold the
˅
button in the bottom-right corner of the screen. This should normally not happen when you set the Pythonista keyboard's primary language to 'Emoji'.
-
Support for Siri & Search shortcuts:
- This allows you to integrate Python scripts in various places on iOS. You can invoke shortcuts using Siri with custom voice commands, run them from Spotlight Search, or add them to larger automation workflows in the iOS 12 Shortcuts app.
- Please note that "background" shortcuts (i.e. those that don't launch the Pythonista app) have very limited resources (RAM) available to them, so you're somewhat limited in what you can do without launching the full app. Also, you cannot implement any interaction within Siri, except for reacting to a tap on the Siri result.
- The
shortcuts
module provides useful utilities for shortcut scripts, but you can also just use theprint
function and e.g.ui.Image.show
to produce simple output, as you would in a script that runs in the app.
-
Improved and unified UI for creating shortcuts and Pythonista URLs -- This allows you to create script shortcuts for Siri & Search, the new Pythonista keyboard, the share sheet extension, editor actions, and home screen icons, all from one place: The new "Shortcuts..." option in the 'wrench' menu. This also contains a new Pythonista URL generator for creating various kinds of
pythonista3://...
URLs more easily. -
Revamped
notification
module with support for custom actions (buttons), location-based and repeating notifications, and more. The module also works in Pythonista's app extensions now (it was previously main app only). -
The console's history is now persistent (i.e. saved when you quit the app). You can also delete the console history by tapping and holding the '^' button now.
-
Scripts stored in iCloud are now compatible with the built-in "Run Script" and "Edit Script" actions of the (Apple) Shortcuts app. Just prefix the script name/path with "iCloud/", e.g. use "iCloud/MyScript.py" (without quotes).
Built-in Modules
-
Added
location.render_map_snapshot
function to thelocation
module for generating map images (using Apple Maps data). -
Improved
photos.capture_image
function with the option to use the selfie camera by default. -
Added
cb.Peripheral.manufacturer_data
incb
(CoreBluetooth) module. -
Added
ui.Label.scales_font
andui.Label.min_font_scale
attributes toui.Label
. -
Added
reminders.Reminder.priority
andreminders.Reminder.url
attributes in thereminders
module. -
Changed the default file type for
dialogs.pick_document
to'public.item'
(instead of'public.data'
, this works better for unknown file types). -
Added (third-party)
emoji
module. -
Added documentation for
ui.TextField.begin_editing
,ui.TextField.end_editing
, andui.TextField.secure
.
Bugfixes
-
Fixed a crash when saving images from the console when access to the photo library has not been granted yet.
-
Fixed an issue with the extra key row hiding console input on 2018 iPad Pros.
-
Fixed a crash when using arrow keys on an external keyboard while the on-screen keyboard is visible.
-
Fixed problems with using iCloud scripts in the share sheet extension.
-
Fixed triple-quoted byte strings and f-strings not being syntax-highlighted correctly.
-
Fixed 'wrench' actions not being saved when invoked from the script library.
-
Fixed broken
turtle.pen
function.
Miscellaneous
- Selecting Python 2.7 as the default interpreter shows an "end of life" warning now (Python 2.7 will cease to be officially supported by the Python Software Foundation in 2020).
Have fun testing!
-
-
@omz - is there any way I can contribute or help?
ie updating modules etc?
I've been playing with some OSS python stuff on iOS here just to figure it all out.
I really don't care to get paid or that Pythonista is a commercial app, it's about the community.
Outside of testing the beta, of course!
-
@omz If I correctly understand, the new beta version allows to run a Pythonista script, in background (without starting the full app), when it is launched,
either via a notification
either via a siri shortcut
Could it be possible to launch such a script by a home screen icon?
-
@mikael I try in the shortcuts app “pythonista3://“ and it works well, it open the app, do you have installed Pythonista2?, can be that a reason for the error? I only have installed pythonista3 beta. In the shortcuts apps I use some kind of url wrapper and a url opener so the complete shortcut open itself Pythonista 3
-
@omz
iPhone XS Max Pythonista keyboard never appears.Hi @omz about two days I upgrade my phone 6 to the xs max. In my iPhone 6 I have the actual beta of Pythonista and the keyboard words well, it appears and it let me ran my scripts, but now in the xs max the keyboard never appears or it appears but it looks like the standard iPhone keyboard and don’t show me any of the shortcuts, I have it enabled and I also try use it with the allow full access functionality but nothing.
The specifications
-iPhone XS Max 256gb
-iOS 12.1.2
-Pythonista 3.3 (330005) beta
-PyKeys enabled
-Full acces enabled (I turn it on to see if them works)
-I also restart my device two times
-
@omz If a Pythonista script is launched by Siri as background, it is executed even if Pythonista app is not in the apps list, but when the same script is launched by a notification, with foreground=False, it is only executed when I start Pythonista...
Is this difference normal?
-
@cvp said:
Could it be possible to launch such a script by a home screen icon?
That's not possible, I'm afraid. Home screen icons always launch the full app.
@sulcud said:
iPhone XS Max Pythonista keyboard never appears.
That's weird, did you do a fresh install of the Pythonista beta on the XS Max, or did you restore a backup? Have you tried disabling the 'PyKeys' keyboard, and then enabling it again? Sorry, I don't have a good explanation right now.
-
@omz I install Pythonista 3 from the backup them I install the beta, I try enabling and disabling pykeys
-
@omz i solve it, i re install the app them i open it and them a install the beta
-
last edited by
-
@omz is there a shorctus module documentation? I dir'ed it and found what I was looking for, but documentation could have helped.
-
last edited by
-
@cvp said:
Oh... on iPhone it's not very intuitive to find... :( Thanks though.
-
@sashk In general, you tap on the
(?)
button in the console, or on the "Documentation" button in new tabs to get to the documentation. You can then search forshortcuts
(or other module names) there.
-
@sashk said:
@lpl said:
@sashk And python 2.7.15
Nope, Python 2 is dead. Use Python 3 instead.
Specifically, 2.7 will receive bugfix support until January 1, 2020. Not yet, not now.
-
@omz Would it be possible to add some basic Apple Watch support because Apple removed the Shortcuts app on the watch so there's currently no easy way to do some basic programmable stuff on the watch without Siri interaction, at least that I am aware off.
For example I have a shortcut which gets a json via a secret https url and formats the output nicely or another one which triggers same IoT actions.
It would be nice to do this with Pythonista.
General question: Does the TestFlight Beta override the installed app or is this separated?
-
Some Apple Watch support would be a great addition and (as has been said) would help fill the void that Apple created when they replaced Workflow with Shortcuts.
-
@ttobias said:
General question: Does the TestFlight Beta override the installed app or is this separated?
The beta replaces the App Store version. If you already have the App Store version installed and then install the beta through TestFlight, you'll get a warning message saying that you may lose your data - this is generally not the case for Pythonista. (I've been in the Pythonista TestFlight beta since the beginning, and installing a beta has never overwritten my data. But if possible you should make an iTunes backup beforehand, just in case.)
You can also go back to the latest App Store release at any time, by going into your purchases and redownloading Pythonista there. This will replace the beta version, but also leaves your data intact (except perhaps for features that were introduced in the beta).
-
Just to say: the new keyboard is opening up some really exciting possibilities, and aside from everything else that Pythonista offers, this is the kind of functionality I've been wishing for on the iPad for a long time now. I've tried a number of third party keyboards to do more with text in iOS and the vast majority of them have proven disappointing, but this... there's more possible than all of those others put together. Happy days ahead. Hats off to OMZ.
-
New BETA crashes when I use the new introduced key_command feature
Pythonista completely exists when pressing the a key on the external BT keyboard
# coding: utf-8 import ui import console class UIView (ui.View): def get_key_commands(self): print('get_key_commands') return [{'input': 'a'}] #return [{'input': 'a', 'modifiers':'cmd'}] def key_command(self,sender): print('key_command='+str(sender)) def main(): main_view = UIView(frame=(0, 0, 400, 400)) main_view.name = 'Key Commands Demo' main_view.present('sheet') if __name__ == '__main__': main()
-
@mithrendal I see thanks. I'll look into it tomorrow, but I think you might be able to move the
main_view
creation into the global scope (i.e. out of themain
function) to make it work, but it's getting pretty late here, and my iPad is busy, so I can't really test this theory right now. I definitely had a working example (just not very pretty) when I posted the last beta.