Hello Prefect! :wave: I have a classic deployment...
# ask-community
m
Hello Prefect! 👋 I have a classic deployment like this in the screenshot. The variables in input are defined with a Pydantic class as usual. I like to see them populated like here, but I don't really want to change them. Is it possible to make variables readonly?
For example,
Dbt Project Dir
could be greyed out but visible. So I can see it, but I can't modify it.
b
Hey Mattia! I'm not sure if that's something that we support yet 🤔 . FWIW, I tried creating a frozen dataclass and I could still override the parameters. Maybe there's something I'm missing here though.
Copy code
from pydantic import BaseModel, Field
from prefect import flow

class User(BaseModel):
    name: str = Field(frozen=True)

@flow(log_prints=True)
def hello_world(user: User):
    print(f"Hello {user.name} from Prefect! 🤗")

if __name__ == "__main__":
    user = User(name="Friend")
    hello_world.serve(
        name="hello-world-deployment",
        tags=["example"],
        parameters={"user": user},
    )
Mind sharing a bit more about why you'd like to grey out these values? Could be a nice feature request!
m
Hi @Bianca Hoch, thank you for trying! In our environment, we always have deployments with multiple of these inputs that we never change. They are defined, hardcoded, in code, but we like to have them there in the UI to have a confirmation that the settings are correct. Now, I am onboarding a less technical person who is a bit concerned by such parameters. Having the option to make them readonly would make both happy 🙂
gratitude thank you 1
nod 1