base64 pre-config option

Open
#552 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
python
Domain
backend

Research direction

Start by reading cattrs.preconf.json.make_converter() and cattrs.preconf.ujson.make_converter(), then trace how their Base85 handling is configured. Check the surrounding preconfigured converter code and existing tests, if present; done means the requested Base64 configuration is available consistently for both entry points and its behavior is covered.

Written by the indexing model from the issue text.

Description

  • 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()
Dominant language
Python
Stars
1.1k
Forks
159
Avg merge
12h 21m
Merged PRs (30d)
6

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from python-attrs/cattrs

All issues in python-attrs/cattrs

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.