Python library to create Siri Shortcuts

  • 时间: 2018-09-24 05:43:39

WIP: python-shortcuts

:green_apple:+ :snake:= :heart:

python-shortcutsis a library to create Siri Shortcutson your laptop with your favourite text editor.It uses tomlto represent shortcuts.

The library is in a very early development state (PR welcome!), so it does not support all actions from Shortcuts app.


I wanted to convert my shortcut to a file in human-readable format. :)

From the code below this library can create a working shortcut:

[[action]]type = "ask"question = "What is your name?"[[action]]type = "set_variable"name = "name"[[action]]type = "show_result"text = "Hello, {{name}}!"

How to use


This library requires plutiltool, which should be installed on MacOS by default.On Linux, you should be able to use plistutilinstead.


pip install python-shortcuts


shortcut → toml

If you need to convert existing shortcut to a toml file, at first you need to export it.Go into Shortcuts app, open the shortcut and share it. Choose "Share as file" and use this file with this library.

Convert tomlfile with shortcut description to a real shortcut file.After you need to open the file with iOS Shortcuts app.

shortcuts what_is_your_name.shortcut what_is_your_name.toml

toml → shortcut

Also, you can convert shortcut file to a toml:

shortcuts examples/what_is_your_name.toml what_is_your_name.shortcut

More examples of tomlfiles you can find here.And read the tutorial! :)



Run tests:



  • ☐ Conditionals with auto-group_id: if-else, menu
  • ☐ Nested fields: dict/array/etc
  • ☐ Support variables in every field which support them in Shortcuts app
  • ☐ Workflow types: widget, etc.
  • ☐ Describe all actions
  • ☐ Support magic variables
  • ☐ Support all current actions from Shortcuts app