Skip to content

fix(dockerfile-utils): keep Python digit classes ASCII-only - #2139

Merged
mishushakov merged 2 commits into
mainfrom
devin/1794583693-accept-pr-2132
Nov 13, 2026
Merged

mishushakov merged 2 commits into
mainfrom
devin/1794583693-accept-pr-2132

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Brings in community PR #2132 by @fhgffy (squash-merged into this branch as 74f903b), accepted via /accept by @mishushakov, plus a follow-up for JS/Python parity.

Python's \d is a Unicode digit class, so a .dockerignore pattern like [\d] excluded ١ (U+0661), unlike Moby's matcher and the JS utility, which use ASCII digit semantics. dockerignore.py now compiles patterns with re.ASCII.

re.ASCII also narrows Python's \s. JS \s still matched Unicode spaces, so JS translateClass now expands \s → \t-\r and \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.

from e2b_dockerfile_utils import PatternMatcher

PatternMatcher([r"[\d]"]).matches("\u0661")  # False
PatternMatcher([r"[\s]"]).matches("\u00a0")  # False (same in JS)
PatternMatcher([r"[\S]"]).matches("\u00a0")  # True

Includes patch changesets for @e2b/dockerfile-utils-python and @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


Devin Review

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 -->
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@cla-bot cla-bot Bot added the cla-signed label Nov 13, 2026
@changeset-bot

changeset-bot Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 1136b62

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
@e2b/dockerfile-utils-python Patch
@e2b/dockerfile-utils Patch
@e2b/python-sdk Patch
@e2b/code-interpreter-python Patch

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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-13T15:30:26.027610Z 74f903b PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Written by Devin

devin-ai-integration[bot]

This comment was marked as resolved.

@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Package Artifacts

Built from 5d4e13b. Download artifacts from this workflow run.

JS SDK (e2b@2.63.1-devin-1794583693-accept-pr-2132.0, with @e2b/dockerfile-utils@0.1.2-devin-1794583693-accept-pr-2132.0):

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.tgz

CLI (@e2b/cli@2.23.1-devin-1794583693-accept-pr-2132.0):

npm install ./e2b-cli-2.23.1-devin-1794583693-accept-pr-2132.0.tgz

Code Interpreter JS SDK (@e2b/code-interpreter@2.9.2-devin-1794583693-accept-pr-2132.0):

npm install ./e2b-code-interpreter-2.9.2-devin-1794583693-accept-pr-2132.0.tgz

Desktop JS SDK (@e2b/desktop@2.5.1-devin-1794583693-accept-pr-2132.0):

npm install ./e2b-desktop-2.5.1-devin-1794583693-accept-pr-2132.0.tgz

Python SDK (e2b==2.63.0+devin.1794583693.accept.pr.2132, with e2b-dockerfile-utils==0.1.1+devin.1794583693.accept.pr.2132):

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.whl

Code Interpreter Python SDK (e2b-code-interpreter==2.11.9+devin.1794583693.accept.pr.2132):

pip install ./e2b_code_interpreter-2.11.9+devin.1794583693.accept.pr.2132-py3-none-any.whl

Desktop Python SDK (e2b-desktop==2.7.2+devin.1794583693.accept.pr.2132):

pip install ./e2b_desktop-2.7.2+devin.1794583693.accept.pr.2132-py3-none-any.whl

chatgpt-codex-connector[bot]

This comment was marked as resolved.

claude[bot]

This comment was marked as resolved.

@mishushakov

Copy link
Copy Markdown
Member

fix the guys pls

…hon and Moby

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

@mishushakov I addressed the three bot threads in 1136b62. They all flagged the same [\s] parity gap, and it's now fixed on the JS side with tests in both packages. The Windows Python SDK failure was a 429 rate limit in test_fork (an integration test), so it's unrelated to this PR. The new push reruns CI.

@mishushakov
mishushakov merged commit aec4543 into main Nov 13, 2026
39 checks passed
@mishushakov
mishushakov deleted the devin/1794583693-accept-pr-2132 branch November 13, 2026 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants