Skip to content

Pyto

Pyto is an open source app to code and run Python code locally on an iPad or iPhone. Protocol Launcher allows you to generate deep links to run Python code in Pyto using x-callback URLs.

Usage

There are two ways to use this library:

  • On-Demand import from subpaths enables tree-shaking and keeps bundles small.
  • Full Import from the root package is convenient but includes all app modules.

Pick On-Demand for production builds; Full Import is fine for quick scripts or demos.

Select Installation Method

On-Demand
Recommended. Optimized for production.
Full Import
Convenient. Good for quick scripts.

Open App

On-Demand
ts
import { open } from 'protocol-launcher/pyto'

const url = open()

Run Code

On-Demand
ts
import { runCode } from 'protocol-launcher/pyto'

const url = runCode({
  code: 'import sys; print(sys.version)',
})

Run Code with Callback

On-Demand
ts
import { runCode } from 'protocol-launcher/pyto'

const url = runCode({
  code: 'import sys; print(sys.version)',
  xSuccess: 'shortcuts://run-shortcut?name=HandleResult',
})