Skip to content

fix(python-sdk): correct inverted no_install_recommends docstring#1533

Open
mishushakov wants to merge 1 commit into
mainfrom
fix/no-install-recommends-docstring
Open

fix(python-sdk): correct inverted no_install_recommends docstring#1533
mishushakov wants to merge 1 commit into
mainfrom
fix/no-install-recommends-docstring

Conversation

@mishushakov

Copy link
Copy Markdown
Member

Promotes the merged #1532 (by @anxkhn) from the staging branch fix/no-install-recommends-docstring into main.

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:

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; documentation-only, plus a @e2b/python-sdk: patch changeset.

Usage

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)

🤖 Generated with Claude Code

)

`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>
@cursor

cursor Bot commented Jul 7, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Documentation-only change with no code or runtime impact.

Overview
The TemplateBuilder.apt_install() docstring for no_install_recommends said it controlled whether to install recommended packages, but True adds apt-get's --no-install-recommends and skips them. The docstring now says it controls whether to skip recommended packages. Runtime behavior is unchanged. A patch changeset was added for @e2b/python-sdk.

Reviewed by Cursor Bugbot for commit a31a1ed. Bugbot is set up for automated code reviews on this repo. Configure here.

@changeset-bot

changeset-bot Bot commented Jul 7, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: a31a1ed

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

This PR includes changesets to release 1 package
Name Type
@e2b/python-sdk 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

@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Package Artifacts

Built from 54ad6f0. Download artifacts from this workflow run.

JS SDK (e2b@2.31.1-fix-no-install-recommends-docstring.0):

npm install ./e2b-2.31.1-fix-no-install-recommends-docstring.0.tgz

CLI (@e2b/cli@2.13.1-fix-no-install-recommends-docstring.0):

npm install ./e2b-cli-2.13.1-fix-no-install-recommends-docstring.0.tgz

Python SDK (e2b==2.30.0+fix.no.install.recommends.docstring):

pip install ./e2b-2.30.0+fix.no.install.recommends.docstring-py3-none-any.whl

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

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