{"id":37066974,"url":"https://github.com/pinnlabs/venvalid","last_synced_at":"2026-01-14T07:51:42.450Z","repository":{"id":307998464,"uuid":"1031087737","full_name":"PinnLabs/Venvalid","owner":"PinnLabs","description":"Venvalid is a inspiring Envalid (Node.JS) lib for validating and accessing environment variables in python programs","archived":false,"fork":false,"pushed_at":"2025-08-20T00:38:11.000Z","size":883,"stargazers_count":4,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-11-28T12:39:08.056Z","etag":null,"topics":["python","venv","venv-manager","venv-python"],"latest_commit_sha":null,"homepage":"https://pinnlabs.github.io/Venvalid/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PinnLabs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-08-03T01:31:32.000Z","updated_at":"2025-10-26T18:02:41.000Z","dependencies_parsed_at":"2025-08-03T15:24:51.850Z","dependency_job_id":"1bc10cfb-ac8d-46bd-8b15-a1bdc3615ec5","html_url":"https://github.com/PinnLabs/Venvalid","commit_stats":null,"previous_names":["pinnlabs/venvalid"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/PinnLabs/Venvalid","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PinnLabs%2FVenvalid","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PinnLabs%2FVenvalid/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PinnLabs%2FVenvalid/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PinnLabs%2FVenvalid/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PinnLabs","download_url":"https://codeload.github.com/PinnLabs/Venvalid/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PinnLabs%2FVenvalid/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28413512,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T05:26:33.345Z","status":"ssl_error","status_checked_at":"2026-01-14T05:21:57.251Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["python","venv","venv-manager","venv-python"],"created_at":"2026-01-14T07:51:41.935Z","updated_at":"2026-01-14T07:51:42.435Z","avatar_url":"https://github.com/PinnLabs.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"./public/logo.png\" alt=\"Venvalid logo\" width=\"200\"/\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://pepy.tech/projects/venvalid\"\u003e\n    \u003cimg src=\"https://static.pepy.tech/badge/venvalid\" alt=\"PyPI Downloads\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003eMinimalist environment variable validation for Python, inspired by \u003ca href=\"https://github.com/af/envalid\"\u003eenvalid\u003c/a\u003e\u003c/p\u003e\n\n---\n\n## About\n\n**Venvalid** is a minimalist and developer-friendly environment variable validator for Python — inspired by the simplicity and clarity of [`envalid`](https://github.com/af/envalid) from the Node.js world.\n\nIt lets you define a schema for your environment variables and ensures they are present, well-formed, and ready to use — before your app even starts.\n\n---\n\n## Why Venvalid?\n\nVenvalid was designed with Python developers in mind, offering a modern, clean, and extensible API to handle `.env` configurations. It stands out from other libraries by:\n\n- ✅ Using **Python native types** (`str`, `bool`, `int`, `list`, `Path`, `Decimal`, `datetime`, etc.)\n- ✅ Supporting **default values**, **enum constraints**, and **custom validation**\n- ✅ Allowing **custom dotenv loading** with override support\n- ✅ Raising clear and styled error messages that prevent app boot on misconfig\n- ✅ Having zero external dependencies — just Python\n\n---\n\n## Installation\n\n```bash\npip install venvalid\n```\n\nor\n\n```bash\nuv add venvalid\n```\n\n---\n\n## Quick Example\n\n```python\nfrom venvalid import str_, int_, bool_, venvalid\nfrom venvalid.dotenv import load_env_file\n\n# Define schema\nconfig = venvalid({\n    \"DEBUG\": bool_(default=False),\n    \"PORT\": int_(default=8000),\n    \"SECRET_KEY\": str_(),\n    \"ENVIRONMENT\": str_(allowed=[\"dev\", \"prod\", \"test\"], default=\"dev\"),\n})\n\nprint(config[\"DEBUG\"])        # -\u003e False\nprint(config[\"PORT\"])         # -\u003e 8000\nprint(config[\"ENVIRONMENT\"])  # -\u003e \"dev\"\n```\n\n---\n\n## Usage\n\nYou can use `venvalid` to validate configuration before mounting the app:\n\n```python\nfrom fastapi import FastAPI\nfrom venvalid import str_, int_, bool_, venvalid\nfrom venvalid.dotenv import load_env_file\n\nconfig = venvalid({\n    \"DEBUG\": bool_(default=False),\n    \"PORT\": int_(default=8000),\n    \"ENVIRONMENT\": str_(allowed=[\"dev\", \"prod\", \"test\"], default=\"dev\"),\n})\n\napp = FastAPI()\n\n@app.get(\"/\")\ndef read_root():\n    return {\n        \"env\": config[\"ENVIRONMENT\"],\n        \"debug\": config[\"DEBUG\"],\n        \"port\": config[\"PORT\"],\n    }\n```\n\n---\n\n## Supported Types\n\nYou can use both built-in types and helper functions:\n\n- `str`, `int`, `bool`, `list`\n- `path_()` → for `pathlib.Path`\n- `decimal_()` → for `Decimal`\n- `datetime_()` → for `datetime`\n- `json_()` → for JSON/dict strings\n\nAll helpers accept:\n\n- `default=...`\n- `allowed=[...]`\n- `validate=callable`\n\n---\n\n## Advanced Options\n\n```python\n\"ENVIRONMENT\": str_(allowed=[\"dev\", \"prod\"], default=\"dev\"),\n\"FEATURE_FLAG\": bool_(default=False),\n\"API_KEY\": str_(validate=lambda v: v.startswith(\"sk-\")),\n```\n\nIf any variable is missing or invalid, `venvalid` will stop execution and print a meaningful error message.\n\n---\n\n## .env Loading\n\nIf you want to load variables from a `.env` file (without relying on `python-dotenv`), use:\n\n```python\nfrom venvalid.dotenv import load_env_file\n\nload_env_file(\".env\")             # default\nload_env_file(\".env.prod\", override=True)  # optional override\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpinnlabs%2Fvenvalid","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpinnlabs%2Fvenvalid","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpinnlabs%2Fvenvalid/lists"}