Repository navigation
fix(dockerfile-utils): keep Python digit classes ASCII-only - #2139
Conversation
Python treats `\d` as a Unicode digit class, so a Dockerignore pattern
such as `[\d]` excludes the file `١` (U+0661). Moby's matcher and the
JavaScript utility use ASCII digit semantics and keep that file. Compile
Python patterns with `re.ASCII`, and cover the public matcher with an
ASCII digit, a non-ASCII digit and an ordinary letter.
```python
from e2b_dockerfile_utils import PatternMatcher
matcher = PatternMatcher([r"[\d]"])
matcher.matches("5") # True
matcher.matches("\u0661") # False
matcher.matches("d") # False
```
The expected class follows [Go regexp
syntax](https://pkg.go.dev/regexp/syntax) and the [Moby pattern
compiler](https://github.com/moby/patternmatcher/blob/5a6d8429a19bb6948a372ff19e86fe83599a04b7/patternmatcher.go).
Existing non-ASCII literals and ranges remain covered by the package
suite.
Validation on Windows / Python 3.12.2:
- Full Python utility suite: before, 945 passed / 1 failed / 1 skipped;
after, 946 passed / 1 skipped. The failing case is U+0661; the test
stays unchanged.
- Ruff check, Ruff format check and `ty check e2b_dockerfile_utils`
pass.
- The unchanged JS public matcher passes the same three source-level
controls on Node 24.14.0.
The Python run uses the checkout on `PYTHONPATH` because Python 3.12
does not resolve the Unicode editable `.pth` path in this Windows
environment. The skipped BuildKit fixture is the existing quote-aware
ADD/COPY case. Includes a patch changeset for
`@e2b/dockerfile-utils-python`.
<!-- devin-review-badge-begin -->
---
<a href="https://app.devin.ai/review/e2b-dev/e2b/pull/2132"
target="_blank"><picture><source media="(prefers-color-scheme: dark)"
srcset="https://static.devin.ai/assets/gh-devin-review-dark.svg?v=4"><img
src="https://static.devin.ai/assets/gh-devin-review-light.svg?v=4"
alt="Devin Review"></picture></a>
<!-- devin-review-badge-end -->
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
🦋 Changeset detectedLatest commit: 1136b62 The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
TASTE.md review: complies — checked parity (T-1), error/validation rules (T-59, T-62–T-63) and public-surface rules (T-3, T-54); 0 violations. The re.ASCII flag is an internal change that brings Python's \d in line with the JS utility's ASCII-only digit class, and the public PatternMatcher API is unchanged.
Package ArtifactsBuilt from 5d4e13b. Download artifacts from this workflow run. JS SDK ( npm install ./e2b-dockerfile-utils-0.1.2-devin-1794583693-accept-pr-2132.0.tgz ./e2b-2.63.1-devin-1794583693-accept-pr-2132.0.tgzCLI ( npm install ./e2b-cli-2.23.1-devin-1794583693-accept-pr-2132.0.tgzCode Interpreter JS SDK ( npm install ./e2b-code-interpreter-2.9.2-devin-1794583693-accept-pr-2132.0.tgzDesktop JS SDK ( npm install ./e2b-desktop-2.5.1-devin-1794583693-accept-pr-2132.0.tgzPython SDK ( pip install ./e2b_dockerfile_utils-0.1.1+devin.1794583693.accept.pr.2132-py3-none-any.whl ./e2b-2.63.0+devin.1794583693.accept.pr.2132-py3-none-any.whlCode Interpreter Python SDK ( pip install ./e2b_code_interpreter-2.11.9+devin.1794583693.accept.pr.2132-py3-none-any.whlDesktop Python SDK ( pip install ./e2b_desktop-2.7.2+devin.1794583693.accept.pr.2132-py3-none-any.whl |
|
fix the guys pls |
…hon and Moby Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
@mishushakov I addressed the three bot threads in 1136b62. They all flagged the same |
Summary
Brings in community PR #2132 by @fhgffy (squash-merged into this branch as 74f903b), accepted via
/acceptby @mishushakov, plus a follow-up for JS/Python parity.Python's
\dis a Unicode digit class, so a.dockerignorepattern like[\d]excluded١(U+0661), unlike Moby's matcher and the JS utility, which use ASCII digit semantics.dockerignore.pynow compiles patterns withre.ASCII.re.ASCIIalso narrows Python's\s. JS\sstill matched Unicode spaces, so JStranslateClassnow expands\s→\t-\rand\S→ its complement. Both SDKs now treat every class escape as ASCII, as Go/Moby does. Ranges with a whitespace escape endpoint ([\s-x]) are still rejected.Includes patch changesets for
@e2b/dockerfile-utils-pythonand@e2b/dockerfile-utils.Link to Devin session: https://app.devin.ai/sessions/3f7fc785862843c38122d687b28c86bf
Open in Devin Desktop: https://app.devin.ai/desktop/session/3f7fc785862843c38122d687b28c86bf?variant=devin