Heaptree | Launch Virtual Machines With One Line of Code
Project description
What is Heaptree?
Heaptree lets you launch secure cloud instances with one line of code. Perfect for AI workloads, asynchronous tasks, or any application that needs on-demand compute.
Getting Started
1. Install the SDK
pip install htsdk
2. Login from your terminal
This opens your browser to sign in with GitHub/Google and automatically configures your API key.
heaptree login
This will:
- Save your key to
~/.heaptree/config.json - Add
HEAPTREE_API_KEYto your shell profile (e.g.~/.zshrc)
Open a new terminal (or run source ~/.zshrc) for the environment change to take effect.
3. Create your first node
import os
from heaptree import Heaptree
# Initialize the client
client = Heaptree(api_key=os.getenv("HEAPTREE_API_KEY"))
# Create a new node
result = client.create_node(
num_nodes=1,
node_size="small"
)
print(f"Node created: {result.node_id}")
4. Use your node
# Run a command on the node
response = client.run_command(
node_id=result.node_id,
command="echo 'Hello from Heaptree!'"
)
# Clean up when done
client.terminate_node(result.node_id)
Updating the SDK
To update to the latest version of the SDK, run:
pip install --upgrade htsdk
Or use the shorthand:
pip install -U htsdk
To check your current SDK version:
pip show htsdk
Features
- Node Management: Create, terminate, and manage cloud instances
- File Operations: Upload and download files to/from nodes
- Command Execution: Run commands remotely on your nodes
- Multiple Node Support: Create and manage multiple nodes simultaneously
Git in Firecracker nodes
from heaptree import Heaptree
client = Heaptree(api_key=os.getenv("HEAPTREE_API_KEY"))
node = client.create_firecracker_node()
# Clone a public repo
node.git_clone(
url="https://github.com/user/repo.git",
path="workspace/repo"
)
# Clone with authentication (e.g., PAT)
node.git_clone(
url="https://github.com/user/private-repo.git",
path="workspace/private-repo",
username="git",
password="personal_access_token"
)
# Clone a specific branch
node.git_clone(
url="https://github.com/user/repo.git",
path="workspace/repo-branch",
branch="develop"
)
# Get repo status
status = node.git_status("workspace/repo")
print(status.current_branch, status.ahead, status.behind)
for f in status.file_status:
print(f.name, f.status)
# List branches
branches = node.git_branches("workspace/repo")
for b in branches.branches:
print(b)
API Reference
For complete SDK documentation, including all available methods, parameters, and examples, visit the official documentation:
License
This project is licensed under the MIT License - see the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file htsdk-0.1.0b10.tar.gz.
File metadata
- Download URL: htsdk-0.1.0b10.tar.gz
- Upload date:
- Size: 18.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b8450bb5e3dddaf0b787b2f4a96c6c84f1a48222710a369e88238d02f508b376
|
|
| MD5 |
9664ce1d7e9e81c906a189520074cf0b
|
|
| BLAKE2b-256 |
cd8b55e729b8df90b0619c1f526553d0b385776d597700155742ce1d7d732eb3
|
File details
Details for the file htsdk-0.1.0b10-py3-none-any.whl.
File metadata
- Download URL: htsdk-0.1.0b10-py3-none-any.whl
- Upload date:
- Size: 16.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
457410af83dc72fb2ae74a576559d48c71d7208c43a459d885bc38b6ec12d95f
|
|
| MD5 |
88fd112e3508a950e84ba822c890f17f
|
|
| BLAKE2b-256 |
40da2b55ee7293f05bdd1abb9dac41bd93ce27171bdb9ccac56fb9e4b5272838
|