Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

rototo Python SDK

Every substantial software system eventually needs a configuration subsystem. The software provides the underlying capabilities; configuration steers those capabilities to behave in a particular way.

Some configuration is settings-style: things like database URLs and encryption keys, usually held in environment variables and fixed once the software is deployed. That's not the kind we're concerned with here. What interests us instead is the configuration that governs the system's runtime behavior: feature availability, model selection, tenant overrides, offers, retry policies, logging controls, rollout plans, and so on.

Rototo provides a control plane for this kind of runtime configuration. It rests on a simple premise: runtime configuration should be treated like code. It should live alongside the code and follow a similar release cycle, and it should be testable and contract-enforced in the same way.

To that end, Rototo models configuration as files that are versioned, reviewed, tested, and released as packages. The Rototo SDK loads these packages within the application runtime to guide the application's behavior. Configuration thus follows the same release process as code, while gaining a hot-swappable deployment mechanism.

Rototo's hello world

Let's take a simple use case: we want to vary the order amount beyond which customers get free shipping. Customers in standard tier must have at least $50 as cart total while customers in premium tier get free shipping after $25. To accomplish this, we would do two things:

  • Create a Rototo configuration package.
  • Load the configuration package and resolve free shipping threshold in our application.

Create and publish a configuration package

First, install the Rototo cli from crates.io:

cargo install rototo --version 0.1.0-alpha.6

Now, create a configuration package for the application:

# Create app-config package with a variable named free-shipping-threshold
rototo init app-config --variable free-shipping-threshold

You should see the following in app-config/ dir:

$> tree app-config
app-config
├── rototo-package.toml
├── evaluation-contexts
├── qualifiers
└── variables
    └── free-shipping-threshold.toml
├── catalogs
├── lint
6 directories, 2 files

We explain the package model in Rototo Concepts. For now, we would focus on the variable free-shipping-threshold. Replace the contents of free-shipping-threshold.toml with the following:

schema_version = 1
description = "$ threshold for free shipping."
type = "int"

[resolve]
default = 50  # by default, free shipping beyond $50.

[[resolve.rule]]
when = '(context.account.tier == "premium")'
value = 25    # for premium account tier, free shipping beyond $25.

We can now validate our configuration to ensure that we got it right:

rototo lint app-config

We can further ensure that free-shipping-threshold resolves as expected.

# default value: should give 50
rototo resolve app-config --variable free-shipping-threshold
# standard account tier: should give 50
rototo resolve app-config --variable free-shipping-threshold --context account.tier=standard
# premium account tier: should give 25
rototo resolve app-config --variable free-shipping-threshold --context account.tier=premium

Load the configuration package and resolve the threshold

Now let's read that value from an application. Install the rototo Python SDK:

python -m pip install rototo

Save this as hello-rototo.py. It loads a refreshing package (one that re-reads the source in the background) and prints the free-shipping threshold for a standard and a premium account every couple of seconds:

import asyncio

import rototo

VARIABLE_ID = "free-shipping-threshold"


def print_threshold(app_config, tier):
    resolution = app_config.resolve_variable(
        VARIABLE_ID,
        {"account": {"tier": tier}},
    )
    print(f"{tier}: {resolution.value} USD")


async def main():
    app_config = await rototo.RefreshingPackage.load("app-config", period_seconds=1.0)
    try:
        while True:
            print("---")
            print_threshold(app_config, "standard")
            print_threshold(app_config, "premium")
            await asyncio.sleep(2.0)
    finally:
        await app_config.shutdown()


asyncio.run(main())

Run it (python hello-rototo.py) from the directory that holds app-config, and it prints:

---
standard: 50 USD
premium: 25 USD

Now edit free-shipping-threshold.toml, change the default to 35, and save. Because the package refreshes every second, the next tick shows:

---
standard: 50 USD
premium: 35 USD

Documentation

Public docs are available on rototo.dev. The rototo cli also ships with the same documents in markdown.

You and your agent can use the docs command in the cli:

# show available docs
rototo docs

# search for docs
rototo docs -s <search terms>

# fetch doc based on doc id prefix
rototo docs -p concepts

Rototo is designed for people and agents

Agents are now among the most important users of any development tool. Hence, Rototo is designed from ground up to work well both for people and agents.

  • The configuration package is simply a dir tree of files that brings battle-tested ergnomics of file organization and editing.
  • rototo docs to discover Rototo's capabilities and the recipes to use it.
  • rototo lint as the backbone for configuration validation that can be run after every edit.
  • rototo inspect to reason about the package structure and how everything resolves at runtime.
  • rototo resolve for test automation of invariants (e.g. customer X must always receive configuration Y otherwise something is wrong).
  • rototo lsp to provide feedback (and help) during editing.
  • rototo console to have the comfort of a react based UI for inspecting and editing the package.

License

Licensed under either of:

  • Apache License, Version 2.0
  • MIT license

at your option.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rototo-0.1.0a6.tar.gz (427.1 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

rototo-0.1.0a6-cp310-abi3-win_amd64.whl (5.3 MB view details)

Uploaded CPython 3.10+Windows x86-64

rototo-0.1.0a6-cp310-abi3-manylinux_2_28_x86_64.whl (6.2 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.28+ x86-64

rototo-0.1.0a6-cp310-abi3-manylinux_2_28_aarch64.whl (6.2 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.28+ ARM64

rototo-0.1.0a6-cp310-abi3-macosx_11_0_arm64.whl (5.6 MB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

rototo-0.1.0a6-cp310-abi3-macosx_10_12_x86_64.whl (5.8 MB view details)

Uploaded CPython 3.10+macOS 10.12+ x86-64

File details

Details for the file rototo-0.1.0a6.tar.gz.

File metadata

  • Download URL: rototo-0.1.0a6.tar.gz
  • Upload date:
  • Size: 427.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for rototo-0.1.0a6.tar.gz
Algorithm Hash digest
SHA256 6c93478f2a0db9970f573b2659f9d43c8b247cc4d4904d66c17c9d42a7858f6f
MD5 3aa1fba816c81deb7fd2387c7f58aea2
BLAKE2b-256 142859f5e59f6e144afc59e5961c0082567190c11699bea323a08304ff5dd57a

See more details on using hashes here.

Provenance

The following attestation bundles were made for rototo-0.1.0a6.tar.gz:

Publisher: release.yml on manasgarg/rototo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rototo-0.1.0a6-cp310-abi3-win_amd64.whl.

File metadata

  • Download URL: rototo-0.1.0a6-cp310-abi3-win_amd64.whl
  • Upload date:
  • Size: 5.3 MB
  • Tags: CPython 3.10+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for rototo-0.1.0a6-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 d6986d19df944d3af2182ff5afa205fef5e6b843dc4fa18619c460c8b1a79666
MD5 797ad1dbd7c325f3997c0ed177ecf760
BLAKE2b-256 23c245696824eeffacdc8a3e5b40775a2ca145bec7474942a975b56a6945143b

See more details on using hashes here.

Provenance

The following attestation bundles were made for rototo-0.1.0a6-cp310-abi3-win_amd64.whl:

Publisher: release.yml on manasgarg/rototo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rototo-0.1.0a6-cp310-abi3-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for rototo-0.1.0a6-cp310-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 d32671b82c86c26be9f65eaccefbce011a5100bd17b4e89d596be23fc5078bcb
MD5 f334d532db323fe7bbcda243a8ccd82a
BLAKE2b-256 5673a96720a57d91fc4036a7cfcc830812334a901853834cba67c47612cfa591

See more details on using hashes here.

Provenance

The following attestation bundles were made for rototo-0.1.0a6-cp310-abi3-manylinux_2_28_x86_64.whl:

Publisher: release.yml on manasgarg/rototo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rototo-0.1.0a6-cp310-abi3-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for rototo-0.1.0a6-cp310-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 9862e657efaff080092237fd81d5eba6c96ba4d6845cb6676702bbdb0f777d5f
MD5 ab1b0034693db12e0c04b99918c8aea5
BLAKE2b-256 9b35e1dc04d951c0cea618934309a5e2995c4f8077159914e51175e7c660073c

See more details on using hashes here.

Provenance

The following attestation bundles were made for rototo-0.1.0a6-cp310-abi3-manylinux_2_28_aarch64.whl:

Publisher: release.yml on manasgarg/rototo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rototo-0.1.0a6-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rototo-0.1.0a6-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2d340fe8836b672c553a58ec5377ccd8203f6b15045a08f7a6dd1ccb207246c9
MD5 38612f1d3602fa5aa6c022b42ccbcd81
BLAKE2b-256 fda63555c1c75daece0600202510a4b562145db3283c6d716b3e3c30c4b6914d

See more details on using hashes here.

Provenance

The following attestation bundles were made for rototo-0.1.0a6-cp310-abi3-macosx_11_0_arm64.whl:

Publisher: release.yml on manasgarg/rototo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rototo-0.1.0a6-cp310-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for rototo-0.1.0a6-cp310-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 1451570a322a5ea5929b99380db61967e0f3f47af3616e89b6da49ee1f7c4eb1
MD5 f4c4be1e9e5176afdeb11008cb4e9e94
BLAKE2b-256 8b35e365490b7c92e97150807aabd944fe2fd7d4f5d98b667f260c96ec21b4a1

See more details on using hashes here.

Provenance

The following attestation bundles were made for rototo-0.1.0a6-cp310-abi3-macosx_10_12_x86_64.whl:

Publisher: release.yml on manasgarg/rototo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page