Dagger
Search

python-codegen

The goal is to ultimately generate the Python SDK client code, but for now, it's just a proof of concept, to explore the viability of the codegen module.

There's only two functions. Both return the list of object type names, but one is concurrent and the other is not. The concurrent version is more performant but much more verbose and not enough.

Installation

dagger install github.com/helderco/daggerverse/python-codegen@v0.1.2

Entrypoint

Return Type
PythonCodegen !
Example
func (m *myModule) example() *PythonCodegen  {
	return dag.
			PythonCodegen()
}
@function
def example() -> dag.PythonCodegen:
	return (
		dag.python_codegen()
	)
@func()
example(): PythonCodegen {
	return dag
		.pythonCodegen()
}

Types

PythonCodegen

Functions that use introspection from the codegen module

objects()

Get all object type names concurrently

Return Type
[String ! ] !
Example
dagger -m github.com/helderco/daggerverse/python-codegen@19fc1ebe1691563c260b86bd2ef58064560e4c31 call \
 objects
func (m *myModule) example(ctx context.Context) []string  {
	return dag.
			PythonCodegen().
			Objects(ctx)
}
@function
async def example() -> List[str]:
	return await (
		dag.python_codegen()
		.objects()
	)
@func()
async example(): Promise<string[]> {
	return dag
		.pythonCodegen()
		.objects()
}

objectsSync()

Simpler but less performant version of the objects function

Return Type
[String ! ] !
Example
dagger -m github.com/helderco/daggerverse/python-codegen@19fc1ebe1691563c260b86bd2ef58064560e4c31 call \
 objects-sync
func (m *myModule) example(ctx context.Context) []string  {
	return dag.
			PythonCodegen().
			ObjectsSync(ctx)
}
@function
async def example() -> List[str]:
	return await (
		dag.python_codegen()
		.objects_sync()
	)
@func()
async example(): Promise<string[]> {
	return dag
		.pythonCodegen()
		.objectsSync()
}