Functions for building the runtime module for the Python SDK. The server interacts directly with the ModuleRuntime and Codegen functions. The others were built to be composable and chainable to facilitate the creation of extension modules (custom SDKs that depend on this one).
| 86 | // The others were built to be composable and chainable to facilitate the |
| 87 | // creation of extension modules (custom SDKs that depend on this one). |
| 88 | type PythonSdk struct { |
| 89 | // Directory with the Python SDK source code |
| 90 | SdkSourceDir *dagger.Directory |
| 91 | |
| 92 | // Resulting container after each composing step |
| 93 | Container *dagger.Container |
| 94 | |
| 95 | // Whether the module runtime should run in debug mode. |
| 96 | Debug bool |
| 97 | |
| 98 | // The original module's name |
| 99 | ModName string |
| 100 | |
| 101 | // The normalized python distribution package name (in pyproject.toml) |
| 102 | ProjectName string |
| 103 | |
| 104 | // The normalized python import package name (in the filesystem) |
| 105 | PackageName string |
| 106 | |
| 107 | // The normalized main object name in Python |
| 108 | MainObjectName string |
| 109 | |
| 110 | // The source needed to load and run a module |
| 111 | ModSource *dagger.ModuleSource |
| 112 | |
| 113 | // ContextDir is a copy of the context directory from the module source |
| 114 | // |
| 115 | // We add files to this directory, always joining paths with the source's |
| 116 | // subpath. We could use modSource.Directory("") for that if it was read-only, |
| 117 | // but since we have to mount the context directory in the end, rather than |
| 118 | // mounting the context dir and then mounting the forked source dir on top, |
| 119 | // we fork the context dir instead so there's only one mount in the end. |
| 120 | ContextDir *dagger.Directory |
| 121 | |
| 122 | // ContextDirPath is a unique host path for the module being loaded |
| 123 | // |
| 124 | // HACK: this property is computed as a unique value for a ModuleSource to |
| 125 | // provide a unique path on the filesystem. This is because the uv cache |
| 126 | // uses hashes of source paths - so we need to have something unique, or we |
| 127 | // can get very real conflicts in the uv cache. |
| 128 | ContextDirPath string |
| 129 | |
| 130 | // Relative path from the context directory to the source directory |
| 131 | SubPath string |
| 132 | |
| 133 | // Relative path to vendor client library into |
| 134 | VendorPath string |
| 135 | |
| 136 | // True if the module is new and we need to create files from the template |
| 137 | // |
| 138 | // It's assumed that this is the case if there's no pyproject.toml file. |
| 139 | IsInit bool |
| 140 | |
| 141 | // Discovery holds the logic for getting more information from the target module. |
| 142 | // +private |
| 143 | Discovery *Discovery |
| 144 | } |
| 145 |
nothing calls this directly
no outgoing calls
no test coverage detected