zlacker

[return to "Microsandbox: Virtual Machines that feel and perform like containers"]
1. appcyp+Y6[view] [source] 2025-05-30 14:11:40
>>makebo+(OP)
Thanks for sharing!

I'm the creator of microsandbox. If there is anything you need to know about the project, let me know.

This project is meant to make creating microvms from your machine as easy as using Docker containers.

Ask me anything.

◧◩
2. simonw+nT[view] [source] 2025-05-30 19:55:27
>>appcyp+Y6
I'm trying this out now and it's very promising. One problem I'm running into with the Python library is that I'd like to keep that sandbox running for several minutes while I do things like set variables in one call and then use them for stuff several calls later. I keep seeing this error intermittently:

    Error: Sandbox is not started. Call start() first
Is there a suggested way of keeping a sandbox around for longer?

The documented code pattern is this:

    async def main():
        async with PythonSandbox.create(name="my-sandbox") as sb:
            exec = await sb.run("print('Hello, World!')")
            print(await exec.output())
Due to the way my code works I want to instantiate the sandbox once for a specific class and then have multiple calls to it by class methods, which isn't a clean fit for that "async with" pattern.

Any recommendations?

◧◩◪
3. appcyp+G31[view] [source] 2025-05-30 21:29:51
>>simonw+nT
Right. You can skip the `with` context manager and call start and stop yourself.

There is an example of that here:

https://github.com/microsandbox/microsandbox/blob/0c13fc27ab...

[go to top]