Skip to content

Introduce orjson as optional dependency #662

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

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open

Conversation

ff137
Copy link
Contributor

@ff137 ff137 commented Feb 13, 2025

Relates to #661

  • ✨ Implements a JsonUtil module to handle the functionality of swapping between json or orjson

    • handles custom kwargs previously being passed to json
    • implements JsonUtil.dump_bytes to avoid the numerous instances of encoding and decoding strings unnecessarily (since orjson returns bytes by default)
  • 🎨 Replaces import json with from nats.json_util import JsonUtil as json

  • ➕ Adds orjson optional dependency to pyproject.toml and setup.py

  • ✅ Updates tests to accommodate changes, and the fact that orjson.dumps does not include spaces.

  • 👷 Add orjson runs to travis jobs (for python 3.11 -> 3.13)

@ff137
Copy link
Contributor Author

ff137 commented Feb 13, 2025

Looks like some dev dependencies require >=py3.9 after I updated the lock file

@ff137
Copy link
Contributor Author

ff137 commented Feb 13, 2025

Might want to do a Pipfile update + dropping 3.8 in a separate PR

Workflows complain about "ModuleNotFoundError: No module named 'tomli'"
Not sure what's the right solution here (not that familiar with Pipfile)

@ff137
Copy link
Contributor Author

ff137 commented Feb 25, 2025

The tests fail with ModuleNotFoundError: No module named 'tomli'

Can anyone help understand how to fix this?

cc active contributors: @caspervonb @wallyqs

@ff137
Copy link
Contributor Author

ff137 commented Mar 10, 2025

Can I please get some help with this? @wallyqs @caspervonb

I'd like to contribute some other things to this repo too, so I'm mainly curious what the status of the project is -- are there pending contributions that will address the Pipfile update?

ff137 added 8 commits March 12, 2025 10:15
…json`

Signed-off-by: ff137 <ff137@proton.me>
Signed-off-by: ff137 <ff137@proton.me>
Signed-off-by: ff137 <ff137@proton.me>
Signed-off-by: ff137 <ff137@proton.me>
Signed-off-by: ff137 <ff137@proton.me>
Signed-off-by: ff137 <ff137@proton.me>
Signed-off-by: ff137 <ff137@proton.me>
ff137 added 5 commits March 12, 2025 10:23
Signed-off-by: ff137 <ff137@proton.me>
Signed-off-by: ff137 <ff137@proton.me>
Signed-off-by: ff137 <ff137@proton.me>
Signed-off-by: ff137 <ff137@proton.me>
Signed-off-by: ff137 <ff137@proton.me>
@ff137
Copy link
Contributor Author

ff137 commented Mar 12, 2025

The answer is that I should not have done a Pipfile lock update. Doing so essentially drops py3.8 support.

Signed-off-by: ff137 <ff137@proton.me>
@ff137
Copy link
Contributor Author

ff137 commented Mar 12, 2025

Success 🎉

@wallyqs @caspervonb sorry for the spam - now just want to say it's ready for review

ff137 added 2 commits March 27, 2025 17:36
Signed-off-by: ff137 <ff137@proton.me>
@ff137
Copy link
Contributor Author

ff137 commented Apr 9, 2025

Previous test failure was intermittent -- everything passes after an empty commit

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.

1 participant