I have minor issue with interfaces..
I would like to have something like that:
In remote module have:
@interface
class Provisioner(typing.Protocol):
@function
async def prepare(self, cont: dagger.Container) -> dagger.Container: ...
Then some function that would take
@object_type
class Remoter:
@function
async def build_all(
self,
prov Provisioner
) -> dagger.Directory:
...
And in the local part where I use it I would like to have implementation of the interface
@object_type
class Example:
@function
async def prepare(self, cont: dagger.Container) -> dagger.Container:
return (cont
.with_exec(["apk", "add", "--no-cache", "git", "openssh-client", "ca-certificates"]))
and call build_all with my example provisioner.. But seems its impossible? how to convert local Example class to Provisioner?
I would like it to work like that..
My local module (that would call remote one with interface).
@object_type
class Example:
@function
async def prepare(self, cont: dagger.Container) -> dagger.Container:
return (cont
.with_exec(["apk", "add", "--no-cache", "git", "openssh-client", "ca-certificates"]))
@object_type
class Caller:
@function
async def build_local(self, cont: dagger.Container) -> dagger.Container:
provisioner = Example() // Cannot do as_remoter_provisioner on that local object, how to make that object "managed" so it would have all those generated magic methods..
return await dag.remoter().build_all(provisioner.as_remoter_provisioner())