#codegen q
1 messages · Page 1 of 1 (latest)
For a given environment there is codegen for its own functions, and for its dependencies’ functions. Does it always get mashed together? What if I want codegen only for eg. an external caller, can I get codegen for only the exposed functions without exposing the dependencies?
When you run codegen for a given environment you get bindings only for your direct dependencies
There aren't bindings to call yourself (see this thread: https://github.com/dagger/dagger/pull/5659#discussion_r1309451104) and there aren't bindings for your transitive dependencies
Both of those can be changed if desired. Codegen for transitive dependencies would be simple (I just question if that would be the expectation or not). Bindings for yourself is possible but extremely thorny to get right in terms of not creating catch-22 situations that become incredible frustrating in terms of DX (we did that back in cloak days and immediately ran into those frustrations 🙂 )
What if I want codegen only for eg. an external caller, can I get codegen for only the exposed functions without exposing the dependencies?
Let me know if that answers this question, I'm not 100% sure I am following the question
yeah I think it does 🙂 I’m thinking of a dagger script command that would invoke a python/node/go repl ready to go with the target environment/module’s codegen loaded
I think under the hood it would be an ephemeral env with the target as only dependency?
Yeah that sounds right, slight impediment is that we currently do codegen in the CLI, for that we'd want to do codegen server-side.
We actually originally did codegen server-side in cloak but undid it. We can just redo it now 🙂
It would avoid the catch-22 situations since it doesn't involve writing the env code; if you env doesn't compile then you just can't open a shell to it
go repl
Not sure that exists, but we can create the equivalent of it
Also I wouldn't forget the other ideas buried in some discord thread somewhere around making every entrypoint of the env invokable from a shell. So if there's a function named Foo in my env and I run dagger shell on the env, I get dropped into a shell where I can literally run foo (with flags if needed)
Not contradictory with a language specific repl at all, just complementory. Particularly for languages that don't have a repl like go
there is a 3d party thing 🙂
Neat!
there are several actually 😁 https://github.com/x-motemen/gore
yeah codegen server side makes sense to me since it’s per-sdk work right?
Yeah, it's not actually that much to move it around, it's just code that we need to call, doesn't really matter where. Besides the fact that server-side gives us the benefits of caching, which is just a plus
I guess the go.dev/play is a similar-ish concept. Not sure how open-source that is, but probably another case of there being many implementations
really our own api playground (with native language support courtesy of @deep mulch and @pseudo totem ) is a web version of the same thing