fix(python-sdk): correct inverted no_install_recommends docstring#1533
fix(python-sdk): correct inverted no_install_recommends docstring#1533mishushakov wants to merge 1 commit into
Conversation
) `TemplateBuilder.apt_install()` documents its `no_install_recommends` parameter as "Whether to install recommended packages", but the generated command does the opposite. In `packages/python-sdk/e2b/template/main.py` the command adds apt-get's `--no-install-recommends` flag when the argument is `True`: ```python f"... apt-get install -y {'--no-install-recommends ' if no_install_recommends else ''}..." ``` `--no-install-recommends` tells apt to *skip* recommended packages, so `no_install_recommends=True` skips them rather than installing them. A user who follows the docstring gets the inverse of the documented behavior. The parameter name and apt-get's own semantics confirm the code is correct and the docstring was wrong; this rewords the docstring line to match the real behavior. The `--no-install-recommends` flag was introduced in #983; the docstring has been inverted since then. This is Python-only. The JS twin `aptInstall` applies the same flag but has no per-parameter JSDoc for `noInstallRecommends` (it appears only inside an `@example`), so there is nothing contradictory to fix on the JS side. There is a single Python definition (no sync/async mirror for the template builder). No behavior change. ### Usage ```python from e2b import Template template = Template().from_image("ubuntu:22.04") # Install recommended packages as well (apt-get default): template.apt_install("vim") # Skip recommended packages (adds apt-get's --no-install-recommends): template.apt_install("vim", no_install_recommends=True) ``` --- ## Commit(s) - `9a860642` fix(python-sdk): correct inverted no_install_recommends docstring - `packages/python-sdk/e2b/template/main.py` (1 docstring line) - `.changeset/python-apt-install-docstring.md` (`@e2b/python-sdk: patch`, new) Diff: +10 / -1 across 2 files. No logic touched. --- ## Verification (run locally in `packages/python-sdk`) - `ruff format --check e2b/template/main.py` -> already formatted (exit 0) - `ruff check e2b/template/main.py` -> All checks passed (exit 0) - `ty check` -> 47 diagnostics, all pre-existing (paginator.py, sandbox_api.py, test files); zero in the changed file. A comment-only edit cannot affect typing. No dedicated regression test: this is a documentation-only fix with no runtime branch to cover, matching the merged docstring-correctness precedents (#1500 / #1511 `Sandbox.list`, #1260 `write_files`). Signed-off-by: Anas Khan <83116240+anxkhn@users.noreply.github.com>
PR SummaryLow Risk Overview Reviewed by Cursor Bugbot for commit a31a1ed. Bugbot is set up for automated code reviews on this repo. Configure here. |
🦋 Changeset detectedLatest commit: a31a1ed The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
Package ArtifactsBuilt from 54ad6f0. Download artifacts from this workflow run. JS SDK ( npm install ./e2b-2.31.1-fix-no-install-recommends-docstring.0.tgzCLI ( npm install ./e2b-cli-2.13.1-fix-no-install-recommends-docstring.0.tgzPython SDK ( pip install ./e2b-2.30.0+fix.no.install.recommends.docstring-py3-none-any.whl |
There was a problem hiding this comment.
LGTM — docstring correction accurately matches the existing --no-install-recommends behavior.
Extended reasoning...
Overview
This PR is a one-line docstring fix in packages/python-sdk/e2b/template/main.py for TemplateBuilder.apt_install()'s no_install_recommends parameter, plus a patch changeset. The docstring previously read "Whether to install recommended packages" but the code emits apt-get's --no-install-recommends flag when the argument is True, which does the opposite. The new wording ("Whether to skip installing recommended packages") matches both apt-get's semantics and the parameter name.
Security risks
None. Documentation-only change with no runtime impact.
Level of scrutiny
Very low — this is the most minimal class of change: a single-line docstring correction with an accompanying changeset. The correction is verifiable against the same line of code in the file and against apt-get's documented flag semantics.
Other factors
No behavior change, no test impact, and Cursor's Bugbot flagged it as low risk. The PR description notes that the JS twin aptInstall has no equivalent per-parameter JSDoc (only an @example reference), so nothing contradictory needs mirroring on the JS side — consistent with the repo's guidance about keeping JS/Python SDKs in sync.
Promotes the merged #1532 (by @anxkhn) from the staging branch
fix/no-install-recommends-docstringintomain.TemplateBuilder.apt_install()documents itsno_install_recommendsparameter as"Whether to install recommended packages", but the generated command does the
opposite. In
packages/python-sdk/e2b/template/main.pythe command adds apt-get's--no-install-recommendsflag when the argument isTrue:f"... apt-get install -y {'--no-install-recommends ' if no_install_recommends else ''}..."--no-install-recommendstells apt to skip recommended packages, sono_install_recommends=Trueskips them rather than installing them. A user whofollows the docstring gets the inverse of the documented behavior. The parameter
name and apt-get's own semantics confirm the code is correct and the docstring was
wrong; this rewords the docstring line to match the real behavior.
The
--no-install-recommendsflag was introduced in #983; the docstring has beeninverted since then.
This is Python-only. The JS twin
aptInstallapplies the same flag but has noper-parameter JSDoc for
noInstallRecommends(it appears only inside an@example), so there is nothing contradictory to fix on the JS side. There is asingle Python definition (no sync/async mirror for the template builder).
No behavior change; documentation-only, plus a
@e2b/python-sdk: patchchangeset.Usage
🤖 Generated with Claude Code