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
- Linux x86_64 or arm64, or macOS on Apple Silicon
- Python 3 >= 3.11
- TestFlows Machine client, which installs the SDK Core
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.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| testflows_machine-0.1.4.tar.gz | 144.9 kB | Without provenance | Details for testflows_machine-0.1.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| testflows_machine-0.1.4-py3-none-any.whl | Python 3 | none | any | Details for testflows_machine-0.1.4-py3-none-any.whl |
Total release size: 299.3 kB
Release files / testflows_machine-0.1.4.tar.gz
| Download URL | testflows_machine-0.1.4.tar.gz |
|---|---|
| Size | 144.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
68a1a53930d42219164f0b0e71a05849642f51b01220aedd56e4b842a9d0bafb
|
|
BLAKE2b-256 checksum How to use checksums |
a2a086691acd5f6083744f6281a1c23b0c8225ed1f2de04557ff594c7d03f255
|
| 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.4-py3-none-any.whl
| Download URL | testflows_machine-0.1.4-py3-none-any.whl |
|---|---|
| Size | 154.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
125b651246b8fa206c6e85a57fbc78f8c3e6b70c5b0f4770e4ca2d002e21e823
|
|
BLAKE2b-256 checksum How to use checksums |
3dbc5d1ba5e82c692dfc356485b405099237939a4aaa1a79d8ff35ec7bab5232
|
| 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.4
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.