Skip to main content
Big news! Interval has been acquired by Meter. Learn more →

‹ All posts

🐍 The Interval Python SDK is now in beta

We're excited to announce the release of our Python SDK! Starting today, Python developers can experience Interval's code-first approach to building internal tools that lets developers generate web UIs straight from their business logic without writing any frontend code.

Start building with Python

Interval is a thoughtful, intuitive approach to quickly building powerful UIs that integrate seamlessly with your backend—no API endpoints, drag-and-drop, or frontend code required.

If you’re just hearing about us for the first time, Interval is the frontendless framework for high growth companies. Interval automatically generates apps by inlining the UI in your backend code and using language-native features like await to request user input from within your business logic. Instead of building apps in a drag-and-drop editor and accessing internal methods via API calls, you can simply import internal code right inside your scripts, without leaving your IDE. It's a faster and more maintainable way to build internal tools, rapid prototypes, and more.

Interval launched a little under one year ago with our JavaScript and TypeScript SDK. In that time we've seen great traction in the JS community and have helped developers at dozens of companies like Height, Hyper, and Vendr rapidly scale up internal tools in a fraction of the time it would have taken otherwise. As a team, we’ve worked with Python in the past and love the language and community, so it was a no brainer to release it next.

Python is especially exciting for us as it opens Interval up to a thriving ecosystem of data science and machine learning libraries. With this release, developers can now integrate existing models or data pipelines into Interval tools, complete with scalable and responsive web UIs. To show this in action, we've built a simple tool to easily transcribe audio files using OpenAI’s Whisper speech recognition model. Check it out along with other pre-built apps in our example gallery.

We're excited to open up Interval to a brand new set of developers and can't wait to see what you build with our Python SDK. If there are other languages you’d like to see SDKs for, let us know. We’re always looking for feedback and suggestions to improve Interval.

💻 Try the SDK

To demo the Python SDK, we'll build a minimal app that asks for your name and says hello. If you want to code along, sign up for an account.

First install Interval using pip, (or your python package manager of choice):

pip install interval-sdk
info

The completed code for this tutorial is available here.

You can alternatively run the following with npm or yarn to download a working example repo in Python:

npx create-interval-app --template=basic --language=python

Next we'll create a main.py script where we'll import interval_sdk and define our first action. To instantiate the Interval class, you’ll need an API key which you can grab in the Interval dashboard.

main.py
from interval_sdk import Interval, IO

interval = Interval(api_key="<YOUR API KEY HERE>")

@interval.action
async def hello_world(io: IO):
name = await io.input.text("Enter your name")
return f"Hello, {name}!"

As you might have inferred from the code above, Interval actions are defined as async coroutines with unique slugs. Importantly, the primary source of truth for actions is the code you write. We can now see our resulting app by running:

python main.py

You should see a message like this in your terminal:

[Interval]  🔗 Connected! Access your actions at: https://interval.com/<your_org>/develop

If you visit this URL, you'll see something like this:

interval.com

Those are the basics. Easy! Keep reading if you’re ready to learn more, or for a complete guide for getting up and running with Interval, check out our Getting started tutorial.

Explore the full SDK

The Python SDK includes all of the same IO and context methods as our JavaScript and TypeScript SDKs. You can check them all out here.

Some of our most powerful and popular methods include:

io.input.file

file = await io.input.file("Upload a profile photo",
help_text="Select an image.",
allowed_extensions=[".jpg", ".jpeg", ".png"],
)
interval.com

io.input.datetime

datetime = await io.input.datetime("Date & time")
interval.com

io.select.table

albums = await io.select.table(
"Select your favorites",
data=[
{
"album": "Exile on Main Street",
"artist": "The Rolling Stones",
"year": 1972,
},
{
"artist": "Michael Jackson",
"album": "Thriller",
"year": 1982,
},
{
"album": "Enter the Wu-Tang (36 Chambers)",
"artist": "Wu-Tang Clan",
"year": 1993,
},
],
)
interval.com

io.confirm

should_delete = await io.confirm("Delete this user account?",
help_text="All of their data will be deleted immediately.",
)
interval.com

io.display.video

await io.display.video("A video",
url="http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4",
size="medium",
muted=True,
)
interval.com

ctx.notify

await ctx.notify(
message="A charge of $500 was refunded",
title="Refund over threshold",
delivery=[
{
"to": "#interval-notifications",
"method": "SLACK",
},
{
"to": "foo@example.com",
},
],
)

Browse the full SDK and Interval’s library of examples to keep exploring.

If you build something cool with our Python SDK, we’d love to see! Please share with us via email or on twitter.

Join our mailing list

Get 1-2 emails per month with a roundup of product updates, SDK releases, and more.

548 Market St PMB 31323
San Francisco, CA 94104

© 2023

Join our mailing list

Get 1-2 emails per month with a roundup of product updates, SDK releases, and more.