brentyi / tyro

CLI interfaces & config objects, from types
https://brentyi.github.io/tyro
MIT License
467 stars 23 forks source link

disable typing options for some entier classes? #116

Open jizongFox opened 8 months ago

jizongFox commented 8 months ago

Hello team,

thank you for the wonderful work. I am wondering if I can disable the typing options for some whole classes, where they are fixed during all the process. image

For example, for data.split.chunk-split ...., I dont want them to appear to the cmd and indeed we have many many chunks, which makes the parser extremely slow.

I understand I can put Suppress[ ] as a hint but it cannot speed up the parser. Is there an alternative way?

Best

brentyi commented 8 months ago

Hi!

A few quick questions:

*As of 0.6.4, if we write:

from dataclasses import dataclass

import tyro

@dataclass(frozen=True)
class Child:
    field: int

@dataclass(frozen=True)
class Config:
    child: tyro.conf.Suppress[Child] = Child(3)

tyro.cli(Config)

We shouldn't be populating (suppressed) arguments for Child anymore.