Skip to content

base64 pre-config option #552

@AstraLuma

Description

@AstraLuma
  • 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()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions