Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

disable typing options for some entier classes? #116

Open
jizongFox opened this issue Jan 17, 2024 · 1 comment
Open

disable typing options for some entier classes? #116

jizongFox opened this issue Jan 17, 2024 · 1 comment

Comments

@jizongFox
Copy link

jizongFox commented Jan 17, 2024

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
Copy link
Owner

brentyi commented Jan 17, 2024

Hi!

A few quick questions:

  • Are you on 0.6.4 of tyro? If not, could you try upgrading*?
  • Do you have any numbers on how slow is slow, and how many arguments you're creating? It would be helpful to know which part of tyro is the bottleneck, for example, and how it compares to things like import times.
  • Are you using subcommands, or just nesting dataclasses?

*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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants