Developer SDK for foreverVM
Project description
foreverVM
repo | version |
---|---|
cli | |
sdk |
foreverVM provides an API for running arbitrary, stateful Python code securely.
The core concepts in foreverVM are machines and instructions.
Machines represent a stateful Python process. You interact with a machine by running instructions (Python statements and expressions) on it, and receiving the results. A machine processes one instruction at a time.
Getting started
You will need an API token (if you need one, reach out to paul@jamsocket.com).
The easiest way to try out foreverVM is using the CLI. First, you will need to log in:
uvx forevervm login
Once logged in, you can open a REPL interface with a new machine:
uvx forevervm repl
When foreverVM starts your machine, it gives it an ID that you can later use to reconnect to it. You can reconnect to a machine like this:
uvx forevervm repl [machine_name]
You can list your machines (in reverse order of creation) like this:
uvx forevervm machine list
You don't need to terminate machines -- foreverVM will automatically swap them from memory to disk when they are idle, and then automatically swap them back when needed. This is what allows foreverVM to run repls “forever”.
Using the API
import os
from forevervm_sdk import ForeverVM
token = os.getenv('FOREVERVM_TOKEN')
if not token:
raise ValueError('FOREVERVM_TOKEN is not set')
# Initialize foreverVM
fvm = ForeverVM(token)
# Connect to a new machine
with fvm.repl() as repl:
# Execute some code
exec_result = repl.exec('4 + 4')
# Get the result
print('result:', exec_result.result)
# Execute code with output
exec_result = repl.exec('for i in range(10):\n print(i)')
for output in exec_result.output:
print(output["stream"], output["data"])
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
File details
Details for the file forevervm_sdk-0.1.35.tar.gz
.
File metadata
- Download URL: forevervm_sdk-0.1.35.tar.gz
- Upload date:
- Size: 11.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.11
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b62424b5f97472b7a1b5da6150a423db4b42c10b3f40244ad29d3131051ed908 |
|
MD5 | 589c51a4a9a0d118cca447d3d30a599e |
|
BLAKE2b-256 | 16414e40010af77fe55097993522b62c2c3d5504fc9f7ff74787dac6ee777f4f |
File details
Details for the file forevervm_sdk-0.1.35-py2.py3-none-any.whl
.
File metadata
- Download URL: forevervm_sdk-0.1.35-py2.py3-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.11
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f2250d6b22cc831ff72ed229fb310e3e954de696b4a6ba9d6563f9c11ae3e2f0 |
|
MD5 | 963201e6b99621d964437baefe63349f |
|
BLAKE2b-256 | 401c4c28a7280de98765fce141aecc40551d24e3e1b6a700b813b520ec6f043c |