Giter Site home page Giter Site logo

What's going on here? about pydantic-core HOT 3 CLOSED

pydantic avatar pydantic commented on August 12, 2024
What's going on here?

from pydantic-core.

Comments (3)

PrettyWood avatar PrettyWood commented on August 12, 2024 1

Hi and thanks for the invitation!

IMO keeping it private for now is for the best: less pressure, not too much feedback, ...

First and most importantly I feel like it's a wonderful idea and already a great start! Splitting the code base of pydantic between pure validation and serializers, json schema, settings... is needed and I'm glad to see rust used for pydantic-core like so many great high performance libraries (orjson, tokenizers...)

I was having a look and I really love this idea!
I see you're already implementing it 🚀
I started working a while ago on a POC of tydantic (it was actually the name I took too 😆) but it was not based on a rust + json core, which feels way better.

I will take some time to review the code you already wrote and maybe write some kind of UML diagram to have a better vision of the whole implementation. Maybe I missed something but I was surprised to see nothing on strict checks. IMO it could be great to have something a bit like this to allow also strictness and custom coercion! (with pydantic declaring its own coercers)

from pydantic-core.

samuelcolvin avatar samuelcolvin commented on August 12, 2024

Thanks @PrettyWood, great to hear you think it's a good idea.

currently the implementation of #10 won't allow removal of python since only the input types are generalised, not the output types, but hopefully that can be change in future.

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.

from pydantic-core.

samuelcolvin avatar samuelcolvin commented on August 12, 2024

Forgot to say, strict types should be easy to implement. I've already altered some of the allowed types to make checks stricter should should improve usage, e.g.:

  • floats are only allowed as inputs to int fields if f % 1 == 0
  • lists of pairs won't be allowed as input to dict types

from pydantic-core.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.