@@ -4,22 +4,36 @@ The `RunloopSDK` builds on top of the underlying REST client and provides a Pyth
44
55## Table of Contents
66
7- - [ Installation] ( #installation )
8- - [ Quickstart (synchronous)] ( #quickstart-synchronous )
9- - [ Quickstart (asynchronous)] ( #quickstart-asynchronous )
10- - [ Core Concepts] ( #core-concepts )
11- - [ Devbox] ( #devbox )
12- - [ Blueprint] ( #blueprint )
13- - [ Snapshot] ( #snapshot )
14- - [ StorageObject] ( #storageobject )
15- - [ Mounting Storage Objects to Devboxes] ( #mounting-storage-objects-to-devboxes )
16- - [ Accessing the Underlying REST Client] ( #accessing-the-underlying-rest-client )
17- - [ Error Handling] ( #error-handling )
18- - [ Advanced Configuration] ( #advanced-configuration )
19- - [ Async Usage] ( #async-usage )
20- - [ Polling Configuration] ( #polling-configuration )
21- - [ Complete API Reference] ( #complete-api-reference )
22- - [ Feedback] ( #feedback )
7+ - [ Runloop SDK – Python Object-Oriented Client] ( #runloop-sdk--python-object-oriented-client )
8+ - [ Table of Contents] ( #table-of-contents )
9+ - [ Installation] ( #installation )
10+ - [ Quickstart (synchronous)] ( #quickstart-synchronous )
11+ - [ Quickstart (asynchronous)] ( #quickstart-asynchronous )
12+ - [ Core Concepts] ( #core-concepts )
13+ - [ RunloopSDK] ( #runloopsdk )
14+ - [ Available Resources] ( #available-resources )
15+ - [ Devbox] ( #devbox )
16+ - [ Command Execution] ( #command-execution )
17+ - [ Execution Management] ( #execution-management )
18+ - [ Execution Results] ( #execution-results )
19+ - [ Streaming Command Output] ( #streaming-command-output )
20+ - [ File Operations] ( #file-operations )
21+ - [ Network Operations] ( #network-operations )
22+ - [ Snapshot Operations] ( #snapshot-operations )
23+ - [ Devbox Lifecycle Management] ( #devbox-lifecycle-management )
24+ - [ Context Manager Support] ( #context-manager-support )
25+ - [ Blueprint] ( #blueprint )
26+ - [ Snapshot] ( #snapshot )
27+ - [ StorageObject] ( #storageobject )
28+ - [ Storage Object Upload Helpers] ( #storage-object-upload-helpers )
29+ - [ Mounting Storage Objects to Devboxes] ( #mounting-storage-objects-to-devboxes )
30+ - [ Accessing the Underlying REST Client] ( #accessing-the-underlying-rest-client )
31+ - [ Error Handling] ( #error-handling )
32+ - [ Advanced Configuration] ( #advanced-configuration )
33+ - [ Async Usage] ( #async-usage )
34+ - [ Polling Configuration] ( #polling-configuration )
35+ - [ Complete API Reference] ( #complete-api-reference )
36+ - [ Feedback] ( #feedback )
2337
2438## Installation
2539
@@ -409,6 +423,44 @@ blueprint = runloop.blueprint.create(
409423 system_setup_commands = [" pip install numpy pandas" ],
410424)
411425
426+ # Or create a blueprint with a Docker build context from a local directory
427+ from pathlib import Path
428+ from runloop_api_client.lib.context_loader import build_docker_context_tar
429+
430+ context_root = Path(" ./my-app" )
431+ tar_bytes = build_docker_context_tar(context_root)
432+
433+ build_ctx_obj = runloop.storage_object.upload_from_bytes(
434+ data = tar_bytes,
435+ name = " my-app-context.tar.gz" ,
436+ content_type = " tgz" ,
437+ )
438+
439+ shared_root = Path(" ./shared-lib" )
440+ shared_tar = build_docker_context_tar(shared_root)
441+
442+ shared_ctx_obj = runloop.storage_object.upload_from_bytes(
443+ data = shared_tar,
444+ name = " shared-lib-context.tar.gz" ,
445+ content_type = " tgz" ,
446+ )
447+
448+ blueprint_with_context = runloop.blueprint.create(
449+ name = " my-blueprint-with-context" ,
450+ dockerfile = \"\"\"\
451+ FROM ubuntu:22.04
452+ WORKDIR / app
453+ # use the named context
454+ RUN -- mount = type = bind,from = shared,source = / ,target = / shared ls - R / shared
455+ \"\"\",
456+ # Primary build context
457+ build_context = build_ctx_obj.as_build_context(),
458+ # Additional named build contexts (for Docker buildx-style usage)
459+ named_build_contexts = {
460+ " shared" : shared_ctx_obj.as_build_context(),
461+ },
462+ )
463+
412464# Or get an existing one
413465blueprint = runloop.blueprint.from_id(blueprint_id = " bpt_123" )
414466
0 commit comments