Pydantic

Languages and libraries

data validation library

SHOW HN2017

120points
27comments
#354of 2,242 in 2017
Top 16%of 2017 by points

How HN took it

QuietFewer than 5 comments about the project

2 positive, 1 neutral or asking, 1 mixed, 0 critical, out of 4 comments about the project.

Idea: 1 for, 0 against

The thread, comment by comment

Each row is a top-level comment and its replies, in HN's order. Select a cell to open that comment on HN.

positive neutral or mixed critical about another commenter or something else the maker

What HN said

What people liked

  • Uses Python's typing system for pythonic type descriptions

    From 1 comment
    • Pydantic is not just a toy, I built it having used and abused numerous other libraries and found them wanting in one way or another. Because it reuses python's typing system it…
      scolvin on HN
  • Named typed classes are clearer than generic dicts for external data

    From 1 comment
    • In the small, it's just using attrs the way it's described in its documentation. In the large, I've been learning about Rust recently and wrapping my head around the…
      thristian on HN
  • Listed in an awesome-python models collection

    From 1 comment
    • Interesting project! I'm collecting different ORM/ODM/Mappings for python in this repository: https://github.com/grundic/awesome-python-models. Added your library. Thanks!
      cidnurh on HN

Objections

  • Not yet mature enough for complex cross-field validation; marshmallow is preferred for that

    From 1 comment
    • Marshmallow is still the best lib in town. Indeed, most of the libs fall short when you start to use them in the real world. Where validation is more than a type, when fields are…
      sametmax on HN
  • Faux immutability and dunder methods not supported

    From 2 comments
    • I've recently been using attrs as an easy way to make simple datatypes, but its only gesture towards validation is an arbitrary callback per field. Hooking into Python 3 type…
      thristian on HN
    • "faux-immutability" is a good way to describe it. My problem is the "faux"; proper immutability is virtually impossible in python and I'm not convinced about providing partial…
      scolvin on HN

Requests

  • Support __eq__ and immutability

    From 1 comment
    • I've recently been using attrs as an easy way to make simple datatypes, but its only gesture towards validation is an arbitrary callback per field. Hooking into Python 3 type…
      thristian on HN
  • Better error handling and control over validation order

    From 1 comment
    • Sure, my complaints are mostly around error handling. My comments might not be accurate since its off the top of my head. When a field raises an error I've noticed the value gets…
      rukittenme on HN

Questions

  • Will it support __hash__ and __lt__ like attrs and namedtuple

    From 1 comment
    • I've recently been using attrs as an easy way to make simple datatypes, but its only gesture towards validation is an arbitrary callback per field. Hooking into Python 3 type…
      thristian on HN

Alternatives named

  • marshmallow

    From 2 comments
    • Marshmallow is still the best lib in town. Indeed, most of the libs fall short when you start to use them in the real world. Where validation is more than a type, when fields are…
      sametmax on HN
    • I agree. Marshmallow is the best game in town and I love using it. That said its not perfect and I'm eagerly awaiting a successor. I use it frequently and have run into a lot of…
      rukittenme on HN
  • voluptuous

    From 1 comment
    • For those looking to validate dictionaries / JSON responses in Python, the voluptuous library works quite well: http://github.com/alecthomas/voluptuous. It also works for lists…
      svisser on HN
  • schema library

    From 1 comment
    • That's rather verbose, though. I prefer the much more functional "schema" library: https://github.com/keleshev/schema
      StavrosK on HN
  • jsonschema

    From 1 comment
    • JSON has a well defined schema system that works across languages. http://json-schema.org/ Python comes with the jsonschema module out of the box.
      user5994461 on HN
  • good (py-good)

    From 2 comments
    • I use a fork/successor library, good[0], for configuration validation. I've especially liked the data transformation it can do (I can easily allow a configuration entry to be a…
      Varriount on HN
    • What about good[0]? [0] https://github.com/kolypto/py-good
      Varriount on HN

Category, keywords, summaries and labels on this page were made by AI (Thread Reader v2) and not checked by hand. Each point links to the comments it came from.

Add a badge to your READMEShown on HackerShow
[![Shown on HackerShow](https://hackershow.org/badge.svg)](https://hackershow.org/show/14477222)