Skip to main content

Lizard Python SDK

Run commands, work with files and execute code in Linux sandboxes on Kubernetes. The SDK also manages Lizard apps, databases, storage and projects.

Install

Requires Python 3.10+. The Python client is synchronous.

pip install lizard-sdk

Create an API key and project at lizard.build, then set:

export LIZARD_API_KEY="your-api-key"

Create a sandbox

Save this as quickstart.py. Replace my-project with your project's ID, slug or unique name, then run python quickstart.py.

from lizard import Lizard

lizard = Lizard(project="my-project")

with lizard.create("base", timeout_ms=300_000) as sandbox:
    sandbox.fs.write("/tmp/hello.txt", "Hello from Lizard!")
    result = sandbox.process.exec_("cat /tmp/hello.txt")
    if result.exit_code != 0:
        raise RuntimeError(result.stderr)
    print(result.stdout)

The context manager kills the sandbox when the block ends, including when it raises an error. If you create a sandbox without with, call sandbox.kill() in a finally block.

Stream command output

Inside the with block above:

result = sandbox.process.exec_(
    'printf "hello\\n"',
    timeout_ms=30_000,
    on_stdout=lambda chunk: print(chunk, end=""),
    on_stderr=lambda chunk: print(chunk, end=""),
)
if result.exit_code != 0:
    raise RuntimeError(result.stderr)

Run code

CodeSandbox uses the code-interpreter-v1 template by default. Code errors appear in result.error; request failures raise an exception.

from lizard import CodeSandbox

with CodeSandbox.create(project="my-project") as sandbox:
    result = sandbox.run_code(
        "print(6 * 7)",
        language="python",
        timeout_ms=60_000,
        on_stdout=lambda chunk: print(chunk, end=""),
    )
    if result.error:
        raise RuntimeError(result.error.message)

Configuration

The SDK reads LIZARD_API_KEY and, optionally, LIZARD_API_URL (default: https://lizard.build). You can also pass api_key and api_url to the constructor or static sandbox methods.

Pass timeout_ms to create() to set the sandbox lifetime. The default is five minutes. timeout_ms on process.exec_() or run_code() controls that call, not the sandbox lifetime.

Runtime limits

Sandboxes run on Kubernetes. Use volumes mounted at /workspace to keep files after a sandbox ends. Pause, resume, fork, snapshot creation and snapshot restore return HTTP 501 on the current backend.

get_host() returns a hostname without https://. File writes accept UTF-8 text or valid UTF-8 bytes; read_bytes() supports binary downloads.

Learn more

Apache-2.0

Metadata

Release files for lizard-sdk 0.1.41

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

Source distribution (sdist)

Source distribution for lizard-sdk 0.1.41
File Size Uploaded
lizard_sdk-0.1.41.tar.gz 34.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for lizard-sdk 0.1.41
File Interpreter ABI Platform
lizard_sdk-0.1.41-py3-none-any.whl Python 3 none any Details

Total release size: 76.1 kB

Release files / lizard_sdk-0.1.41.tar.gz

Download URL lizard_sdk-0.1.41.tar.gz
Size 34.0 kB
Tags Source
SHA-256 checksum
How to use checksums
a1e18c237a271dff1073a8d38601f12a961cc71e9668585884068cee06be2438
BLAKE2b-256 checksum
How to use checksums
aae52d535eb83ee1a4dba2e35deb37809d1f12d26f374fcd9c7a8224db9cc6a8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 29, 2026.

Transparency log

Release files / lizard_sdk-0.1.41-py3-none-any.whl

Download URL lizard_sdk-0.1.41-py3-none-any.whl
Size 42.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b31c60c8f7936a130fc86b6ee63026aab43b1f05214a159b3a8fa64dc8df83ae
BLAKE2b-256 checksum
How to use checksums
8958c4ae1f4a79f7ddcf68cdd5380fe8f64b16b7e9bde72220145f01d79334cd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 29, 2026.

Transparency log

Release history Release notifications | RSS feed

0.1.49

2 release files

0.1.48

2 release files

0.1.47

2 release files

0.1.46

2 release files

0.1.45

2 release files

0.1.44

2 release files

0.1.43

2 release files

0.1.42

2 release files

This release

0.1.41 This release

2 release files

0.1.40

2 release files

0.1.39

2 release files

0.1.38

2 release files

0.1.37

2 release files

0.1.36

2 release files

0.1.35

2 release files

0.1.34

2 release files

0.1.33

2 release files

0.1.32

2 release files

0.1.31

2 release files

0.1.30

2 release files

0.1.29

2 release files

0.1.28

2 release files

0.1.26

2 release files

0.1.25

2 release files

0.1.24

2 release files

0.1.23

2 release files

0.1.22

2 release files

0.1.21

2 release files

0.1.20

2 release files

0.1.19

2 release files

0.1.18

2 release files

0.1.17

2 release files

0.1.16

2 release files

0.1.15

2 release files

0.1.14

2 release files

0.1.13

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

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