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"])
Metadata
Release files for forevervm-sdk 0.1.35
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| forevervm_sdk-0.1.35.tar.gz | 11.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| forevervm_sdk-0.1.35-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 17.1 kB
Release files / forevervm_sdk-0.1.35.tar.gz
| Download URL | forevervm_sdk-0.1.35.tar.gz |
|---|---|
| Size | 11.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b62424b5f97472b7a1b5da6150a423db4b42c10b3f40244ad29d3131051ed908
|
|
BLAKE2b-256 checksum How to use checksums |
16414e40010af77fe55097993522b62c2c3d5504fc9f7ff74787dac6ee777f4f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.6.11
|
Release files / forevervm_sdk-0.1.35-py2.py3-none-any.whl
| Download URL | forevervm_sdk-0.1.35-py2.py3-none-any.whl |
|---|---|
| Size | 5.3 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
f2250d6b22cc831ff72ed229fb310e3e954de696b4a6ba9d6563f9c11ae3e2f0
|
|
BLAKE2b-256 checksum How to use checksums |
401c4c28a7280de98765fce141aecc40551d24e3e1b6a700b813b520ec6f043c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.6.11
|