Skip to content

Migrate from ujson to orjson - #2185

Open
jjardon wants to merge 1 commit into
apache:masterfrom
jjardon:jjardon/orjson
Open

Migrate from ujson to orjson#2185
jjardon wants to merge 1 commit into
apache:masterfrom
jjardon:jjardon/orjson

Conversation

@jjardon

@jjardon jjardon commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

ujson is in maintenance-only mode and its own maintainers recommend migrating to orjson. This change replaces the dependency and updates the single call site in _cachekey.py.

Key differences handled:

  • orjson.dumps() returns bytes (so the extra .encode("utf-8") is removed)
  • sort_keys=True becomes option=orjson.OPT_SORT_KEYS
  • escape_forward_slashes=False is the default behaviour of orjson

Tested successfully at https://github.com/jjardon/buildstream-1/actions/runs/32796227859?pr=4

Fixes #2184

ujson is in maintenance-only mode and its own maintainers recommend
migrating to orjson. This change replaces the dependency and updates
the single call site in _cachekey.py.

Key differences handled:
- orjson.dumps() returns bytes (so the extra .encode("utf-8") is removed)
- sort_keys=True becomes option=orjson.OPT_SORT_KEYS
- escape_forward_slashes=False is the default behaviour of orjson
Comment thread src/buildstream/node.pyx

# This is in order to ensure we never add a `Node` to a cache key
# as ujson will try to convert objects if they have a `__json__`
# as orjson will try to convert objects if they have a `__json__`

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't see anything to this effect in orjson repository.

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.

Find replacement for ujson (ujson is in maintenance-only mode)

2 participants