Commit Graph

136 Commits

Author SHA1 Message Date
Jamison Lahman 8950eadc06 Release code-interpreter 0.4.4 (#63)
* Release code-interpreter 0.4.4

Bump code-interpreter and executor to 0.4.4 (FastAPI/Starlette upgrade,
configurable executor Docker network, dependency bumps since 0.4.3).

Also publish a versioned image tag from docker-build-push.yml so
consumers can pin a specific release instead of tracking :latest. The
build runs via workflow_dispatch on main, where type=semver yields no
tag, so the version is read from pyproject.toml and emitted via
type=raw alongside :latest.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* nit

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
code-interpreter-0.4.4
2026-06-23 11:06:21 -07:00
dependabot[bot] 8c9f7e24c5 Bump virtualenv from 20.34.0 to 20.36.1 in /code-interpreter (#62)
Bumps [virtualenv](https://github.com/pypa/virtualenv) from 20.34.0 to 20.36.1.
- [Release notes](https://github.com/pypa/virtualenv/releases)
- [Changelog](https://github.com/pypa/virtualenv/blob/main/docs/changelog.rst)
- [Commits](https://github.com/pypa/virtualenv/compare/20.34.0...20.36.1)

---
updated-dependencies:
- dependency-name: virtualenv
  dependency-version: 20.36.1
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-06-23 10:16:18 -07:00
dependabot[bot] 5999531183 Bump requests from 2.32.5 to 2.33.0 in /code-interpreter (#61)
Bumps [requests](https://github.com/psf/requests) from 2.32.5 to 2.33.0.
- [Release notes](https://github.com/psf/requests/releases)
- [Changelog](https://github.com/psf/requests/blob/main/HISTORY.md)
- [Commits](https://github.com/psf/requests/compare/v2.32.5...v2.33.0)

---
updated-dependencies:
- dependency-name: requests
  dependency-version: 2.33.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-06-23 10:12:03 -07:00
David Fejes ef031f147c feat: make executor Docker network configurable via PYTHON_EXECUTOR_DOCKER_NETWORK (#51)
* feat: make executor Docker network configurable via env var

Add PYTHON_EXECUTOR_DOCKER_NETWORK env var (default: "none") to allow
spawned executor containers to join a specific Docker network. Useful
for deployments where the executed code needs to reach internal services
(e.g. via a shared Compose or Traefik network).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Delete .github/workflows/build-code-interpreter.yml

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Jamison Lahman <jamison@lahman.dev>
2026-06-23 17:05:43 +00:00
Jamison Lahman 54cf5eb13c Upgrade fastapi to 0.138.0 and starlette to 1.3.1 (#60)
Bump fastapi from 0.115.0 to 0.138.0 and starlette (transitive) from
0.38.6 to 1.3.1, the latest releases. fastapi 0.138.0 requires
starlette>=0.46.0 and pydantic>=2.9.0; the locked pydantic (2.11.9)
already satisfies that.

Migrate two status-code constants that starlette 1.x deprecated to their
new names (same numeric values, so behavior is unchanged):
  - HTTP_422_UNPROCESSABLE_ENTITY    -> HTTP_422_UNPROCESSABLE_CONTENT
  - HTTP_413_REQUEST_ENTITY_TOO_LARGE -> HTTP_413_CONTENT_TOO_LARGE
This keeps the test run free of the new StarletteDeprecationWarnings.

Verified: mypy --strict, ruff check, ruff format, and the integration
suite all pass (149 passed). The one pre-existing failure,
test_data_stack::test_numpy_pandas_matplotlib_stack, fails identically on
the pre-upgrade baseline (executed workload SIGKILLed, exit 137) and is
unrelated to this change.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-22 15:36:39 -07:00
dependabot[bot] 34d49438e2 Bump pytest from 8.4.2 to 9.0.3 in /code-interpreter (#59)
Bumps [pytest](https://github.com/pytest-dev/pytest) from 8.4.2 to 9.0.3.
- [Release notes](https://github.com/pytest-dev/pytest/releases)
- [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pytest-dev/pytest/compare/8.4.2...9.0.3)

---
updated-dependencies:
- dependency-name: pytest
  dependency-version: 9.0.3
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-06-22 15:28:22 -07:00
dependabot[bot] 1911392ef8 Bump filelock from 3.19.1 to 3.20.3 in /code-interpreter (#57)
Bumps [filelock](https://github.com/tox-dev/py-filelock) from 3.19.1 to 3.20.3.
- [Release notes](https://github.com/tox-dev/py-filelock/releases)
- [Changelog](https://github.com/tox-dev/filelock/blob/main/docs/changelog.rst)
- [Commits](https://github.com/tox-dev/py-filelock/compare/3.19.1...3.20.3)

---
updated-dependencies:
- dependency-name: filelock
  dependency-version: 3.20.3
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-06-22 15:27:59 -07:00
dependabot[bot] 8b2e691359 Bump idna from 3.10 to 3.15 in /code-interpreter (#58)
Bumps [idna](https://github.com/kjd/idna) from 3.10 to 3.15.
- [Release notes](https://github.com/kjd/idna/releases)
- [Changelog](https://github.com/kjd/idna/blob/master/HISTORY.md)
- [Commits](https://github.com/kjd/idna/compare/v3.10...v3.15)

---
updated-dependencies:
- dependency-name: idna
  dependency-version: '3.15'
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-06-22 15:27:14 -07:00
dependabot[bot] 44f278190e Bump python-dotenv from 1.1.1 to 1.2.2 in /code-interpreter (#55)
Bumps [python-dotenv](https://github.com/theskumar/python-dotenv) from 1.1.1 to 1.2.2.
- [Release notes](https://github.com/theskumar/python-dotenv/releases)
- [Changelog](https://github.com/theskumar/python-dotenv/blob/main/CHANGELOG.md)
- [Commits](https://github.com/theskumar/python-dotenv/compare/v1.1.1...v1.2.2)

---
updated-dependencies:
- dependency-name: python-dotenv
  dependency-version: 1.2.2
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-06-22 15:15:43 -07:00
dependabot[bot] 9e15b25a4c Bump pygments from 2.19.2 to 2.20.0 in /code-interpreter (#54)
Bumps [pygments](https://github.com/pygments/pygments) from 2.19.2 to 2.20.0.
- [Release notes](https://github.com/pygments/pygments/releases)
- [Changelog](https://github.com/pygments/pygments/blob/master/CHANGES)
- [Commits](https://github.com/pygments/pygments/compare/2.19.2...2.20.0)

---
updated-dependencies:
- dependency-name: pygments
  dependency-version: 2.20.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-06-22 15:15:19 -07:00
dependabot[bot] a4132e58af Bump fonttools from 4.60.0 to 4.60.2 in /executor (#52)
Bumps [fonttools](https://github.com/fonttools/fonttools) from 4.60.0 to 4.60.2.
- [Release notes](https://github.com/fonttools/fonttools/releases)
- [Changelog](https://github.com/fonttools/fonttools/blob/main/NEWS.rst)
- [Commits](https://github.com/fonttools/fonttools/compare/4.60.0...4.60.2)

---
updated-dependencies:
- dependency-name: fonttools
  dependency-version: 4.60.2
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-06-22 15:14:58 -07:00
dependabot[bot] 1f50731a2f Bump pyasn1 from 0.6.1 to 0.6.3 in /code-interpreter (#56)
Bumps [pyasn1](https://github.com/pyasn1/pyasn1) from 0.6.1 to 0.6.3.
- [Release notes](https://github.com/pyasn1/pyasn1/releases)
- [Changelog](https://github.com/pyasn1/pyasn1/blob/main/CHANGES.rst)
- [Commits](https://github.com/pyasn1/pyasn1/compare/v0.6.1...v0.6.3)

---
updated-dependencies:
- dependency-name: pyasn1
  dependency-version: 0.6.3
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-06-22 15:12:40 -07:00
Jamison Lahman acb3cf9af1 Merge pull request #53 from onyx-dot-app/dependabot/uv/code-interpreter/urllib3-2.7.0
Bump urllib3 from 2.5.0 to 2.7.0 in /code-interpreter
2026-06-22 14:53:36 -07:00
dependabot[bot] 7610a98928 Bump urllib3 from 2.5.0 to 2.7.0 in /code-interpreter
Bumps [urllib3](https://github.com/urllib3/urllib3) from 2.5.0 to 2.7.0.
- [Release notes](https://github.com/urllib3/urllib3/releases)
- [Changelog](https://github.com/urllib3/urllib3/blob/main/CHANGES.rst)
- [Commits](https://github.com/urllib3/urllib3/compare/2.5.0...2.7.0)

---
updated-dependencies:
- dependency-name: urllib3
  dependency-version: 2.7.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-06-22 21:52:06 +00:00
Jamison Lahman d6d41e85ed Merge pull request #47 from onyx-dot-app/dependabot/uv/code-interpreter/python-multipart-0.0.31
Bump python-multipart from 0.0.20 to 0.0.31 in /code-interpreter
2026-06-22 14:51:01 -07:00
Jamison Lahman eb15329f68 Merge pull request #48 from onyx-dot-app/dependabot/uv/executor/cryptography-48.0.1
Bump cryptography from 46.0.1 to 48.0.1 in /executor
2026-06-22 14:50:38 -07:00
Jamison Lahman 0b031e8a1c Merge pull request #43 from onyx-dot-app/dependabot/uv/executor/pillow-12.2.0
Bump pillow from 11.3.0 to 12.2.0 in /executor
2026-06-22 14:50:05 -07:00
Jamison Lahman b5fae8de89 Merge pull request #42 from onyx-dot-app/dependabot/uv/executor/lxml-6.1.0
Bump lxml from 6.0.2 to 6.1.0 in /executor
2026-06-22 14:49:39 -07:00
Jamison Lahman 4cbd57f503 Merge pull request #50 from onyx-dot-app/dependabot/uv/executor/pypdf-6.13.3
Bump pypdf from 6.11.0 to 6.13.3 in /executor
2026-06-22 14:49:21 -07:00
dependabot[bot] f33aa90fef Bump pypdf from 6.11.0 to 6.13.3 in /executor
Bumps [pypdf](https://github.com/py-pdf/pypdf) from 6.11.0 to 6.13.3.
- [Release notes](https://github.com/py-pdf/pypdf/releases)
- [Changelog](https://github.com/py-pdf/pypdf/blob/main/CHANGELOG.md)
- [Commits](https://github.com/py-pdf/pypdf/compare/6.11.0...6.13.3)

---
updated-dependencies:
- dependency-name: pypdf
  dependency-version: 6.13.3
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-06-18 15:26:11 +00:00
dependabot[bot] 675b89714e Bump cryptography from 46.0.1 to 48.0.1 in /executor
Bumps [cryptography](https://github.com/pyca/cryptography) from 46.0.1 to 48.0.1.
- [Changelog](https://github.com/pyca/cryptography/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pyca/cryptography/compare/46.0.1...48.0.1)

---
updated-dependencies:
- dependency-name: cryptography
  dependency-version: 48.0.1
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-06-17 10:09:01 +00:00
dependabot[bot] 35a4c9a397 Bump python-multipart from 0.0.20 to 0.0.31 in /code-interpreter
Bumps [python-multipart](https://github.com/Kludex/python-multipart) from 0.0.20 to 0.0.31.
- [Release notes](https://github.com/Kludex/python-multipart/releases)
- [Changelog](https://github.com/Kludex/python-multipart/blob/main/CHANGELOG.md)
- [Commits](https://github.com/Kludex/python-multipart/compare/0.0.20...0.0.31)

---
updated-dependencies:
- dependency-name: python-multipart
  dependency-version: 0.0.31
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-06-16 17:51:18 +00:00
Danelegend e690122dfa Bump to 0.4.3 (#45) code-interpreter-0.4.3 2026-06-01 10:55:23 -07:00
Danelegend 332a168a62 feat(logging): Add option for json logging (#44)
* Add json logging

* .

* Add json logging

* ruff fix
2026-05-29 14:18:28 -07:00
dependabot[bot] ce7c0851d0 Bump pillow from 11.3.0 to 12.2.0 in /executor
Bumps [pillow](https://github.com/python-pillow/Pillow) from 11.3.0 to 12.2.0.
- [Release notes](https://github.com/python-pillow/Pillow/releases)
- [Changelog](https://github.com/python-pillow/Pillow/blob/main/CHANGES.rst)
- [Commits](https://github.com/python-pillow/Pillow/compare/11.3.0...12.2.0)

---
updated-dependencies:
- dependency-name: pillow
  dependency-version: 12.2.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-05-28 01:50:17 +00:00
dependabot[bot] 7603b070b7 Bump lxml from 6.0.2 to 6.1.0 in /executor
Bumps [lxml](https://github.com/lxml/lxml) from 6.0.2 to 6.1.0.
- [Release notes](https://github.com/lxml/lxml/releases)
- [Changelog](https://github.com/lxml/lxml/blob/master/CHANGES.txt)
- [Commits](https://github.com/lxml/lxml/compare/lxml-6.0.2...lxml-6.1.0)

---
updated-dependencies:
- dependency-name: lxml
  dependency-version: 6.1.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-05-28 01:50:17 +00:00
Danelegend f5201dbc69 . (#40) code-interpreter-0.4.2 2026-05-27 18:48:09 -07:00
Danelegend 9b435c8a6c feat(networking): Net admin configurablity (#39)
* .

* k8s vals

* Fix tests

* Clean up
2026-05-27 18:01:34 -07:00
Danelegend cae7c7940e Merge pull request #38 from onyx-dot-app/0.4.1
chore: Bump to 0.4.1
code-interpreter-0.4.1
2026-05-18 15:51:57 -07:00
Dane Urban dc84e0dda5 . 2026-05-18 15:43:32 -07:00
Danelegend 699e8a1f8a Merge pull request #37 from onyx-dot-app/dane/new-packages
feat: Add fpdf2, pypdf and python-docx
2026-05-18 15:19:24 -07:00
Danelegend f4deba2c77 Merge pull request #36 from civichero/fix/normalize-image-ref-digest-tag
fix(image-ref): preserve digest and tag refs in PYTHON_EXECUTOR_DOCKER_IMAGE
2026-05-18 15:18:04 -07:00
Dane Urban e2200d8223 . 2026-05-18 15:15:48 -07:00
Dane Urban 98ff1d2bd2 Add new packages for better pdf and docx capabilities 2026-05-18 15:01:46 -07:00
civichero f0c0ac8cff fix(image-ref): preserve digest and tag refs in PYTHON_EXECUTOR_DOCKER_IMAGE
`_ensure_docker_image_available` (app/main.py) and
`DockerExecutor.check_health` (app/services/executor_docker.py) both
unconditionally appended `:latest` to whatever value
`PYTHON_EXECUTOR_DOCKER_IMAGE` held. When an operator sets that env var
to a digest reference (e.g. `repo@sha256:abc...`) for reproducible
deploys, the resulting `repo@sha256:abc...:latest` is invalid Docker
syntax: image lookup fails, the FastAPI lifespan aborts, and the
container crashloops.

Refactor both call sites to use a new `normalize_image_ref` helper.
The helper returns the reference unchanged when it already carries a
tag (`:` after the last `/`) or a digest (`@`), and only appends
`:latest` for bare repositories. Registry ports are handled correctly
because a `:` before the last `/` is a port separator, not a tag.

Coverage added in tests/integration_tests/test_image_ref.py:

  * bare repo / namespaced repo / registry/repo all gain :latest
  * tagged refs unchanged at every nesting level
  * digest refs unchanged at every nesting level
  * registry-with-port variants (port + bare, port + tag, port + digest)
  * idempotence

Refs #35
2026-05-15 15:05:51 +02:00
Danelegend bd084c57ce Merge pull request #34 from onyx-dot-app/bump-0.4.0
chore(python-sandbox): Upgrade to 0.4.0
code-interpreter-0.4.0
2026-05-08 12:46:00 -07:00
Dane Urban f7f1aeea0d upgrade to 0.4.0 2026-05-08 12:39:36 -07:00
Danelegend eb7c26dbd5 Merge pull request #33 from onyx-dot-app/dane/health-version
feat(health): include service version in /health response
2026-05-06 14:32:40 -07:00
Dane Urban 5a05056087 . 2026-05-06 14:26:51 -07:00
Dane Urban 60a57c900b test(health): assert SERVICE_VERSION matches the Helm chart version
Catches drift between the Python package version (what /health reports
to clients) and the chart version (what's actually deployed). If they
get out of sync, a client gating on /health's version may try to use
features that aren't actually shipped.

Reads kubernetes/code-interpreter/Chart.yaml directly via a small regex
so the test has no extra dependencies.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-06 14:25:11 -07:00
Dane Urban 44bbde4983 chore: bump python packages to 0.3.3 to match helm chart
The helm chart at kubernetes/code-interpreter/Chart.yaml has been on
0.3.3 since #27, but both pyproject.toml files were still reporting
0.1.0. Now that /health surfaces the package version to clients, line
the pyproject versions up with the chart so a single number tracks
across artifacts.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-06 14:25:11 -07:00
Dane Urban e48b412c0e feat(health): include service version in /health response
Clients can now read ``version`` from the ``/health`` payload to gate
calls to functionality that's only available in newer releases. The
value is sourced from the installed package metadata rather than a
hardcoded string, so the FastAPI app and the health response stay in
sync with the version declared in pyproject.toml.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-06 14:25:07 -07:00
Danelegend 8d21be9e98 Merge pull request #32 from onyx-dot-app/dane/bash
feat(bash): Add bash functionality
2026-05-06 13:51:23 -07:00
Dane Urban 1d2e375e10 . 2026-05-06 13:49:05 -07:00
Danelegend 74eb4945e6 Merge pull request #31 from onyx-dot-app/dane/ll-session-ttl
feat(sessions): TTL enforcement and crash-safe cleanup
2026-05-06 13:48:14 -07:00
Dane Urban 352cb5b918 style(executor_docker): use f-string for docker ps --format value
Replaces a string-concatenation expression with an f-string so the
Go-template format string can be read in one go. The doubled braces
(``{{{{`` / ``}}}}``) escape to literal ``{{`` / ``}}`` inside the
f-string, matching Docker's template syntax. Output is byte-identical
to the previous concatenation.

Addresses review feedback on PR #31.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-06 13:42:38 -07:00
Dane Urban a9cbd51fb5 feat(sessions): TTL enforcement and crash-safe cleanup
Sessions now carry an explicit TTL and are guaranteed to be torn down at
or before that deadline even if the API service crashes.

* CreateSessionRequest gains ``ttl_seconds`` (default 900s, max 24h);
  CreateSessionResponse adds the absolute ``expires_at`` timestamp.
* Docker session containers are launched with ``--rm`` and ``sleep <ttl>``
  so the container self-destructs at the deadline regardless of whether
  the API service is alive. The TTL also goes onto the container as the
  ``code-interpreter.expires-at`` label for the reaper.
* Kubernetes session pods set ``activeDeadlineSeconds=ttl`` so kubelet
  stops the executor container at the deadline; the deadline timestamp
  is also stored as a pod annotation so the reaper knows when to delete.
* A new background reaper task (in main.py's lifespan) runs once at
  startup — handling crash recovery for any sessions whose TTL elapsed
  while the service was down — and then every 30s thereafter.
* Both backends implement ``reap_expired_sessions`` (label-filtered
  list followed by per-session deletion) so the reaper is backend-agnostic.

Tests cover TTL bounds at the route layer, the active_deadline /
expires-at metadata on each backend, and reaper behavior under happy
path, missing annotation, invalid annotation, list failure, and partial
delete-failure scenarios.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-06 13:39:29 -07:00
Danelegend 2c2207f01f Merge pull request #30 from onyx-dot-app/dane/ll-session-create-delete
feat(sessions): long-lived session pods with manual lifecycle
2026-05-06 13:37:37 -07:00
Dane Urban e7b077a901 feat(sessions): long-lived session pods with manual lifecycle
Adds two new routes:

* POST /v1/sessions       creates a long-lived executor pod/container,
                          optionally pre-staging files from /v1/files.
* DELETE /v1/sessions/{id} tears the session down.

Both Docker and Kubernetes backends are supported. Sessions are labeled
``app=code-interpreter,component=session`` so they can be enumerated for
debugging, and named ``code-session-<uuid>`` so the delete path can
sanity-check that callers aren't accidentally targeting other resources.

Known limitation: this PR has no automatic cleanup. A session that the
caller forgets to DELETE will live for the configured idle window
(``SESSION_MAX_LIFETIME_SECONDS`` = 24h). The follow-up PR adds per-session
TTL enforcement plus a reaper for crash recovery.

Tests cover both backends and the route layer (success, 404 mapping,
501 mapping, file resolution, prefix-based safety check on delete).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-06 13:36:11 -07:00
Danelegend 977a1e4392 Merge pull request #29 from onyx-dot-app/dane/ll-session-refactor
refactor(executors): extract reusable primitives
2026-05-06 11:27:54 -07:00