pydantic / pydantic-core

Core validation logic for pydantic written in rust
MIT License
1.4k stars 232 forks source link

Question: Relevance of certain crates to this project #24

Closed v1gnesh closed 2 years ago

v1gnesh commented 2 years ago

Hello,

Seeing that this is being built in Rust, do you reckon crates such as

@sharksforarms's deku @jam1garner's binrw

.. can serve as a back-end, doing the declarative parsing work?

samuelcolvin commented 2 years ago

No, there's no binary parsing going on.

Unless you can give examples of where they could help?

v1gnesh commented 2 years ago

Okay, cool, thanks for your answer. Just thought I'd bring up a couple of related parsing crates in case you find content from either of them useful for reference or use.

Regarding https://github.com/samuelcolvin/pydantic-core/issues/14#issuecomment-1102594224

The problem I have right now is that parsing JSON inside pydantic-core is currently a lot slower than parsing json with ujson.loads or even json.loads then passing the output to pydantic-core - I'm looking into why that is now.

... apologies, another suggestion now, to https://github.com/simd-lite/simd-json-derive.

It might seem like I'm randomly bringing up things; but the intent is that objectively good open source projects can look at each other for common patterns & co-existence stuff. Hope this helps.

samuelcolvin commented 2 years ago

We don't use derive for JSON at all, we just use serde-json's Value, so I don't think that will help.

More generally, that comment is out of date, I think the performance is on a par or faster inside pydantic-core. I'll update that PR and eventually there will be docs.