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 thanks for the update!
Pythonista has been unbelievably helpful at my work, and continues to impress every day.
-
@omz, my sincere thanks to you, as well.
Pythonista and this incredible community have enabled me to keep up and develop my Python knowledge, squeezed in between a non-coding job and a busy family life.
I am not exaggerating when I say that that was the primary thing that enabled me to get a new job, starting a new career next month as a full-time senior Python developer.
-
Happy to see you @omz and the update!
-
@omz Glad to see you in the forums again :)
BTW, in the current beta, the
keyboard.set_view()
method still has TODO (also document custom view callbacks like kb_should_insert) as the documentation.
-
@bennr01 said:
BTW, in the current beta, the
keyboard.set_view()
method still has TODO (also document custom view callbacks like kb_should_insert) as the documentation.Oops, thanks!
-
@mikael said:
I am not exaggerating when I say that that was the primary thing that enabled me to get a new job, starting a new career next month as a full-time senior Python developer.
That's amazing, congrats! :)
-
Dear @omz,
Welcome back! The fact that this forum has continued to be a lively place where regular members help others with their questions and regularly offer their code snippets as solutions to problems is a measure of the love and enthusiasm folks have for pythonista.
That too is amazing!
-
@Blanchot So true.
@mikael your new job colleagues will be very happy as they get a high skilled and very talented work mate with you!!! Wish you a happy time on your new journey.
-
With the latest Pythonista Beta v. 3.3 (330025), installed today, i.e. 20 Feb., 2020, I get the same crash in my App I got with the last Beta.
I tracked it down to the very first line of code that executes in my App! I commented out that line, and my App runs successfully.
That line is:
A great many lines of code are omitted both before and after the code snippet shown.
# Prevent iPhone from going to sleep while this program runs. console.set_idle_timer_disabled(True) # Create an instance of a class that derives from ui.View. # <code-omitted>
If I comment out that one line of code, the program does not crash.
I am running that on an iPhone 6s running IOS 13.3.1
-
@technoway said:
With the latest Pythonista Beta v. 3.3 (330025), installed today, i.e. 20 Feb., 2020, I get the same crash in my App I got with the last Beta.
I tracked it down to the very first line of code that executes in my App! I commented out that line, and my App runs successfully.
That line is:
A great many lines of code are omitted both before and after the code snippet shown.
# Prevent iPhone from going to sleep while this program runs. console.set_idle_timer_disabled(True) # Create an instance of a class that derives from ui.View. # <code-omitted>
If I comment out that one line of code, the program does not crash.
I am running that on an iPhone 6s running IOS 13.3.1
I'm having exactly same issue since updating to 3.3 earlier today. Commenting out the "console.set_idle_timer_disabled(True)" helps. iPhone 8 and 13.3.1. Phone reboot not help.
Thanks 👍
-
Sorry about the issue with
console.set_idle_timer_disabled
. Please use this workaround for now:import console def fix_set_idle_timer_disabled(flag=True): from objc_util import on_main_thread on_main_thread(console.set_idle_timer_disabled)(flag)
-
@omz - Thank you for the workaround.
You do not have to apologize for anything.
Pythonista would have to have many, many, more bugs before it would stop being my favorite App. Thanks for making Python programming available on IOS.
-
@omz do you have a new link for the beta signup? 😊 thank you!
-
@mikael @omz Pythonista played an important role in my career as well. When I was interviewing for my last job they set a programming task to write a custom compression tool for specifically formatted data. I wrote it in Pythonista, mostly on the train on my commute. It was fun, I used a combination of techniques for different fields, including variable length encoding for numeric fields that took a fair amount of bit twiddling. I was able to actually demo it to them in my face to face interview on my iPad. It blew them away, they had no idea you could do something like that on an iPad.