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

Pydantic-CLI 9.0.0 displays help incorrectly #73

Open
dimitri-apostal opened this issue Nov 27, 2024 · 2 comments
Open

Pydantic-CLI 9.0.0 displays help incorrectly #73

dimitri-apostal opened this issue Nov 27, 2024 · 2 comments

Comments

@dimitri-apostal
Copy link

When using the function pydantic_class_to_parser, the help function wraps everything in Field().

Desired Output

  -C CHECK, --check CHECK
                        Check plan file or plan requirements and exit. Value (CHECK) is p/plan or r/require (case insensitive), for instance: -C plan or -C
                        P (type:str|NoneType default:None)

Broken Output

  -C CHECK, --check CHECK
                        Field(annotation=Union[str, NoneType], required=False, default=None, description='Check plan file or plan requirements and exit.
                        Value (CHECK) is p/plan or r/require (case insensitive), for instance: -C plan or -C P', json_schema_extra={'cli': ['-C', '--
                        check']}, metadata=[_PydanticGeneralMetadata(pattern='^(?i:p|plan|r|require)')])

I'm pretty sure this is what is causing the issue.

Rolling back to 9.0.0 resolves the issue.

@mpkocher
Copy link
Owner

Please post a minimum runnable example.

There's an effort to purposely use Pydantic itself to output the display of the Field and for pydantic-cli to be a passthrough layer. Otherwise it turns into this fragile translation layer (see previous commits/versions).

Here's more context.

#69

And it is challenging to get this to work for everyone's specific case.

#55

@dimitri-apostal
Copy link
Author

Ok, I will post an example when I'm back from the US holidays this week.

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