Skip to content

fix(ci): unblock mypy — overrides for SDK modules + 4 strict-mode errors#1

Merged
npow merged 1 commit into
mainfrom
fix-mypy
May 10, 2026
Merged

fix(ci): unblock mypy — overrides for SDK modules + 4 strict-mode errors#1
npow merged 1 commit into
mainfrom
fix-mypy

Conversation

@npow

@npow npow commented May 10, 2026

Copy link
Copy Markdown
Owner

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.) — added ignore_missing_imports overrides 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:48return cls() returning Any
  • _micromamba.py:151,156 — narrowed-then-widened path variable
  • installer.py:364 — undeclared _script_path attribute

Local: ruff check + ruff format --check + mypy + 92 pytests all green.

🤖 Generated with Claude Code

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>
@npow npow merged commit 7f301c4 into main May 10, 2026
5 checks passed
@npow npow deleted the fix-mypy branch May 10, 2026 06:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant