Skip to main content

TestFlows Machine Python SDK

Introduction

TestFlows Machine is a deterministic execution environment: record a run, replay it exactly, and branch it from any point. The Python SDK does from Python what the machine command does, so a test, a CI job or an exploration program drives runs, branches and replays directly.

Documentation

You can find the Python SDK's documentation at https://testflows.com/docs/machine/#python-sdk.

Supported environment

Installation

The SDK depends on the TestFlows Machine SDK Core, a proprietary compiled module licensed under the Client EULA. The SDK Core is not on PyPI and is not part of this repository. It is installed with the TestFlows Machine client, so install the client first:

$ curl https://testflows.com/machine/install -fsS | bash

Then install the SDK using pip3

$ pip3 install testflows.machine

or from sources

$ git clone https://github.com/testflows/Machine.git
$ cd Machine/sdk/python
$ ./package && ./install

Signing in

The SDK signs in with the API key in TESTFLOWS_MACHINE_API_KEY, for automation and CI, or with the login the machine login command stored.

Hello Machine

Save a program as hello.py:

print("hello, world")

Then build a disk that runs it, boot a run from the disk in a new session, and print what the machine printed:

import testflows.machine.v1 as machine

client = machine.Client()
if "hello" not in {disk.name for disk in client.disks()}:
    client.disks.build(
        "hello", from_="python:3.12-slim", add=["hello.py"], command=["python", "hello.py"]
    )

with client.sessions.create(cpus=1) as session:
    client.sessions.use(session)
    with client.create(disk="hello") as run:
        run.run(until="console~hello, world", timeout=300)
        for line in run.output(lines=-5):
            print(line)

A run moves only when you drive it, and until names where to stop: here, once the console shows hello, world. Leaving a with block deletes what it created, so the session never outlives the program. You build a disk once and create as many runs from it as you like.

More scripts are in examples.

Want to know more?

Find more information about TestFlows Machine at https://testflows.com/machine.

License

The SDK is licensed under the Apache License 2.0. The SDK Core it depends on is proprietary and is not part of the SDK. It is licensed under the Client EULA, which is part of the TestFlows Machine Terms of Service.

TestFlows is a registered trademark of Katteli Inc. in the United States. The Trademark Policy says how the TestFlows name and logo may be used.

Metadata

Release files for testflows.machine 0.1.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for testflows.machine 0.1.6
File Size Uploaded Provenance Actions
testflows_machine-0.1.6.tar.gz 145.3 kB Without provenance Details for testflows_machine-0.1.6.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for testflows.machine 0.1.6
File Interpreter ABI Platform Actions
testflows_machine-0.1.6-py3-none-any.whl Python 3 none any Details for testflows_machine-0.1.6-py3-none-any.whl

Total release size: 300.3 kB

Release files / testflows_machine-0.1.6.tar.gz

Download URL testflows_machine-0.1.6.tar.gz
Size 145.3 kB
Tags Source
SHA-256 checksum
How to use checksums
76ec24cc2cc2019cec7ca13fc8f71260c553e19acd83dbeca5fef8bd8f325362
BLAKE2b-256 checksum
How to use checksums
f3ba3709d25d2a8d79c9d0979e50f7964e3dfee1648e4d19348206eb5b22f911
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / testflows_machine-0.1.6-py3-none-any.whl

Download URL testflows_machine-0.1.6-py3-none-any.whl
Size 154.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0740e740ac1415356ee056638916286d7d4868e0449dd45396eab571e8bcba81
BLAKE2b-256 checksum
How to use checksums
32d5a9e2c3255fb79bc596ca2a213bc4145113e593a1ddb46a67eb9ad7d8575c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Security for testflows.machine 0.1.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page