A code executor that leverages Docker Container
Project description
Docker Code Executor
This is borrowed from https://github.com/microsoft/autogen/blob/main/python/packages/autogen-ext/src/autogen_ext/code_executors/docker/_docker_code_executor.py
and converted into an independent package with some minor modifications and adjustments.
Install
pip install docker-code-executor
Usage
import asyncio
from docker_code_executor import CancellationToken, CodeBlock, CommandLineCodeResult, DockerCommandLineCodeExecutor
executor = DockerCommandLineCodeExecutor()
await executor.start()
code_blocks = [
CodeBlock(
code="""
import os
for k, v in os.environ.items():
print(f"{k}={v}")
""",
language="python",
)
]
cancel_token = CancellationToken()
result: CommandLineCodeResult = await executor.execute_code_blocks(code_blocks, cancel_token)
print(result.output)
await executor.stop()
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 docker_code_executor-0.0.2.tar.gz.
File metadata
- Download URL: docker_code_executor-0.0.2.tar.gz
- Upload date:
- Size: 12.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c7b2668c80d9ee83c6c27e4b14e7b405f17642561d8f96f80c2edfdcd6d55d17
|
|
| MD5 |
b1a0eace48167839f6ff10b70f3af630
|
|
| BLAKE2b-256 |
d3d18b1554f5a1c54a455af75844639548ec621813730365b43f2731e5fc86f2
|
Provenance
The following attestation bundles were made for docker_code_executor-0.0.2.tar.gz:
Publisher:
publish.yaml on ksachdeva/code-executors
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
docker_code_executor-0.0.2.tar.gz -
Subject digest:
c7b2668c80d9ee83c6c27e4b14e7b405f17642561d8f96f80c2edfdcd6d55d17 - Sigstore transparency entry: 220107365
- Sigstore integration time:
-
Permalink:
ksachdeva/code-executors@2fccd7ef3f10791f592c2453a64f2d32f10abd35 -
Branch / Tag:
refs/tags/0.0.2 - Owner: https://github.com/ksachdeva
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@2fccd7ef3f10791f592c2453a64f2d32f10abd35 -
Trigger Event:
release
-
Statement type:
File details
Details for the file docker_code_executor-0.0.2-py3-none-any.whl.
File metadata
- Download URL: docker_code_executor-0.0.2-py3-none-any.whl
- Upload date:
- Size: 13.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
313c37f179aa0d1e257efdf590c5a47fb21dd6ea71260d6976ddb0d5704148a3
|
|
| MD5 |
295b7fb0e4d75d61908d56149c092cb6
|
|
| BLAKE2b-256 |
b7da3ef01077edc3fb8c95f22178c4d031f3ad85f72a1dc85ddfa5c644e5ec00
|
Provenance
The following attestation bundles were made for docker_code_executor-0.0.2-py3-none-any.whl:
Publisher:
publish.yaml on ksachdeva/code-executors
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
docker_code_executor-0.0.2-py3-none-any.whl -
Subject digest:
313c37f179aa0d1e257efdf590c5a47fb21dd6ea71260d6976ddb0d5704148a3 - Sigstore transparency entry: 220107369
- Sigstore integration time:
-
Permalink:
ksachdeva/code-executors@2fccd7ef3f10791f592c2453a64f2d32f10abd35 -
Branch / Tag:
refs/tags/0.0.2 - Owner: https://github.com/ksachdeva
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@2fccd7ef3f10791f592c2453a64f2d32f10abd35 -
Trigger Event:
release
-
Statement type: