interval-sdk


Nameinterval-sdk JSON
Version 1.5.1 PyPI version JSON
download
home_pagehttps://interval.com
SummaryThe frontendless framework for high growth companies. Interval automatically generates apps by inlining the UI in your backend code. It's a faster and more maintainable way to build internal tools, rapid prototypes, and more.
upload_time2023-09-18 20:48:06
maintainerJacob Mischka
docs_urlNone
authorJacob Mischka
requires_python>=3.9,<4.0
license
keywords internal tool app ui ui builder
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <a href="https://interval.com">
  <img alt="Interval" width="100" height="100" style="border-radius: 6px;" src="https://interval.com/img/readme-assets/interval-avatar.png">
</a>

# Interval Python SDK

[![pypi version](https://img.shields.io/pypi/v/interval-sdk?style=flat)](https://pypi.org/project/interval-sdk) [![Documentation](https://img.shields.io/badge/documentation-informational)](https://interval.com/docs) [![Twitter](https://img.shields.io/twitter/follow/useinterval.svg?color=%2338A1F3&label=twitter&style=flat)](https://twitter.com/useinterval) [![Discord](https://img.shields.io/badge/discord-join-blueviolet)](https://interval.com/discord)

[Interval](https://interval.com) lets 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 can [create one here](https://interval.com/signup). 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 these [actions](https://interval.com/docs/concepts/actions)) 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, `await` any of our [I/O methods](https://interval.com/docs/io-methods/) to 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:

```python
from interval_sdk import Interval, IO

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

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


# Synchronously listen, blocking forever
interval.listen()
```

To not block, interval can also be run asynchronously using
`interval.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.

```python
import asyncio, signal

loop = asyncio.get_event_loop()
task = loop.create_task(interval.listen_async())
def handle_done(task: asyncio.Task[None]):
    try:
        task.result()
    except:
        loop.stop()

task.add_done_callback(handle_done)
for sig in {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 us _any_ of your credentials, for that matter).
- Build web UIs with a drag-and-drop interface.

## More about Interval

- 📖 [Documentation](https://interval.com/docs)
- 🌐 [Interval website](https://interval.com)
- 💬 [Discord community](https://interval.com/discord)
- 📰 [Product updates](https://interval.com/blog)

## Contributing

This project uses [Poetry](https://python-poetry.org/) for dependency
management

1. `poetry install` to install dependencies
2. `poetry shell` to activate the virtual environment

Tasks are configured using [poethepoet](https://github.com/nat-n/poethepoet)
(installed as a dev dependency).

- `poe demo [demo_name]` to run a demo (`basic` by default if `demo_name` omitted)
- `poe test` to run `pytest` (can also run `pytest` directly in virtual env)

Code is formatted using [Black](https://github.com/psf/black). Please configure
your editor to format on save using Black, or run `poe format` to format the
code before committing changes.

## Tests

*Note:* Tests currently require a local instance of the Interval backend.

Tests use [pytest](https://docs.pytest.org/en/7.1.x/) and
[playwright](https://playwright.dev/python/).

Currently assumes the `test-runner@interval.com` user exists already.
Run `yarn test` in the `web` directory at least once to create it before
running these.

            

Raw data

            {
    "_id": null,
    "home_page": "https://interval.com",
    "name": "interval-sdk",
    "maintainer": "Jacob Mischka",
    "docs_url": null,
    "requires_python": ">=3.9,<4.0",
    "maintainer_email": "jacob@interval.com",
    "keywords": "internal tool,app,ui,ui builder",
    "author": "Jacob Mischka",
    "author_email": "jacob@interval.com",
    "download_url": "https://files.pythonhosted.org/packages/e2/49/a248f98053fa5d7f077befb51c03b5b96ebf4c679ee942bb15370c875c2c/interval_sdk-1.5.1.tar.gz",
    "platform": null,
    "description": "<a href=\"https://interval.com\">\n  <img alt=\"Interval\" width=\"100\" height=\"100\" style=\"border-radius: 6px;\" src=\"https://interval.com/img/readme-assets/interval-avatar.png\">\n</a>\n\n# Interval Python SDK\n\n[![pypi version](https://img.shields.io/pypi/v/interval-sdk?style=flat)](https://pypi.org/project/interval-sdk) [![Documentation](https://img.shields.io/badge/documentation-informational)](https://interval.com/docs) [![Twitter](https://img.shields.io/twitter/follow/useinterval.svg?color=%2338A1F3&label=twitter&style=flat)](https://twitter.com/useinterval) [![Discord](https://img.shields.io/badge/discord-join-blueviolet)](https://interval.com/discord)\n\n[Interval](https://interval.com) lets you quickly build internal web apps (think: customer support tools, admin panels, etc.) just by writing backend Python code.\n\nThis is our Python SDK which connects to the interval.com web app. If you don't have an Interval account, you can [create one here](https://interval.com/signup). All core features are free to use.\n\n## Why choose Interval?\n\n_\"Python code > no-code\"_\n\nInterval 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.\n\nWe don't think this is the right solution. **Building UIs for mission-critical tools in your web browser** \u2014 often by non-technical teammates, outside of your codebase, without versioning or code review \u2014 **is an anti-pattern.** Apps built in this manner are brittle and break in unexpected ways.\n\nWith Interval, **all of the code for generating your web UIs lives within your app's codebase.** Tools built with Interval (we call these [actions](https://interval.com/docs/concepts/actions)) 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, `await` any of our [I/O methods](https://interval.com/docs/io-methods/) to present a form to the user and your script will pause execution until input is received.\n\nHere's a simple app with a single \"Hello, world\" action:\n\n```python\nfrom interval_sdk import Interval, IO\n\n# Initialize Interval\ninterval = Interval(api_key=\"<YOUR API KEY>\")\n\n@interval.action\nasync def hello_world(io: IO):\n    name = await io.input.text(\"Your name\")\n    return f\"Hello, {name}\"\n\n\n# Synchronously listen, blocking forever\ninterval.listen()\n```\n\nTo not block, interval can also be run asynchronously using\n`interval.listen_async()`. You must provide your own event loop.\n\nThe task will complete as soon as connection to Interval completes, so you\nlikely want to run forever or run alongside another permanent task.\n\n```python\nimport asyncio, signal\n\nloop = asyncio.get_event_loop()\ntask = loop.create_task(interval.listen_async())\ndef handle_done(task: asyncio.Task[None]):\n    try:\n        task.result()\n    except:\n        loop.stop()\n\ntask.add_done_callback(handle_done)\nfor sig in {signal.SIGINT, signal.SIGTERM}:\n    loop.add_signal_handler(sig, loop.stop)\nloop.run_forever()\n```\n\nInterval:\n\n- Makes creating full-stack apps as easy as writing CLI scripts.\n- Can scale from a handful of scripts to robust multi-user dashboards.\n- Lets you build faster than no-code, without leaving your codebase & IDE.\n\nWith Interval, you do not need to:\n\n- Write REST or GraphQL API endpoints to connect internal functionality to no-code tools.\n- Give Interval write access to your database (or give us _any_ of your credentials, for that matter).\n- Build web UIs with a drag-and-drop interface.\n\n## More about Interval\n\n- \ud83d\udcd6 [Documentation](https://interval.com/docs)\n- \ud83c\udf10 [Interval website](https://interval.com)\n- \ud83d\udcac [Discord community](https://interval.com/discord)\n- \ud83d\udcf0 [Product updates](https://interval.com/blog)\n\n## Contributing\n\nThis project uses [Poetry](https://python-poetry.org/) for dependency\nmanagement\n\n1. `poetry install` to install dependencies\n2. `poetry shell` to activate the virtual environment\n\nTasks are configured using [poethepoet](https://github.com/nat-n/poethepoet)\n(installed as a dev dependency).\n\n- `poe demo [demo_name]` to run a demo (`basic` by default if `demo_name` omitted)\n- `poe test` to run `pytest` (can also run `pytest` directly in virtual env)\n\nCode is formatted using [Black](https://github.com/psf/black). Please configure\nyour editor to format on save using Black, or run `poe format` to format the\ncode before committing changes.\n\n## Tests\n\n*Note:* Tests currently require a local instance of the Interval backend.\n\nTests use [pytest](https://docs.pytest.org/en/7.1.x/) and\n[playwright](https://playwright.dev/python/).\n\nCurrently assumes the `test-runner@interval.com` user exists already.\nRun `yarn test` in the `web` directory at least once to create it before\nrunning these.\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "The frontendless framework for high growth companies. Interval automatically generates apps by inlining the UI in your backend code. It's a faster and more maintainable way to build internal tools, rapid prototypes, and more.",
    "version": "1.5.1",
    "project_urls": {
        "Documentation": "https://interval.com/docs",
        "Homepage": "https://interval.com",
        "Repository": "https://github.com/interval/interval-py"
    },
    "split_keywords": [
        "internal tool",
        "app",
        "ui",
        "ui builder"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6af20b6560e2146918f832f607758e302f91f76f44657a0398065d4d0a73a3fa",
                "md5": "e0d48386e49ed2b859baab47c96aa3cb",
                "sha256": "75d4afc0cd48e0625e891a4fa6fcabb7cb2803c00079512035bceba688bfa197"
            },
            "downloads": -1,
            "filename": "interval_sdk-1.5.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e0d48386e49ed2b859baab47c96aa3cb",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9,<4.0",
            "size": 62188,
            "upload_time": "2023-09-18T20:48:03",
            "upload_time_iso_8601": "2023-09-18T20:48:03.006625Z",
            "url": "https://files.pythonhosted.org/packages/6a/f2/0b6560e2146918f832f607758e302f91f76f44657a0398065d4d0a73a3fa/interval_sdk-1.5.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e249a248f98053fa5d7f077befb51c03b5b96ebf4c679ee942bb15370c875c2c",
                "md5": "8930541f24c23dc38015da755e952fad",
                "sha256": "9aeab79353e2a0f2fb971553edb96422e972c68de72a573f243d2491d685384d"
            },
            "downloads": -1,
            "filename": "interval_sdk-1.5.1.tar.gz",
            "has_sig": false,
            "md5_digest": "8930541f24c23dc38015da755e952fad",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9,<4.0",
            "size": 55155,
            "upload_time": "2023-09-18T20:48:06",
            "upload_time_iso_8601": "2023-09-18T20:48:06.081188Z",
            "url": "https://files.pythonhosted.org/packages/e2/49/a248f98053fa5d7f077befb51c03b5b96ebf4c679ee942bb15370c875c2c/interval_sdk-1.5.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-09-18 20:48:06",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "interval",
    "github_project": "interval-py",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "interval-sdk"
}
        
Elapsed time: 1.36601s