Skip to main content
PyPI version Python ConTree is a container runtime, providing reproducible, versioned filesystem state — like Git for container execution. The SDK makes this accessible from Python.

Quick Start

Installation

Install the SDK from PyPi:
pip install contree-sdk

Basic Usage

image = await client.images.use("busybox:latest")
print(f"Using {image=}")

result = await image.run(shell="echo 'Hello World'")
print(f"Simple echo: {result.stdout=}, {result.stderr=}, {result.exit_code=}")

result = await image.run(shell="pwd")
print(f"Current directory: {result.stdout=}, {result.exit_code=}")

result = await image.run(shell="ls -la")
print(f"Directory listing: {result.stdout=}, {result.exit_code=}")

result = await image.run(shell="cat -", stdin="Hello from stdin\n")
print(f"Cat with stdin: {result.stdout=}, {result.exit_code=}")

result = await image.run(shell="echo 'Error message' >&2; exit 1")
print(f"Error command: {result.stdout=}, {result.stderr=}, {result.exit_code=}")

What’s Next?

Ready to explore more? Check out our guides:

Getting Started

Detailed setup and basic operations.

Working with Images

Pull and import container images.

Running Commands

Comprehensive guide to command execution.

Branching Workflows

Create reproducible execution branches.