{"id":46523984,"url":"https://github.com/msgflux/msgspec-ext","last_synced_at":"2026-04-02T00:05:55.201Z","repository":{"id":306542232,"uuid":"1024548684","full_name":"msgflux/msgspec-ext","owner":"msgflux","description":"High-performance settings management and validation library extending msgspec","archived":false,"fork":false,"pushed_at":"2026-03-16T10:05:43.000Z","size":421,"stargazers_count":7,"open_issues_count":6,"forks_count":3,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-16T22:53:05.111Z","etag":null,"topics":["data-validation","settings-management"],"latest_commit_sha":null,"homepage":"","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/msgflux.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-07-22T22:04:05.000Z","updated_at":"2026-02-23T05:43:31.000Z","dependencies_parsed_at":null,"dependency_job_id":"28379d0d-f436-499f-93fd-68cabc100f33","html_url":"https://github.com/msgflux/msgspec-ext","commit_stats":null,"previous_names":["msgflux/msgspec-ext"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/msgflux/msgspec-ext","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msgflux%2Fmsgspec-ext","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msgflux%2Fmsgspec-ext/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msgflux%2Fmsgspec-ext/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msgflux%2Fmsgspec-ext/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/msgflux","download_url":"https://codeload.github.com/msgflux/msgspec-ext/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msgflux%2Fmsgspec-ext/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31293204,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-01T21:15:39.731Z","status":"ssl_error","status_checked_at":"2026-04-01T21:15:34.046Z","response_time":53,"last_error":"SSL_read: 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":["data-validation","settings-management"],"created_at":"2026-03-06T20:03:25.999Z","updated_at":"2026-04-02T00:05:55.190Z","avatar_url":"https://github.com/msgflux.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cpicture\u003e\n    \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"https://raw.githubusercontent.com/msgflux/msgspec-ext/main/docs/assets/msgspec-ext-logo-dark.png\"\u003e\n    \u003csource media=\"(prefers-color-scheme: light)\" srcset=\"https://raw.githubusercontent.com/msgflux/msgspec-ext/main/docs/assets/msgspec-ext-logo-light.png\"\u003e\n    \u003cimg alt=\"msgspec-ext\" src=\"https://raw.githubusercontent.com/msgflux/msgspec-ext/main/docs/assets/msgspec-ext-logo-light.png\" width=\"340\"\u003e\n  \u003c/picture\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cb\u003eHigh-performance settings management and validation library powered by \u003ca href=\"https://github.com/jcrist/msgspec\"\u003emsgspec\u003c/a\u003e\u003c/b\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/msgflux/msgspec-ext/actions/workflows/ci.yml\"\u003e\u003cimg src=\"https://github.com/msgflux/msgspec-ext/actions/workflows/ci.yml/badge.svg\" alt=\"CI\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://pypi.org/project/msgspec-ext/\"\u003e\u003cimg src=\"https://img.shields.io/pypi/v/msgspec-ext.svg\" alt=\"PyPI\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://pypi.org/project/msgspec-ext/\"\u003e\u003cimg src=\"https://img.shields.io/pypi/pyversions/msgspec-ext.svg\" alt=\"Python Versions\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/msgflux/msgspec-ext/blob/main/LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/badge/license-MIT-blue.svg\" alt=\"License\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://vilsonrodrigues.medium.com/msgspec-ext-high-performance-settings-management-and-validation-library-extending-msgspec-859a8598cccb\"\u003e📖 Read the announcement on Medium\u003c/a\u003e\n\u003c/p\u003e\n\n## Features\n\n- ⚡ **7x faster than pydantic-settings** - Built on [msgspec](https://github.com/jcrist/msgspec)'s high-performance validation\n- 🎯 **26 built-in validators** - Email, URLs, IP addresses, MAC addresses, dates, storage sizes, and more\n- 🔧 **Drop-in API compatibility** - Familiar interface, easy migration from pydantic-settings\n- 📦 **All msgspec types supported** - Full compatibility with [msgspec's rich type system](https://jcristharif.com/msgspec/supported-types.html)\n- 🔐 **Type-safe** - Complete type hints and validation\n- 📁 **.env support** - Fast built-in .env parser (169x faster cached loads)\n- 🎨 **Nested settings** - Support for complex configuration structures\n- 🪶 **Zero dependencies** - Only msgspec required\n\n## Installation\n\nUsing pip:\n```bash\npip install msgspec-ext\n```\n\nUsing uv (recommended):\n```bash\nuv add msgspec-ext\n```\n\n## Quick Start\n\n### With BaseSettings (Environment Variables)\n\n```python\nfrom msgspec_ext import BaseSettings, EmailStr, HttpUrl, PositiveInt\n\nclass AppSettings(BaseSettings):\n    # Basic types (msgspec native support)\n    name: str\n    debug: bool = False\n\n    # Numeric validators\n    port: PositiveInt = 8000  # Must be \u003e 0\n    workers: PositiveInt = 4\n\n    # String validators\n    admin_email: EmailStr  # RFC 5321 validation\n    api_url: HttpUrl  # HTTP/HTTPS only\n\n# Load from environment variables and .env file\nsettings = AppSettings()\n\nprint(settings.name)  # my-app\nprint(settings.port)  # 8000\nprint(settings.admin_email)  # admin@example.com\n\n# Serialize to dict\nprint(settings.model_dump())\n# Output: {\n#   'name': 'my-app',\n#   'debug': False,\n#   'port': 8000,\n#   'workers': 4,\n#   'admin_email': 'admin@example.com',\n#   'api_url': 'https://api.example.com'\n# }\n\n# Serialize to JSON\nprint(settings.model_dump_json())\n# Output: '{\"name\":\"my-app\",\"debug\":false,\"port\":8000,\"workers\":4,\"admin_email\":\"admin@example.com\",\"api_url\":\"https://api.example.com\"}'\n```\n\nSet environment variables:\n```bash\nexport NAME=\"my-app\"\nexport ADMIN_EMAIL=\"admin@example.com\"\nexport API_URL=\"https://api.example.com\"\n```\n\n### With msgspec Structs (Direct Usage)\n\nAll validators work directly with msgspec structs for JSON/MessagePack serialization:\n\n```python\nimport msgspec\nfrom msgspec_ext import EmailStr, IPv4Address, ByteSize, PositiveInt, dec_hook, enc_hook\n\nclass ServerConfig(msgspec.Struct):\n    host: IPv4Address\n    port: PositiveInt\n    admin_email: EmailStr\n    max_upload: ByteSize\n\n# From JSON (use dec_hook for custom type conversion)\nconfig = msgspec.json.decode(\n    b'{\"host\":\"192.168.1.100\",\"port\":8080,\"admin_email\":\"admin@example.com\",\"max_upload\":\"50MB\"}',\n    type=ServerConfig,\n    dec_hook=dec_hook\n)\n\nprint(config.host)  # 192.168.1.100\nprint(int(config.max_upload))  # 50000000 (50MB in bytes)\n\n# To JSON (use enc_hook to serialize custom types)\njson_bytes = msgspec.json.encode(config, enc_hook=enc_hook)\n```\n\n## Type Support\n\nmsgspec-ext supports **all msgspec native types** plus **26 additional validators** for common use cases.\n\n### Built-in msgspec Types\n\nmsgspec-ext has full compatibility with [msgspec's extensive type system](https://jcristharif.com/msgspec/supported-types.html):\n\n- **Basic**: `bool`, `int`, `float`, `str`, `bytes`, `bytearray`\n- **Collections**: `list`, `tuple`, `set`, `frozenset`, `dict`\n- **Typing**: `Optional`, `Union`, `Literal`, `Final`, `Annotated`\n- **Advanced**: `datetime`, `date`, `time`, `timedelta`, `UUID`, `Decimal`\n- **msgspec**: `msgspec.Raw`, `msgspec.UNSET` (re-exported for convenience)\n\nPlus many more - see the [full list in msgspec documentation](https://jcristharif.com/msgspec/supported-types.html).\n\n### Custom Validators (26 types)\n\nmsgspec-ext adds **26 specialized validators** for common validation scenarios:\n\n#### 🔢 Numeric Constraints (8 types)\n\n```python\nfrom msgspec_ext import (\n    PositiveInt, NegativeInt, NonNegativeInt, NonPositiveInt,\n    PositiveFloat, NegativeFloat, NonNegativeFloat, NonPositiveFloat\n)\n\nclass ServerSettings(BaseSettings):\n    port: PositiveInt  # Must be \u003e 0\n    offset: NegativeInt  # Must be \u003c 0\n    retry_count: NonNegativeInt  # Can be 0 or positive\n    balance: NonPositiveFloat  # Can be 0 or negative\n```\n\n#### 🌐 Network \u0026 Hardware (4 types)\n\n```python\nimport msgspec\nfrom msgspec_ext import IPv4Address, IPv6Address, IPvAnyAddress, MacAddress\n\n# With BaseSettings\nclass NetworkSettings(BaseSettings):\n    server_ipv4: IPv4Address  # 192.168.1.1\n    server_ipv6: IPv6Address  # 2001:db8::1\n    proxy_ip: IPvAnyAddress  # Accepts IPv4 or IPv6\n    device_mac: MacAddress  # AA:BB:CC:DD:EE:FF\n\n# Or with msgspec.Struct for API responses\nclass Device(msgspec.Struct):\n    name: str\n    ip: IPv4Address\n    mac: MacAddress\n\ndevice = msgspec.json.decode(\n    b'{\"name\":\"router-01\",\"ip\":\"192.168.1.1\",\"mac\":\"AA:BB:CC:DD:EE:FF\"}',\n    type=Device,\n    dec_hook=dec_hook\n)\n```\n\n#### ✉️ String Validators (4 types)\n\n```python\nfrom msgspec_ext import EmailStr, HttpUrl, AnyUrl, SecretStr\n\nclass AppSettings(BaseSettings):\n    admin_email: EmailStr  # RFC 5321 validation\n    api_url: HttpUrl  # HTTP/HTTPS only\n    webhook_url: AnyUrl  # Any valid URL scheme\n    api_key: SecretStr  # Masked in logs: **********\n```\n\n#### 🗄️ Database \u0026 Connections (3 types)\n\n```python\nfrom msgspec_ext import PostgresDsn, RedisDsn, PaymentCardNumber\n\nclass ConnectionSettings(BaseSettings):\n    database_url: PostgresDsn  # postgresql://user:pass@host/db\n    cache_url: RedisDsn  # redis://localhost:6379\n    card_number: PaymentCardNumber  # Luhn validation + masking\n```\n\n#### 📁 Path Validators (2 types)\n\n```python\nfrom msgspec_ext import FilePath, DirectoryPath\n\nclass PathSettings(BaseSettings):\n    config_file: FilePath  # Must exist and be a file\n    data_dir: DirectoryPath  # Must exist and be a directory\n```\n\n#### 💾 Storage \u0026 Dates (3 types)\n\n```python\nimport msgspec\nfrom msgspec_ext import ByteSize, PastDate, FutureDate\nfrom datetime import date\n\n# With BaseSettings\nclass AppSettings(BaseSettings):\n    max_upload: ByteSize  # Parse \"10MB\", \"1GB\", etc.\n    cache_size: ByteSize  # Supports KB, MB, GB, KiB, MiB, GiB\n    founding_date: PastDate  # Must be before today\n    launch_date: FutureDate  # Must be after today\n\n# Or with msgspec.Struct for configuration files\nclass StorageConfig(msgspec.Struct):\n    max_file_size: ByteSize\n    cache_limit: ByteSize\n    cleanup_after: int  # days\n\nconfig = msgspec.json.decode(\n    b'{\"max_file_size\":\"100MB\",\"cache_limit\":\"5GB\",\"cleanup_after\":30}',\n    type=StorageConfig,\n    dec_hook=dec_hook\n)\nprint(int(config.max_file_size))  # 100000000\n```\n\n#### 🎯 Constrained Strings (2 types)\n\n```python\nfrom msgspec_ext import ConStr\n\nclass UserSettings(BaseSettings):\n    # With constraints\n    username: ConStr  # Can use min_length, max_length, pattern\n\n# Usage:\nusername = ConStr(\"alice\", min_length=3, max_length=20, pattern=r\"^[a-z0-9]+$\")\n```\n\n### Complete Validator List\n\n| Category | Validators |\n|----------|-----------|\n| **Numeric** | `PositiveInt`, `NegativeInt`, `NonNegativeInt`, `NonPositiveInt`, `PositiveFloat`, `NegativeFloat`, `NonNegativeFloat`, `NonPositiveFloat` |\n| **Network** | `IPv4Address`, `IPv6Address`, `IPvAnyAddress`, `MacAddress` |\n| **String** | `EmailStr`, `HttpUrl`, `AnyUrl`, `SecretStr` |\n| **Database** | `PostgresDsn`, `RedisDsn`, `PaymentCardNumber` |\n| **Paths** | `FilePath`, `DirectoryPath` |\n| **Storage \u0026 Dates** | `ByteSize`, `PastDate`, `FutureDate` |\n| **Constrained** | `ConStr` |\n\nSee `examples/06_validators.py` and `examples/07_advanced_validators.py` for complete usage examples.\n\n## Use Cases\n\n### API Request/Response Validation\n\n```python\nimport msgspec\nfrom msgspec_ext import EmailStr, HttpUrl, PositiveInt, ByteSize, dec_hook, enc_hook\n\nclass CreateUserRequest(msgspec.Struct):\n    email: EmailStr\n    age: PositiveInt\n    website: HttpUrl\n    max_storage: ByteSize\n\nclass UserResponse(msgspec.Struct):\n    id: int\n    email: EmailStr\n    website: HttpUrl\n\n# Validate incoming JSON\nrequest = msgspec.json.decode(\n    b'{\"email\":\"user@example.com\",\"age\":25,\"website\":\"https://example.com\",\"max_storage\":\"1GB\"}',\n    type=CreateUserRequest,\n    dec_hook=dec_hook\n)\n\nprint(request.email)  # user@example.com\nprint(request.age)  # 25\nprint(int(request.max_storage))  # 1000000000\n\n# Serialize response\nresponse = UserResponse(id=1, email=request.email, website=request.website)\njson_bytes = msgspec.json.encode(response, enc_hook=enc_hook)\nprint(json_bytes)\n# b'{\"id\":1,\"email\":\"user@example.com\",\"website\":\"https://example.com\"}'\n```\n\n### Configuration Files with Validation\n\n```python\nimport msgspec\nfrom msgspec_ext import IPv4Address, PositiveInt, PostgresDsn, ByteSize, dec_hook\n\nclass ServerConfig(msgspec.Struct):\n    host: IPv4Address\n    port: PositiveInt\n    database_url: PostgresDsn\n    max_upload: ByteSize\n    workers: PositiveInt = 4\n\n# Load from JSON config file\nwith open(\"config.json\", \"rb\") as f:\n    config = msgspec.json.decode(f.read(), type=ServerConfig, dec_hook=dec_hook)\n\nprint(f\"Server: {config.host}:{config.port}\")\n# Server: 192.168.1.50:8080\n\nprint(f\"Max upload: {int(config.max_upload)} bytes\")\n# Max upload: 100000000 bytes\n\nprint(f\"Workers: {config.workers}\")\n# Workers: 4\n```\n\n### Message Queue Data Validation\n\n```python\nimport msgspec\nfrom msgspec_ext import EmailStr, IPvAnyAddress, FutureDate, dec_hook, enc_hook\n\nclass ScheduledTask(msgspec.Struct):\n    task_id: str\n    notify_email: EmailStr\n    target_server: IPvAnyAddress\n    execute_at: FutureDate\n\n# Serialize for queue (MessagePack is faster than JSON)\ntask = ScheduledTask(\n    task_id=\"task-123\",\n    notify_email=EmailStr(\"admin@example.com\"),\n    target_server=IPvAnyAddress(\"192.168.1.100\"),\n    execute_at=FutureDate(\"2025-12-31\")\n)\nmsg_bytes = msgspec.msgpack.encode(task, enc_hook=enc_hook)\n\n# Deserialize from queue\nreceived_task = msgspec.msgpack.decode(msg_bytes, type=ScheduledTask, dec_hook=dec_hook)\n```\n\n## Advanced Usage\n\n### Environment Variables \u0026 .env Files\n\n```python\nfrom msgspec_ext import BaseSettings, SettingsConfigDict\n\nclass AppSettings(BaseSettings):\n    model_config = SettingsConfigDict(\n        env_file=\".env\",  # Load from .env file\n        env_prefix=\"APP_\",  # Prefix for env vars\n        env_nested_delimiter=\"__\"  # Nested config separator\n    )\n\n    name: str\n    debug: bool = False\n    port: int = 8000\n\n# Loads from APP_NAME, APP_DEBUG, APP_PORT\nsettings = AppSettings()\n```\n\n**.env file**:\n```bash\nAPP_NAME=my-app\nAPP_DEBUG=true\nAPP_PORT=3000\nAPP_DATABASE__HOST=localhost\nAPP_DATABASE__PORT=5432\n```\n\n### Standalone `load_dotenv`\n\n```python\nfrom msgspec_ext import load_dotenv\n\n# Load .env file into os.environ (does not override existing vars)\nload_dotenv()\n\n# Load from a custom path\nload_dotenv(\"config/.env\")\n\n# Override existing environment variables\nload_dotenv(\".env\", override=True)\n\n# Custom encoding\nload_dotenv(\".env\", encoding=\"latin-1\")\n```\n\n### Nested Configuration\n\n```python\nfrom msgspec_ext import BaseSettings, SettingsConfigDict, PostgresDsn\n\nclass DatabaseSettings(BaseSettings):\n    host: str = \"localhost\"\n    port: int = 5432\n    name: str = \"myapp\"\n    url: PostgresDsn\n\nclass AppSettings(BaseSettings):\n    model_config = SettingsConfigDict(\n        env_file=\".env\",\n        env_nested_delimiter=\"__\"\n    )\n\n    name: str = \"My App\"\n    debug: bool = False\n    database: DatabaseSettings\n\n# Loads from DATABASE__HOST, DATABASE__PORT, DATABASE__URL, etc.\nsettings = AppSettings()\n\nprint(settings.name)  # My App\nprint(settings.database.host)  # localhost\nprint(settings.database.port)  # 5432\n\n# Full nested dump\nprint(settings.model_dump())\n# Output: {\n#   'name': 'My App',\n#   'debug': False,\n#   'database': {\n#     'host': 'localhost',\n#     'port': 5432,\n#     'name': 'myapp',\n#     'url': 'postgresql://user:pass@localhost:5432/myapp'\n#   }\n# }\n```\n\n### Secret Masking\n\n```python\nfrom msgspec_ext import BaseSettings, SecretStr\n\nclass AppSettings(BaseSettings):\n    api_key: SecretStr\n    db_password: SecretStr\n\nsettings = AppSettings()\n\nprint(settings.api_key)  # **********\nprint(settings.api_key.get_secret_value())  # actual-secret-key\n\nprint(settings.model_dump())\n# Output: {'api_key': '**********', 'db_password': '**********'}\n\nprint(settings.model_dump_json())\n# Output: '{\"api_key\":\"**********\",\"db_password\":\"**********\"}'\n```\n\n### Storage Size Parsing\n\n```python\nfrom msgspec_ext import BaseSettings, ByteSize\n\nclass StorageSettings(BaseSettings):\n    max_upload: ByteSize\n    cache_limit: ByteSize\n\n# Environment variables:\n# MAX_UPLOAD=10MB\n# CACHE_LIMIT=1GB\n\nsettings = StorageSettings()\nprint(int(settings.max_upload))  # 10000000 (10 MB in bytes)\nprint(int(settings.cache_limit))  # 1000000000 (1 GB in bytes)\n\nprint(settings.model_dump())\n# Output: {'max_upload': 10000000, 'cache_limit': 1000000000}\n```\n\nSupported units: `B`, `KB`, `MB`, `GB`, `TB`, `KiB`, `MiB`, `GiB`, `TiB`\n\n### Date Validation\n\n```python\nfrom msgspec_ext import BaseSettings, PastDate, FutureDate\nfrom datetime import date, timedelta\n\nclass EventSettings(BaseSettings):\n    founding_date: PastDate  # Must be before today\n    launch_date: FutureDate  # Must be after today\n\n# Environment variables:\n# FOUNDING_DATE=2020-01-01\n# LAUNCH_DATE=2025-12-31\n\nsettings = EventSettings()\n```\n\n### JSON Parsing from Environment\n\n```python\nfrom msgspec_ext import BaseSettings\n\nclass AppSettings(BaseSettings):\n    # Automatically parse JSON from environment variables\n    features: list[str] = [\"auth\", \"api\"]\n    limits: dict[str, int] = {\"requests\": 100}\n    config: dict[str, any] = {}\n\n# Environment variable:\n# FEATURES=[\"auth\",\"api\",\"payments\"]\n# LIMITS={\"requests\":1000,\"timeout\":30}\n\nsettings = AppSettings()\nprint(settings.features)  # ['auth', 'api', 'payments']\n```\n\n## Why Choose msgspec-ext?\n\nmsgspec-ext provides a **faster, lighter alternative** to pydantic-settings while offering **more validators** and maintaining a familiar API.\n\n### Performance Comparison\n\n**Cold start** (first load, includes .env parsing):\n\n| Library | Time per load | Speed |\n|---------|---------------|-------|\n| **msgspec-ext** | **0.353ms** | **7.0x faster** ⚡ |\n| pydantic-settings | 2.47ms | Baseline |\n\n**Warm (cached)** (repeated loads in long-running applications):\n\n| Library | Time per load | Speed |\n|---------|---------------|-------|\n| **msgspec-ext** | **0.011ms** | **169x faster** ⚡ |\n| pydantic-settings | 1.86ms | Baseline |\n\n\u003e *Benchmarks run on Google Colab. Includes .env parsing, environment variable loading, type validation, and nested configuration. Run `benchmark/benchmark_cold_warm.py` to reproduce.*\n\n### Key Advantages\n\n| Feature | msgspec-ext | pydantic-settings |\n|---------|------------|-------------------|\n| **Cold start** | **7.0x faster** ⚡ | Baseline |\n| **Warm (cached)** | **169x faster** ⚡ | Baseline |\n| **Validators** | **26 built-in** | ~15 |\n| **Package size** | **0.49 MB** | 1.95 MB |\n| **Dependencies** | **1 (msgspec only)** | 5+ |\n| .env support | ✅ Built-in fast parser | ✅ Via python-dotenv |\n| Type validation | ✅ msgspec C backend | ✅ Pydantic |\n| Advanced caching | ✅ 169x faster | ❌ |\n| Nested config | ✅ | ✅ |\n| JSON Schema | ✅ | ✅ |\n\n### How is it so fast?\n\nmsgspec-ext achieves exceptional performance through:\n\n1. **Bulk validation**: Validates all fields at once in C (via msgspec), not one-by-one in Python\n2. **Custom .env parser**: Built-in fast parser with zero external dependencies (117.5x faster than pydantic)\n3. **Smart caching**: Caches .env files, field mappings, and type information - subsequent loads are 169x faster\n4. **Zero overhead**: Fast paths for common types with minimal Python code\n\nThis means:\n- 🚀 **CLI tools** - 7.0x faster startup every invocation\n- ⚡ **Serverless functions** - Lower cold start latency\n- 🔄 **Long-running apps** - Reloading settings takes only 11 microseconds after first load!\n\n## Examples\n\nCheck out the `examples/` directory for comprehensive examples:\n\n- `01_basic_usage.py` - Getting started with BaseSettings\n- `02_env_prefix.py` - Using environment variable prefixes\n- `03_dotenv_file.py` - Loading from .env files\n- `04_advanced_types.py` - Optional, lists, dicts, JSON parsing\n- `05_serialization.py` - model_dump(), model_dump_json(), schema()\n- `06_validators.py` - String, numeric, path, and database validators (17 types)\n- `07_advanced_validators.py` - Network, storage, and date validators (8 types)\n\n## Contributing\n\nWe welcome contributions! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.\n\n## License\n\nMIT License - see [LICENSE](LICENSE) file for details.\n\n## Acknowledgments\n\nBuilt on top of the amazing [msgspec](https://github.com/jcrist/msgspec) library by [@jcrist](https://github.com/jcrist).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmsgflux%2Fmsgspec-ext","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmsgflux%2Fmsgspec-ext","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmsgflux%2Fmsgspec-ext/lists"}