python-jsonschema / jsonschema

An implementation of the JSON Schema specification for Python
https://python-jsonschema.readthedocs.io
MIT License
4.52k stars 574 forks source link

FR: Variant without Rust dependencies #1270

Closed hjfreyer closed 3 weeks ago

hjfreyer commented 1 month ago

Hey there!

I'm in the market for a python jsonschema implementation to use in a large OSS project with strict requirements to vendor-in all source and build from scratch. This package seems far better in terms of API and implementation than other options in this space, and I was getting ready to start using it when I discovered the cargo dependency.

Unfortunately, invoking cargo in our build is a non-starter. However, looking through the code, it seems like the rpds dependency is fairly isolated. In theory a pure python implementation of HashTrie{Set,Map} would do the job? I imagine performance would suffer, but it would make the library available to more customers.

If this isn't a thing you want to support, I understand. I just wanted to let you know you'd gain a customer if you do!

Thanks

Julian commented 1 month ago

Hi there. Thanks for the issue.

A pure python fallback is on the ever-long TODO list but fairly low priority at the minute honestly, especially given that the packaging ecosystem doesn't yet have a good way to express eager dependencies (essentially all CPython users should get the rust dep unless they opt out, and there's no way to express that yet). Of course on the off chance you're using PyPy (which is the main reason to reintroduce the pure python dep) then you would be good (as my intention is to default to that on PyPy). But yeah that's why this hasn't been a priority yet (along with me having 1000 other things to work on for better or worse).