[{"data":1,"prerenderedAt":176},["ShallowReactive",2],{"project-33331791":3},{"id":4,"name":5,"line":6,"line_source":7,"title":8,"url":9,"domain":10,"maker":11,"posted_at":12,"year":13,"points":14,"comments":15,"rank_in_year":16,"shown_in_year":17,"top":18,"tier":19,"category":20,"subcategory":21,"format":22,"keywords":23,"reception":28,"sentiment":29,"stance_mix":30,"scored_comments":33,"aspects":34,"strip":38,"post_text":39,"what":40,"said":56,"maker_in_thread":109,"shape":118,"grid":120,"attempts":140,"same_week":141,"maker_shows":31,"maker_hidden":169,"reader_version":170,"card":171},"33331791","Koda Validate","Typesafe, combinable validation for Python","title","Show HN: Koda Validate – Typesafe, combinable validation for Python","https:\u002F\u002Fgithub.com\u002Fkeithasaurus\u002Fkoda-validate","github.com","keithasaurus",1666711248,2022,30,9,1256,2570,49,"shown","languages","validation library","library",[24,25,26,27],"python validation","typesafe validation","pydantic alternative","schema validation","curious",0,{"positive":29,"neutral":31,"mixed":32,"critical":29},3,2,5,{"idea":35,"design":36,"performance":37},{"positive":29,"critical":29},{"positive":29,"critical":29},{"positive":29,"critical":29},[31,31,29,31,29,31,29,31,29],null,{"problem":41,"audience":39,"pricing":39,"motivation":39,"time_to_build":39,"stack":48,"openness":55,"stage":55,"team_size":55},{"value":42,"source":43,"evidence":44},"Building complex, type-safe data validators in Python without plugins or type-hint hacks","maker",[45],{"id":46,"by":11,"text":47},"33332879","There are a few differences: - it is typesafe without any plugins or type-hint hacks - exceptions are not raised as part of validation - there is a consistent, type-enforced…",[49],{"value":50,"source":43,"evidence":51},"Python",[52,54],{"id":53},"post",{"id":46,"by":11,"text":47},"unknown",{"praise":57,"objections":66,"requests":77,"questions":88,"alternatives":96},[58],{"value":59,"source":60,"evidence":61},"Typesafe without plugins; validators are combinable and inspectable","commenter",[62],{"id":63,"by":64,"text":65},"33333489","carapace","I like it. One thing that occurs to me: I don't want to have to describe my data in two places. Like how in the first example the dataclass Person has all the information needed…",[67,73],{"value":68,"source":43,"evidence":69},"Validation is slower than Pydantic out of the box, especially for dictionaries",[70],{"id":71,"by":11,"text":72},"33335286","Quick follow-up that it looks like koda_validate is usually slower when validating dictionaries out of the box. Good news is it's clear where I should optimize, and that I'll add…",{"value":74,"source":60,"evidence":75},"Requires describing data twice, unlike dataclass-based definitions",[76],{"id":63,"by":64,"text":65},[78],{"value":79,"source":60,"evidence":80},"Benchmarks against Pydantic and attrs",[81,84],{"id":82,"by":11,"text":83},"33333260","That's really helpful to hear. A few thoughts: - I haven't benchmarked this against pydantic... I guess I should! - I would _hope_ that Koda Validate is at least competitive with…",{"id":85,"by":86,"text":87},"33335421","timellis-smith","May also be good to benchmark against attrs which also seems to be similar to what you want to do.",[89],{"value":90,"source":60,"evidence":91},"How does it compare with Pydantic?",[92],{"id":93,"by":94,"text":95},"33332226","stevesimmons","How does this compare with say Pydantic?",[97,105],{"value":98,"source":60,"evidence":99},"Pydantic",[100,101],{"id":93,"by":94,"text":95},{"id":102,"by":103,"text":104},"33332568","snoozeulooze","This seems more lower level, and provides building blocks with combinators which seems like a Validation \u002F Applicative approach. I'm probably just going to use pydantic though.",{"value":106,"source":60,"evidence":107},"attrs",[108],{"id":85,"by":86,"text":87},{"comments":110,"answered":111,"key":112},4,1,[113,114,117],{"id":46,"text":47},{"id":115,"text":116},"33334077","Thanks for the feedback! This tradeoff was considered a lot, and it's definitely a case of tradeoffs! It's difficult to imagine a way of doing this that's as flexible but done…",{"id":82,"text":83},{"commenters":119,"max_depth":110,"maker_replies":110,"first_comment_mins":14,"lifespan_hours":33},6,[121,123,124,126,128,130,134,136,138],[93,29,31,122,94,29],"project\u002Fneutral\u002Fidea",[102,29,31,122,103,29],[46,29,29,125,11,111],"project\u002Fpositive\u002Fidea",[63,29,31,127,64,29],"project\u002Fmixed\u002Fdesign",[115,29,29,129,11,111],"maker\u002Fneutral\u002Fdesign",[131,29,31,132,133,29],"33333140","project\u002Fmixed\u002Fperformance","pugio",[82,29,29,135,11,111],"maker\u002Fneutral\u002Fperformance",[85,29,31,137,86,29],"project\u002Fneutral\u002Fperformance",[71,29,29,139,11,111],"project\u002Fcritical\u002Fperformance",[],[142,147,151,156,160,165],{"id":143,"name":144,"points":145,"category":146},"33287137","Restfox",758,"dev_tools",{"id":148,"name":149,"points":150,"category":146},"33344142","SadServers",597,{"id":152,"name":153,"points":154,"category":155},"33336920","steganography",208,"security_privacy",{"id":157,"name":158,"points":159,"category":146},"33306029","Outstatic",203,{"id":161,"name":162,"points":163,"category":164},"33283674","ezpersonality",179,"ai",{"id":166,"name":167,"points":168,"category":146},"33318108","Bolt.css",134,false,"v2",{"id":172,"name":5,"line":6,"ai":169,"cat":20,"year":13,"points":14,"comments":15,"rec":28,"s":29,"top":18,"kw":173,"maker":11,"domain":10,"tier":19,"attempts":29,"strip":174,"url":9,"mix":175,"praise":59,"objection":68,"sub":21},33331791,[24,25,26,27],"330303030",[29,31,32,29],1793991053631]