frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Show HN: Validatedata 0.3.0 – lightweight inline data validation for Python

https://pypi.org/project/validatedata/
1•EdwardK1•2h ago
Validatedata is a Python library for validating dicts, lists, function arguments, and API payloads inline. No model classes, no boilerplate — just rules alongside the data. pip install validatedata

Three ways to use it 1. Standalone function — validate a dict pythonfrom validatedata import validate_data

result = validate_data( data={'username': 'alice', 'email': 'alice@example.com', 'age': 25}, rule={'keys': { 'username': 'str|min:3|max:32', 'email': 'email', 'age': 'int|min:18', }} )

result.ok # True result.errors # []

# on failure: # [['username: invalid string length'], ['age: number out of range']] 2. Decorator — validate function arguments pythonfrom validatedata import validate

@validate(['str|min:3|max:32', 'email', 'str|min:8|msg:password too weak']) def signup(username, email, password): return 'Account Created'

signup('alice', 'alice@example.com', 'Secure@123') # works signup('alice', 'not-an-email', 'weak') # returns {'errors': [...]} 3. Type annotation decorator pythonfrom validatedata import validate_types

@validate_types def create_user(username: str, age: int): return f'{username} ({age})'

create_user('alice', 30) # works create_user('alice', 'thirty') # raises ValidationError All three support async functions transparently.

Shorthand rule syntax Rules can be written as compact pipe-separated strings. Transforms, validators, and custom messages chain in one line: python'str|min:3|max:32' 'email|nullable' 'int|between:0,100' 'str|strip|lower|in:admin,editor,viewer|msg:invalid role' 'str|min:8|re:(?=.[A-Z])(?=.\d).+|msg:password must contain uppercase and a number' 'color|format:hex|nullable' 'url|starts_with:https|msg:must be a secure URL' Named transforms (strip, lstrip, rstrip, lower, upper, title) run before validation. msg: is always last.

Transforms and mutation Apply transforms before validation and get cleaned values back: pythonresult = validate_data( data=[' Alice ', ' bob '], rule=['str|strip|lower', 'str|strip|lower'], mutate=True )

result.ok # True result.data # ['alice', 'bob']

Conditional validation Validate a field only when a sibling field meets a condition: pythonrule = {'keys': { 'role': {'type': 'str'}, 'permissions': { 'type': 'str', 'depends_on': {'field': 'role', 'value': 'admin'}, 'options': ('full', 'read', 'none') } }}

# permissions only validated when role == 'admin'

Custom error messages Any rule key accepts a {rule}-message override: python{ 'type': 'int', 'range': (18, 'any'), 'range-message': 'you must be at least 18', 'type-message': 'age must be a number', } Shorthand: 'int|min:18|msg:you must be at least 18'

Supported types Basic: str, int, float, bool, email, url, ip, uuid, slug, semver, phone, color, date, even, odd, prime Extended: dict, list, tuple, set, regex, object Phone validation supports E.164 built-in. National, international, and region-specific formats available via pip install phonenumbers. Color validation supports hex, rgb, hsl, and named CSS colors.

Supported rules range, length, contains, excludes, options, expression, startswith, endswith, unique, nullable, strict, transform, depends_on, fields, items

Return value validate_data returns a SimpleNamespace:

result.ok — True if all validation passed result.errors — list of error groups, one per field result.data — transformed values, only present when mutate=True

MIT licensed. Python 3.7+. No required dependencies. Repo: https://github.com/Edward-K1/validatedata PyPI: https://pypi.org/project/validatedata/ Feedback, bug reports, and use-case stories welcome.

Engineering over Enforcement (2023)

https://www.contraption.co/engineering-over-enforcement/
1•mooreds•32s ago•0 comments

The jellyfish knows how to survive uncertain times

https://herbertlui.net/the-jellyfish-knows-how-to-survive-uncertain-times/
1•herbertl•1m ago•0 comments

Obama is right about aliens

https://www.doomsdayscenario.co/p/obama-is-right-about-aliens
1•mooreds•4m ago•0 comments

Life in the Endless Scroll: What We're Losing

https://www.medscape.com/viewarticle/life-endless-scroll-what-were-losing-2026a10005od
1•wjb3•5m ago•0 comments

Zen of AI Coding

https://nonstructured.com/zen-of-ai-coding/
1•vinhnx•5m ago•0 comments

Intent-Based Access Control (IBAC) – FGA for AI Agent Permissions

https://ibac.dev
1•ERROR_0x06•5m ago•0 comments

Moving to 199-day validity for public TLS certificates

https://knowledge.digicert.com/alerts/public-tls-certificates-199-day-validity
1•thread_id•9m ago•0 comments

The Wealth of Wall Street with Oren Cass [video]

https://www.youtube.com/watch?v=SL2aA8cgIB8
1•mooreds•10m ago•0 comments

Eurosky.social accounts – launching early February

https://www.eurosky.tech/register
2•doener•10m ago•0 comments

Spain says we have the necessary resources to contain US trade embargo

https://www.marketscreener.com/news/spanish-government-on-trump-threat-to-cut-trade-we-have-the-n...
1•rguiscard•11m ago•1 comments

Four Decades of Inquiry into the Genetic Bases of Specific Reading Disability

https://pubs.asha.org/doi/epdf/10.1044/2025_JSLHR-25-00050
1•wjb3•11m ago•0 comments

Show HN: Finqual – Free SEC-based API for fundamentals, insider and 13F data

https://finqual.app/
1•myztika•12m ago•0 comments

Reverse engineering "Hello World" in QuickBASIC 3.0

https://marnetto.net/2026/03/01/brun-hello-world
1•avadodin•12m ago•0 comments

Ask HN: Are you running a free product (pre-revenue)?

1•LeanVibe•12m ago•0 comments

Interactive Fiction Theory and Criticism

https://the-rosebush.com/
1•agnishom•13m ago•0 comments

The evolution of background job frameworks in Ruby

https://riverqueue.com/blog/ruby-queue-history
2•thunderbong•13m ago•0 comments

Tunesia authoritative nameservers for .tn are down

https://www.google.com/
2•NoahZuniga•13m ago•1 comments

"We have made the decision to permanently shut down Highguard."

https://twitter.com/PlayHighguard/status/2028923492125819287
1•minimaxir•14m ago•0 comments

The missing piece for AI coding agents

https://www.buildbuddy.io/blog/remote-bazel-with-agents/
2•jshchnz•14m ago•0 comments

After 8 years on WordPress, I migrated to AstroJS Starlight. Here's the how-to

https://pawelcislo.com/posts/migrating-from-wordpress-to-astrojs-starlight/
1•pyxelr•15m ago•0 comments

Key takeaways from the 2026 State of Software Delivery

https://circleci.com/blog/five-takeaways-2026-software-delivery-report/
1•Illniyar•15m ago•0 comments

Graduate from Single-Session Coding: My Full Agentic Coding Workflow

https://medium.com/@btraut/assemble-your-agent-team-fbfb6b8904b2
1•btraut•15m ago•0 comments

Ketamine may fight chronic fatigue, study suggests

https://medicalxpress.com/news/2026-02-ketamine-chronic-fatigue.html
2•PaulHoule•16m ago•0 comments

Replicating Empirical AI Safety Research

https://secondlookresearch.com/
1•salkahfi•16m ago•0 comments

Closing the Loop – Optimizing the Agentic SDLC

https://medium.com/@btraut/closing-the-loop-3286bb886605
1•btraut•16m ago•0 comments

Yard Kitchen – 3D interactive Jamaican cookbook with AI cooking assistants

https://yard-kitchen.vercel.app
1•amdr_automate•17m ago•1 comments

Why the Open Web Matters: A Claude Code Agent's Case for Open Infrastructure

https://blog.unratified.org/2026-03-03-in-defense-of-the-open-web/
1•9wzYQbTYsAIc•17m ago•0 comments

Military Leaders Say Iran War Is So Trump Can Bring About "Armageddon"

https://newrepublic.com/post/207270/military-leaders-iran-war-donald-trump-jesus-armageddon
6•Teever•18m ago•0 comments

Markdown for the Component Era

https://mdxjs.com/
1•mjtk•18m ago•0 comments

Full Schema Hierarchy

https://schema.org/docs/full.html
1•vinhnx•20m ago•0 comments