feature: could you make `colorama` an optional dependenncy
Is your feature request related to a problem? Please describe.
AFAIK colorama is only used in the griffe CLI. We're using griffe programatically in pydantic-ai-slim where we care a lot about minimizing the SBOM.
Describe the solution you'd like
Would you consider removing the colorama dependency, or making it optional in a cli dependency group. 🙏
Yes good idea, I like reducing dependencies too 🙂
I see two options:
- Move library code into a new package called
griffelib. Havegriffedepend on it (as well ascolorama, like before). Re-expose the API fromgriffe. Library users like Pydantic-AI can start depending ongriffelibinstead ofgriffeto get minimal dependencies. No breaking changes. - Start putting
coloramaunder an extra. Small breaking change for users who use colored output.
I myself prefer option 1. Never got to write this blog post but that's how I want to architect my CLI/lib projects from now on:
<pkg>libstores the library only, with minimal dependencies<pkg>is the CLI, it depends on<pkg>liband maybe re-exposes its whole API- (optional)
<pkg>-tui(or<pkg>tuiwithout dash) provides a TUI (with Textual of course)
The reason I like this architecture is that users don't have to learn/know about extras. It makes commands shorter (uvx pkg command instead of uvx --from pkg[cli] pkg command, or uvx pkgtui instead of uvx --from pkg[tui] pkg tui). I find it intuitive that installing the main pkg package gets you both the library + CLI. In such cases as above, it also makes a smooth transition without breaking changes (so, takes into account the evolution of a project).
yup, option 1 makes sense.
It's roughly the same idea as how we have pydantic-ai-slim with all the application logic (includes the pydantic_ai module), but only minimal dependencies, then pydantic-ai is a dependency only library that includes pydantic-ai-slim and lots of dependencies.
I'm also +1 on the first option.
I filed #408 to track the migration. Any migration-related discussion is welcome there.