Package: engorgio
engorgioExpands function arguments into fields.https://user-images.githubusercontent.com/22648375/235036031-a9dc6589-e350-4a18-9114-6568cb362f74.mp4Installationpypi package to come if this works out, and I can decide
what to call it. I think its possible to do this for other
objects like dataclasses as well.pip install git+https://github.com/WaylonWalker/engorgio.giUsageSetup your models.fromtypingimportOptionalfrompydanticimportBaseModel,FieldclassAlpha(BaseModel):a:intclassColor(BaseModel):r:intg:intb:intalpha:AlphaclassHair(BaseModel):color:Colorlength:intclassPerson(BaseModel):name:strother_name:Optional[str]=Noneage:intemail:Optional[str]pet:str="dog"address:str=Field("123 Main St",description="Where the person calls home.")hair:HairNow create a typer command using your models.engorgiowill expand all of the typer fields
for you.importtyperfromengorgioimportengorgioapp=typer.Typer(name="engorgio",help="a demo app",)@app.command()@engorgiodefget_person(person:Person)->Person:"""Get a person's information."""fromrichimportprintprint(person)Get the help message.engorgio get-person --helpUsage: engorgio get-person [OPTIONS]Get a person's information.╭─ Options ──────────────────────────────────────────────────────────────────────────────╮│ --help          Show this message and exit.                                            │╰────────────────────────────────────────────────────────────────────────────────────────╯╭─ Person ───────────────────────────────────────────────────────────────────────────────╮│ *  --name              TEXT     [default: None] [required]                             ││    --other-name        TEXT     [default: None]                                        ││ *  --age               INTEGER  [default: None] [required]                             ││    --email             TEXT     [default: None]                                        ││    --pet               TEXT     [default: dog]                                         ││    --address           TEXT     Where the person calls home. [default: 123 Main St]    │╰────────────────────────────────────────────────────────────────────────────────────────╯╭─ Person.Hair ──────────────────────────────────────────────────────────────────────────╮│ *  --length        INTEGER  [default: None] [required]                                 │╰────────────────────────────────────────────────────────────────────────────────────────╯╭─ Person.Hair.Color ────────────────────────────────────────────────────────────────────╮│ *  --r        INTEGER  [default: None] [required]                                      ││ *  --g        INTEGER  [default: None] [required]                                      ││ *  --b        INTEGER  [default: None] [required]                                      │╰────────────────────────────────────────────────────────────────────────────────────────╯╭─ Person.Hair.Color.Alpha ──────────────────────────────────────────────────────────────╮│ *  --a        INTEGER  [default: None] [required]                                      │╰────────────────────────────────────────────────────────────────────────────────────────╯Calling the cli will print out a Person object.engorgio get-person --name me --age 1 --r 1 --g 1 --b 1 --a 1 --length 1Calling the cli while not specifying required arguments will automatically prompt for them.engorgio get-personLicenseengorgiois distributed under the terms of theMITlicense.