Skip to content

Replace json/ujson with msgspec - #98

Open
rschlaikjer wants to merge 8 commits into
masterfrom
rs-migrate-msgspec
Open

Replace json/ujson with msgspec#98
rschlaikjer wants to merge 8 commits into
masterfrom
rs-migrate-msgspec

Conversation

@rschlaikjer

@rschlaikjer rschlaikjer commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Replace json/ujson usage with msgspec for performance.

In the event that types are not serializable with msgspec, the custom encoder hook will fall back to using ujson for those specific types.

@rschlaikjer

Copy link
Copy Markdown
Contributor Author

Autotester: https://tiny.mujin.co.jp/g2tl7

@woswos

woswos commented Aug 3, 2026

Copy link
Copy Markdown
Member

Could you update the PR description to explain this change?

Rename EncodeJson/DecodeJson to EncodeJSON/DecodeJSON and have DecodeJSON
raise APIServerError instead of ValueError, matching the rest of the
response-parsing paths. Also restore alphabetical order in pyproject deps.
@woswos
woswos self-requested a review August 7, 2026 04:06
Barkin Simsek and others added 4 commits August 7, 2026 14:30
… message

DecodeJSON now decodes bytes before formatting them into the APIServerError
message, truncates the body at 1000 characters and logs like the other decode
sites. CallAPI uses it instead of duplicating the try/except.

Also drop the stale python 2 comment on _MergeDicts.
…wrappers

Make the wrappers the single choke point for JSON handling instead of
letting internal call sites reach for the msgspec codecs directly, and
document the non-ASCII wire encoding change in the changelog.
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

Successfully merging this pull request may close these issues.

2 participants