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

base64 pre-config option #552

Open
AstraLuma opened this issue Jul 10, 2024 · 1 comment
Open

base64 pre-config option #552

AstraLuma opened this issue Jul 10, 2024 · 1 comment

Comments

@AstraLuma
Copy link

  • cattrs version: 23.2.3
  • Python version: 3.11
  • Operating System: Linux

Description

cattrs.preconf.json.make_converter() and cattrs.preconf.ujson.make_converter() use Base85.

While this is more efficient, it's bad for interop in the sense that base64 is much more common. (eg, both Browsers and Node have it built-in.) (Yes, Base85 code can be found for basically any language, but you can often assume that Base64 will be standard library.)

What I Did

try:
    from cattrs.preconf.ujson import make_converter
except ImportError:
    from cattrs.preconf.json import make_converter

converter = make_converter()
@Tinche
Copy link
Member

Tinche commented Jul 10, 2024

Yeah I agree, if I could go back in time I'd have it be base64 by default. A configuration option for these converters sounds good.

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