brentyi / tyro

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

Regression in help docstring #123

Closed kevinddchen closed 7 months ago

kevinddchen commented 7 months ago

Consider the following snippet:

# a.py

import dataclasses

import tyro

@dataclasses.dataclass
class Foo:
    """Foo docstring"""

    pass

def main(foo: Foo) -> None:
    """Main docstring"""

    pass

if __name__ == "__main__":
    tyro.cli(main)

If I run python a.py -h on tyro==0.6.6, I get the following:

usage: a.py [-h]

Main docstring

╭─ options ─────────────────────────────────────────╮
│ -h, --help        show this help message and exit │
╰───────────────────────────────────────────────────╯

But if I run the same command on tyro==0.7.0 or any other version after that, including the most recent master, I get the following:

usage: a.py [-h]

Foo docstring

╭─ options ─────────────────────────────────────────╮
│ -h, --help        show this help message and exit │
╰───────────────────────────────────────────────────╯

I will try to find a fix now, but just checking that this is indeed a regression.

kevinddchen commented 7 months ago

Regression at commit d242ddacb31e9a35e8b1cad24aa85e93ba9e476b

kevinddchen commented 7 months ago

This may be fixed by #124.