#! 'Client' object has no attribute 'K3S' using daggerverse k3s module

1 messages · Page 1 of 1 (latest)

wild lance
#

Hi, I want to use this module :

! 'Client' object has no attribute 'K3S'

but with python SDK. My linter does not recongnize it and dagger through thhis error too :
! 'Client' object has no attribute 'k3s'

#
from typing import Annotated, Optional

import dagger
from dagger import Doc, dag, function, object_type


@object_type
class HelloDagger:
    @function
    def deploy_nginx(self) -> str:
        """Deploy k3s server and install nginx helm chart."""
        return dag.k3s("name").container()
#

dagger/client/gen.py add K3S type but still... I cannot run this command.

coral orbit
slim cosmos
coral orbit
slim cosmos
#

Not surprising to me, as Python's codegen is written in Python and daggerverse is written in Go, right? Basically not using the same library for converting names, leading to drift. We need to check if the functions used in conversions in daggerverse match the target languages' codegen naming conversion rules.

slim cosmos
wild lance
#

Hi, thanks for looking at this.

dagger functions returns gives deploy-k-3-s with def deploy_k3s

The generated client is :


class Client(root)
... 
    def k3_s(self, name: str, *, image: str | None = "rancher/k3s:latest",) -> K3S:
        _args = [
            Arg("name", name),
            Arg("image", image, "rancher/k3s:latest"),
        ]
        _ctx = self._select("k3S", _args)
        return K3S(_ctx)
wild lance
#

so I try :

deploy_k3s(name: str) -> dagger.Container:
        return (
            dag.k3_s(name)
            .container()
    ) 

-> and get :
✘ .deployK3S(name: "test"): Container! 4.4s
! Method dagger.client.gen.Client.k3_s() parameter name="HelloDagger()" was expected to be of type <class 'str'>.