E2B/packages/python-sdk/scripts/fix-python-pb.sh

12 lines
403 B
Bash
Raw Permalink Normal View History

2024-06-07 21:35:34 +02:00
#!/bin/bash
rm -rf e2b/envd/__pycache__
rm -rf e2b/envd/filesystem/__pycache__
rm -rf e2b/envd/process/__pycache__
Make codegen robust and deterministic for js and python SDKs (#664) # Description This PR allows to codegen without worrying about your environment and dependencies for consistent outcomes in what code is generated from openapi and envd protobuf spec. Will generate files for `js-sdk` and `python-sdk` - [x] create Docker image with all the pinned deps needed to codegen - [x] create codegen script using this container with mapped volumes - [x] adapt Makefiles to this new approach - [x] adapt where we install the connect-python protobuf binary for this to work # Test ```sh make codegen # this command is similar to `make generate` but w/o the hassle Generating SDK code from openapi and envd spec cd packages/js-sdk && pnpm generate > e2b@1.2.1 generate /workspace/packages/js-sdk > python ./../../spec/remove_extra_tags.py sandboxes templates && openapi-typescript ../../spec/openapi_generated.yml -x api_key --arr ay-length --alphabetize --output src/api/schema.gen.ts โœจ openapi-typescript 7.6.1 ๐Ÿš€ ../../spec/openapi_generated.yml โ†’ src/api/schema.gen.ts [44.2ms] cd packages/js-sdk && pnpm generate-envd-api > e2b@1.2.1 generate-envd-api /workspace/packages/js-sdk > openapi-typescript ../../spec/envd/envd.yaml -x api_key --array-length --alphabetize --output src/envd/schema.gen.ts โœจ openapi-typescript 7.6.1 ๐Ÿš€ ../../spec/envd/envd.yaml โ†’ src/envd/schema.gen.ts [22.7ms] [...] cd packages/python-sdk && make generate-api All done! โœจ ๐Ÿฐ โœจ ``` --------- Co-authored-by: Jiri Sveceny <jiri.sveceny@icloud.com>
2025-04-07 17:00:31 +02:00
sed -i.bak 's/from\ process\ import/from e2b.envd.process import/g' e2b/envd/process/* e2b/envd/filesystem/*
sed -i.bak 's/from\ filesystem\ import/from e2b.envd.filesystem import/g' e2b/envd/process/* e2b/envd/filesystem/*
2024-06-07 21:35:34 +02:00
Make codegen robust and deterministic for js and python SDKs (#664) # Description This PR allows to codegen without worrying about your environment and dependencies for consistent outcomes in what code is generated from openapi and envd protobuf spec. Will generate files for `js-sdk` and `python-sdk` - [x] create Docker image with all the pinned deps needed to codegen - [x] create codegen script using this container with mapped volumes - [x] adapt Makefiles to this new approach - [x] adapt where we install the connect-python protobuf binary for this to work # Test ```sh make codegen # this command is similar to `make generate` but w/o the hassle Generating SDK code from openapi and envd spec cd packages/js-sdk && pnpm generate > e2b@1.2.1 generate /workspace/packages/js-sdk > python ./../../spec/remove_extra_tags.py sandboxes templates && openapi-typescript ../../spec/openapi_generated.yml -x api_key --arr ay-length --alphabetize --output src/api/schema.gen.ts โœจ openapi-typescript 7.6.1 ๐Ÿš€ ../../spec/openapi_generated.yml โ†’ src/api/schema.gen.ts [44.2ms] cd packages/js-sdk && pnpm generate-envd-api > e2b@1.2.1 generate-envd-api /workspace/packages/js-sdk > openapi-typescript ../../spec/envd/envd.yaml -x api_key --array-length --alphabetize --output src/envd/schema.gen.ts โœจ openapi-typescript 7.6.1 ๐Ÿš€ ../../spec/envd/envd.yaml โ†’ src/envd/schema.gen.ts [22.7ms] [...] cd packages/python-sdk && make generate-api All done! โœจ ๐Ÿฐ โœจ ``` --------- Co-authored-by: Jiri Sveceny <jiri.sveceny@icloud.com>
2025-04-07 17:00:31 +02:00
rm -f e2b/envd/process/*.bak
rm -f e2b/envd/filesystem/*.bak