#Call modules from an standalone program using the SDK

1 messages ยท Page 1 of 1 (latest)

high needle
devout sentinel
#

There is a hidden command dagger client which you can use like this:

dagger client add --generator=python ./path/to/your/client

high needle
#

Thanks!

high needle
#

Just fyi it seemed to work when generating a go client, but with python:

Error: failed to export client: input: moduleSource.withClient.generatedContextDirectory failed to run client generator python: failed to get required client generation files: failed to get required client generation files: select: Select: PythonSdk has no such field: "requiredClientGenerationFiles"
#

Looks like typescript has it.

devout sentinel
#

cc @ocean ruin who is the mastermind behind this feature ๐Ÿ™‚ ๐Ÿ‘†

high needle
#

Also, not sure if this is on the roadmap but it does not look like cross language generation works. When trying to generate a typescript from a go module it:

 Container.withDirectory(
    โ”‚ โ”‚ directory: Host.directory(include: ["./dagger.json", "./**/*", "package.json", "tsconfig.json"], path: "/home/hanleyc/test/dagger"): Directory!
    โ”‚ โ”‚ path: "/module"
    โ”‚ ): Container!
    Container.withWorkdir(path: "/module"): Container!
    Container.withExec(args: ["/codegen", "--lang", "typescript", "--output", "./test", "--introspection-json-path", "/schema.json", "--dev=false", "--client-only"], experimentalPrivilegedNesting: true): Container!
    Container.withExec(args: ["npm", "pkg", "set", "dependencies[@dagger.io/dagger]=@dagger.io/dagger"]): Container!
npm error code ENOENT
npm error syscall open
npm error path /module/package.json
npm error errno -2
npm error enoent Could not read package.json: Error: ENOENT: no such file or directory, open '/module/package.json'
npm error enoent This is related to npm not being able to find a file.
npm error enoent
! process "npm pkg set dependencies[@dagger.io/dagger]=@dagger.io/dagger" did not complete successfully: exit code: 254

You can tell it is attempting to mount package.json from the host directory, which won't exist in a go module.

Glad to see some progress on this though!

ocean ruin