You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be nice if we could add support for bytes in order to use it in contexts where bytes are expected (e.g. base64 encode/decode, password hashing, etc.)
Wanted Solution
Support for bytes type. Currently typer says: RuntimeError: Type not yet supported: <class 'bytes'>
The greatest hassle with this solution is remembering to add `parser=parse_bytes' to all the Bytes arguments. So, could be worth natively supporting it.
This would also be useful for my use cases (firmware / transport protocols). Though, instead of supporting "bytes" directly, wouldn't we need to support "encodings"?
For example, a type specified as:
utf-8 would take a string end encode it to utf-8 bytes
base64 would encode base64 bytes
hex would use bytes from_hex (or whatever that method is called
etc
It seems to me that the only arg that would make sense for simply "bytes" would be python byte literals, with all their downsides.
Would be good to scope this to common encodings since there are thousands.
First Check
Commit to Help
Example Code
Description
It would be nice if we could add support for bytes in order to use it in contexts where bytes are expected (e.g. base64 encode/decode, password hashing, etc.)
Wanted Solution
Support for bytes type. Currently
typer
says:RuntimeError: Type not yet supported: <class 'bytes'>
Wanted Code
Alternatives
Always use encode/decode methods.
Operating System
macOS
Operating System Details
No response
Typer Version
0.7.0
Python Version
3.11.1
Additional Context
No response
The text was updated successfully, but these errors were encountered: