Conversation
CI's `mypy src/sandrun` step has been red since the strict-typing
configuration landed. Most failures (44 errors) are 3rd-party SDK
imports without stubs — `e2b_code_interpreter`, `daytona`, `boxlite`,
`boxlite.sync_api`, `e2b.sandbox.commands.command_handle`. mypy types
those imports as `object` and then complains about every attribute
access (`.commands`, `.files`, `.process`, `.fs`, `_box`, `_runtime`,
`exec`, etc.) inside the backend wrapper modules.
Fix: pyproject [tool.mypy.overrides]
- ignore_missing_imports for the five 3rd-party SDK modules
- per-file: relax disallow_untyped_defs / warn_return_any +
disable attr-defined / no-any-return on the three backend modules
that wrap the SDKs (sandrun.backends.{e2b,daytona,boxlite}). Each
backend has its own integration test against the real SDK; static
noise was masking real issues elsewhere.
Plus four pre-existing strict-mode errors that were getting buried
under the 40+ backend errors:
- backends/__init__.py:48 — `return cls()` widened to Any. Bind to a
typed local first (`instance: SandboxBackend = cls()`).
- _micromamba.py:151,156 — `path` was inferred as `str` from the
earlier `if explicit:` branch and rejected the later
`shutil.which(...)` (`str | None`) assignment. Add explicit
`path: str | None` annotation at function scope.
- installer.py:364 — `inst._script_path = script_path` set an
attribute that `__init__` never declared. Add a class-level
`_script_path: str | None = None` default with a comment explaining
it's set by `_from_pep723_path()` for the inline-metadata path.
Local: ruff check + ruff format --check + mypy + 92 pytests all green.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stops main's CI from being red on
mypy src/sandrun.44 of 48 errors were 3rd-party SDK imports without type stubs (
e2b_code_interpreter,daytona,boxlite, etc.) — addedignore_missing_importsoverrides plus per-file relaxations for the three backend wrapper modules. The remaining 4 were pre-existing strict-mode errors hidden under the SDK noise:backends/__init__.py:48—return cls()returning Any_micromamba.py:151,156— narrowed-then-widenedpathvariableinstaller.py:364— undeclared_script_pathattributeLocal: ruff check + ruff format --check + mypy + 92 pytests all green.
🤖 Generated with Claude Code