be4eb5fd96
Migrates the Python SDK's packaging and CI from Poetry to [uv](https://docs.astral.sh/uv/): `pyproject.toml` is converted to PEP 621 metadata using uv's native `uv_build` backend (verified to produce a byte-equivalent wheel containing both `e2b` and `e2b_connect`), `poetry.lock` is replaced with `uv.lock`, and the `Makefile`, `package.json` scripts, `.tool-versions`, `CLAUDE.md`, and all six GitHub workflows now use `uv` (`astral-sh/setup-uv` + `uv sync`/`build`/`version`/`publish`). It also drops the now-redundant explicit sync steps (since `uv run` auto-syncs) and removes the orphaned `pydoc-markdown` dev dependency, whose only consumer was deleted long ago — trimming 58 packages from the dev lockfile. ## Usage ```sh cd packages/python-sdk uv sync # install deps (replaces `poetry install`) uv run pytest # run tests uv build # build the wheel/sdist make lint # ruff (run via `uv run`) ``` No user-facing SDK change — packaging/tooling only — so no changeset is included; the published package contents are unchanged. --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
60 lines
1.7 KiB
Makefile
60 lines
1.7 KiB
Makefile
ROOT_DIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))/../..)
|
|
|
|
generate-api:
|
|
python $(ROOT_DIR)/spec/remove_extra_tags.py sandboxes snapshots templates tags volumes
|
|
openapi-python-client generate --output-path $(ROOT_DIR)/packages/python-sdk/e2b/api/api --overwrite --path $(ROOT_DIR)/spec/openapi_generated.yml
|
|
rm -rf e2b/api/client
|
|
mv e2b/api/api/e2b_api_client e2b/api/client
|
|
rm -rf e2b/api/api
|
|
ruff format .
|
|
|
|
generate-volume-api:
|
|
openapi-python-client generate --output-path $(ROOT_DIR)/packages/python-sdk/e2b/volume/api --overwrite --path $(ROOT_DIR)/spec/openapi-volumecontent.yml
|
|
rm -rf e2b/volume/client
|
|
mv e2b/volume/api/e2b_api_client e2b/volume/client
|
|
rm -rf e2b/volume/api
|
|
ruff format .
|
|
|
|
generate-envd:
|
|
if [ ! -f "/go/bin/protoc-gen-connect-python" ]; then \
|
|
$(MAKE) -C $(ROOT_DIR)/packages/connect-python build; \
|
|
fi
|
|
|
|
cd $(ROOT_DIR)/spec/envd && pwd && buf generate --template buf-python.gen.yaml
|
|
./scripts/fix-python-pb.sh
|
|
|
|
ruff format .
|
|
|
|
generate: generate-api generate-envd generate-mcp generate-volume-api
|
|
|
|
# Install the code-generation toolchain into the uv env. After this, run the
|
|
# generators locally with e.g. `uv run make generate-api`.
|
|
init:
|
|
uv sync --group codegen
|
|
|
|
typecheck:
|
|
ty check
|
|
|
|
lint:
|
|
ruff check .
|
|
ruff format --check .
|
|
|
|
format:
|
|
ruff format .
|
|
|
|
generate-mcp:
|
|
datamodel-codegen \
|
|
--input ../../spec/mcp-server.json \
|
|
--input-file-type jsonschema \
|
|
--output e2b/sandbox/mcp.py \
|
|
--output-model-type typing.TypedDict \
|
|
--target-python-version 3.10 \
|
|
--class-name McpServer \
|
|
--use-field-description \
|
|
--disable-timestamp \
|
|
--extra-fields forbid
|
|
|
|
.PHONY: test
|
|
test:
|
|
uv run pytest --verbose --numprocesses=4
|