#Interesting. Moving it got me to a new
1 messages ยท Page 1 of 1 (latest)
We need to send out the Helder signal ๐ But it's late for him so won't ping right now
I might cheat off of the sdk real quick, there's probably some good stuff in there
Ayyy it's working. Had to put Proxy in quotes. Reference: https://github.com/dagger/dagger/blob/main/sdk/python/src/dagger/client/gen.py#L1058
Here's what I'm running into now with a simple repro. Started with the python generated by mod init and just put it in a class
dagger call -m github.com/kpenfound/dagger-modules/foo grep-dir --directory-arg . --pattern grep_dir
https://github.com/kpenfound/dagger-modules/blob/main/foo/src/main.py
On the first one, not sure if it has been clarified but the python file is evaluated in order top to bottom. So you need to define Proxy before it needs to be used, or do what I think you came up with which is put it in strings to make a forward reference. I prefer just defining before needed.
Looking at the last message.
That's interesting. I know where the error is coming from but I don't understand why it's doing that.
I mean, I think I do.
You're missing self in those methods.
If you don't need to access self properties, you can just define them as top-level functions though.
I'm not sure what you mean
fwiw, I first saw it calling my module from go: https://github.com/kpenfound/greetings-api/blob/zenith/ci/main.go#L46
calling this func:
https://github.com/kpenfound/dagger-modules/blob/main/proxy/src/main.py#L23-L27
Ah, like the first arg should be self
that was it, THANK YOU!
Yes. You must be getting an instance of Proxy() as the name in with_service?
That should error.
the fix: https://github.com/kpenfound/dagger-modules/commit/478da8a41d6ca6c9af7697e9fad202c50509ca17
๐
try changing:
ctr: Annotated[
dagger.Container,
Doc("Internal proxy container"),
] = field(default=init())
to
ctr: dagger.Container = field(default=init())
I ran into that yesterday too: #1168615042716020836 message
It's a bug in third party lib
I got a fix for that locally.
By the way, you should change default=init() to default=init. It's no issue here since the dagger types are immutable, but it can trip in other cases if you get used to it or others copy from it.
Thanks! Do you think that pattern is ok, or is there a better way to do a "setup" type step? In Go, I'd basically have each call first check if ctr == nil and initialize based on that
It's ok to have defaults in Python, just have to be careful that they're immutable. If not, it's best to default to None and do if ctr is None like you say. In the class args it's less of an issue because you have the callable factory. Meaning instead of values: list[str] = [] you do values: list[str] = field(default=list).
Dagger types are immutable.