e2b-dockerfile-utils
Dockerfile parser and shell lexer ported from BuildKit and a .dockerignore matcher ported from moby/patternmatcher, with no runtime dependencies. Used by the E2B SDK to implement Template.from_dockerfile and to filter the build context.
from e2b_dockerfile_utils import ShellLex, parse_dockerfile_ast
ast = parse_dockerfile_ast(
"""
FROM node:24 AS build
ENV KEY="a b" OTHER=c
RUN <<EOF
npm ci
npm run build
EOF
"""
)
for instruction in ast.instructions:
print(instruction.name, instruction.flags, instruction.args)
lex = ShellLex(ast.escape_token)
lex.process_words('KEY="a b" OTHER=c') # ['KEY=a b', 'OTHER=c']
parse_dockerfile_ast handles parser directives (# escape=, # syntax=), comments (including inside line continuations), builder flags, JSON/exec forms and heredocs, and reports line numbers and warnings. ShellLex splits and unquotes words the way BuildKit does, preserving $VAR / ${VAR:-default} references for later expansion.
from e2b_dockerfile_utils import PatternMatcher
matcher = PatternMatcher(["node_modules", "*.log", "!keep.log"])
matcher.matches("node_modules/pkg/index.js") # True
matcher.matches("keep.log") # False
PatternMatcher applies .dockerignore semantics to slash-separated paths relative to the context root: a pattern matching a directory excludes everything under it, and ! patterns re-include paths (the last matching pattern wins). An invalid pattern raises a plain ValueError.
Metadata
Release files for e2b-dockerfile-utils 0.1.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 | Actions |
|---|---|---|---|---|
| e2b_dockerfile_utils-0.1.2.tar.gz | 17.4 kB | Without provenance | Details for e2b_dockerfile_utils-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| e2b_dockerfile_utils-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for e2b_dockerfile_utils-0.1.2-py3-none-any.whl |
Total release size: 37.3 kB
Release files / e2b_dockerfile_utils-0.1.2.tar.gz
| Download URL | e2b_dockerfile_utils-0.1.2.tar.gz |
|---|---|
| Size | 17.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
11cefef300ff4ef3a641d65b0e0be4dab3dc1dc988842c2104809b0385dc52a2
|
|
BLAKE2b-256 checksum How to use checksums |
38a1a9ed52edfccca5bf234eb59a41b13f91d2bd34017a23ab1b32d5bb95eed7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.4 {"installer":{"name":"uv","version":"0.13.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / e2b_dockerfile_utils-0.1.2-py3-none-any.whl
| Download URL | e2b_dockerfile_utils-0.1.2-py3-none-any.whl |
|---|---|
| Size | 19.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5991ec2e4282372464ad39178580e9bb9a3efba7f396b8859b954b0d81050d40
|
|
BLAKE2b-256 checksum How to use checksums |
79ec973456753f7ad91b707124be6cb401dc358c8b71638e4f698ba903ce6c31
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.4 {"installer":{"name":"uv","version":"0.13.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for e2b-dockerfile-utils 0.1.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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A 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.