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()
Metadata
Release files for docker-code-executor 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| docker_code_executor-0.0.2.tar.gz | 12.6 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| docker_code_executor-0.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 26.5 kB
Release files / docker_code_executor-0.0.2.tar.gz
| Download URL | docker_code_executor-0.0.2.tar.gz |
|---|---|
| Size | 12.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c7b2668c80d9ee83c6c27e4b14e7b405f17642561d8f96f80c2edfdcd6d55d17
|
|
BLAKE2b-256 checksum How to use checksums |
d3d18b1554f5a1c54a455af75844639548ec621813730365b43f2731e5fc86f2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 26, 2025.
Transparency logRelease files / docker_code_executor-0.0.2-py3-none-any.whl
| Download URL | docker_code_executor-0.0.2-py3-none-any.whl |
|---|---|
| Size | 13.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
313c37f179aa0d1e257efdf590c5a47fb21dd6ea71260d6976ddb0d5704148a3
|
|
BLAKE2b-256 checksum How to use checksums |
b7da3ef01077edc3fb8c95f22178c4d031f3ad85f72a1dc85ddfa5c644e5ec00
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 26, 2025.
Transparency logSecurity for docker-code-executor 0.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for docker_code_executor-0.0.2.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 26, 2025.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.