Best practices for managing Typer objects and callers at scale? #1152
Unanswered
manoelpqueiroz
asked this question in
Questions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
First Check
Commit to Help
Example Code
Description
Hi guys, I have been tinkering with Typer more recently and I would like to take the cleaniness that the library brings to the table to the next level.
Using type annotations is one of the key strengths of Typer, and like the example, which implements a main caller and an option to display the version, it's simple, doesn't need boilerplate and gets the job done.
And while the documentation provides a great suggestion to better organize complex programs, I've been wondering what are some other best practices when scaling the usage of Typer? 🤔
More specifically, declaring the
typer.Option
within theAnnotated
object within themain
function seems to be just one example of many in which function calls can become giant and verbose. Are there any suggestions on how to tackle simplifying and perhaps creating these objects elsewhere to later import and use in these definitions?This is more of a discussion about better usage of Typer and proper project structure to ensure things don't get out of control. I personally tend to think of storing the help messages for options in a single place should they need more text do be properly explained, but is this really the best way to do it? Shouldn't one store the actual whole
typer.Option
object instead? Where? Or perhaps there is a completely different way to approach this, so many possibilities!I'd like your thoughts on this, especially if you have dealt with Typer on a larger scale. Knowing the better ways to apply the tool in both small and large scales would be great for my future projects!
Operating System
Linux
Operating System Details
No response
Typer Version
0.15.1
Python Version
3.13.1
Additional Context
No response
Beta Was this translation helpful? Give feedback.
All reactions