Package: interval-sdk
Interval Python SDKIntervallets you quickly build internal web apps (think: customer support tools, admin panels, etc.) just by writing backend Python code.This is our Python SDK which connects to the interval.com web app. If you don't have an Interval account, you cancreate one here. All core features are free to use.Why choose Interval?"Python code > no-code"Interval is an alternative to no-code/low-code UI builders. Modern frontend development is inherently complicated, and teams rightfully want to spend minimal engineering resources on internal dashboards. No-code tools attempt to solve this problem by allowing you to build UIs in a web browser without writing any frontend code.We don't think this is the right solution.Building UIs for mission-critical tools in your web browser— often by non-technical teammates, outside of your codebase, without versioning or code review —is an anti-pattern.Apps built in this manner are brittle and break in unexpected ways.With Interval,all of the code for generating your web UIs lives within your app's codebase.Tools built with Interval (we call theseactions) are just asynchronous functions that run in your backend. Because these are plain old functions, you can access the complete power of your Python app. You can loop, conditionally branch, access shared functions, and so on. When you need to request input or display output,awaitany of ourI/O methodsto present a form to the user and your script will pause execution until input is received.Here's a simple app with a single "Hello, world" action:frominterval_sdkimportInterval,IO# Initialize Intervalinterval=Interval(api_key="<YOUR API KEY>")@interval.actionasyncdefhello_world(io:IO):name=awaitio.input.text("Your name")returnf"Hello,{name}"# Synchronously listen, blocking foreverinterval.listen()To not block, interval can also be run asynchronously usinginterval.listen_async(). You must provide your own event loop.The task will complete as soon as connection to Interval completes, so you
likely want to run forever or run alongside another permanent task.importasyncio,signalloop=asyncio.get_event_loop()task=loop.create_task(interval.listen_async())defhandle_done(task:asyncio.Task[None]):try:task.result()except:loop.stop()task.add_done_callback(handle_done)forsigin{signal.SIGINT,signal.SIGTERM}:loop.add_signal_handler(sig,loop.stop)loop.run_forever()Interval:Makes creating full-stack apps as easy as writing CLI scripts.Can scale from a handful of scripts to robust multi-user dashboards.Lets you build faster than no-code, without leaving your codebase & IDE.With Interval, you do not need to:Write REST or GraphQL API endpoints to connect internal functionality to no-code tools.Give Interval write access to your database (or give usanyof your credentials, for that matter).Build web UIs with a drag-and-drop interface.More about Interval📖Documentation🌐Interval website💬Discord community📰Product updatesContributingThis project usesPoetryfor dependency
managementpoetry installto install dependenciespoetry shellto activate the virtual environmentTasks are configured usingpoethepoet(installed as a dev dependency).poe demo [demo_name]to run a demo (basicby default ifdemo_nameomitted)poe testto runpytest(can also runpytestdirectly in virtual env)Code is formatted usingBlack. Please configure
your editor to format on save using Black, or runpoe formatto format the
code before committing changes.TestsNote:Tests currently require a local instance of the Interval backend.Tests usepytestandplaywright.Currently assumes thetest-runner@interval.comuser exists already.
Runyarn testin thewebdirectory at least once to create it before
running these.