Create Siri Shortcuts with Python
Clone or download

WIP: python-shortcuts

Build Status PyPI

🍏 + 🐍 = ❀️

python-shortcuts is a library to create Siri Shortcuts on your laptop with your favourite text editor. It uses toml to represent shortcuts.

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

Supported Python version: >=3.6.


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

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

type = "ask"
question = "What is your name?"

type = "set_variable"
name = "name"

type = "show_result"
text = "Hello, {{name}}!"

Or the same with Python:

from shortcuts import Shortcut, actions

sc = Shortcut()

sc.actions = [
    actions.AskAction(data={'question': 'What is your name?'}),
    actions.SetVariableAction(data={'name': 'name'}),
    actions.ShowResultAction(data={'text': 'Hello, {{name}}!'})

How to use


pip install 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 shortcut file to toml:

shortcuts what_is_your_name.shortcut what_is_your_name.toml

toml β†’ shortcut

Convert a toml file to a shortcut file. After you will need to open the file with iOS Shortcuts app.

shortcuts examples/what_is_your_name.toml what_is_your_name.shortcut

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

URL β†’ [toml|shortcut]

Also, you can download shortcut directly from iCloud. If somebody shared shortcut link with you, just run:

shortcuts my_shortcut.toml  # or my_shortcut.shortcut

And it will download this shortcut and save it in toml or shortcut format.



Run tests:


How to add a new action

See documentation.


  • β˜‘ 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.
  • ☐ Import questions
  • ☐ Document all actions
  • ☐ Support magic variables
  • ☐ Support all current actions from Shortcuts app