{"id":13468598,"url":"https://github.com/jcrist/msgspec","last_synced_at":"2026-04-08T21:03:34.691Z","repository":{"id":37029791,"uuid":"332952543","full_name":"jcrist/msgspec","owner":"jcrist","description":"A fast serialization and validation library, with builtin support for JSON, MessagePack, YAML, and TOML","archived":false,"fork":false,"pushed_at":"2025-04-22T20:22:32.000Z","size":5932,"stargazers_count":2810,"open_issues_count":178,"forks_count":97,"subscribers_count":24,"default_branch":"main","last_synced_at":"2025-05-07T23:35:11.116Z","etag":null,"topics":["deserialization","json","json-schema","jsonschema","messagepack","msgpack","openapi3","python","schema","serde","serialization","toml","validation","yaml"],"latest_commit_sha":null,"homepage":"https://jcristharif.com/msgspec/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jcrist.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-01-26T02:53:57.000Z","updated_at":"2025-05-07T14:47:15.000Z","dependencies_parsed_at":"2023-10-11T19:57:27.358Z","dependency_job_id":"dc150e38-972a-4b5a-883f-1d14c4045cd1","html_url":"https://github.com/jcrist/msgspec","commit_stats":{"total_commits":746,"total_committers":28,"mean_commits":"26.642857142857142","dds":"0.036193029490616646","last_synced_commit":"595c33c4a71c6d0c539b82233982a65819e240cf"},"previous_names":[],"tags_count":37,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcrist%2Fmsgspec","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcrist%2Fmsgspec/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcrist%2Fmsgspec/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcrist%2Fmsgspec/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jcrist","download_url":"https://codeload.github.com/jcrist/msgspec/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254249199,"owners_count":22039029,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["deserialization","json","json-schema","jsonschema","messagepack","msgpack","openapi3","python","schema","serde","serialization","toml","validation","yaml"],"created_at":"2024-07-31T15:01:14.634Z","updated_at":"2026-04-08T21:03:34.644Z","avatar_url":"https://github.com/jcrist.png","language":"Python","readme":"\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://jcristharif.com/msgspec/\"\u003e\n    \u003cimg src=\"https://raw.githubusercontent.com/jcrist/msgspec/main/docs/_static/msgspec-logo-light.svg\" width=\"35%\" alt=\"msgspec\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\u003cdiv align=\"center\"\u003e\n\n[![CI](https://github.com/jcrist/msgspec/actions/workflows/ci.yml/badge.svg)](https://github.com/jcrist/msgspec/actions/workflows/ci.yml)\n[![Documentation](https://img.shields.io/badge/docs-latest-blue.svg)](https://jcristharif.com/msgspec/)\n[![License](https://img.shields.io/github/license/jcrist/msgspec.svg)](https://github.com/jcrist/msgspec/blob/main/LICENSE)\n[![PyPI Version](https://img.shields.io/pypi/v/msgspec.svg)](https://pypi.org/project/msgspec/)\n[![Conda Version](https://img.shields.io/conda/vn/conda-forge/msgspec.svg)](https://anaconda.org/conda-forge/msgspec)\n[![Code Coverage](https://codecov.io/gh/jcrist/msgspec/branch/main/graph/badge.svg)](https://app.codecov.io/gh/jcrist/msgspec)\n\n\u003c/div\u003e\n\n`msgspec` is a *fast* serialization and validation library, with builtin\nsupport for [JSON](https://json.org), [MessagePack](https://msgpack.org),\n[YAML](https://yaml.org), and [TOML](https://toml.io/en/). It features:\n\n- 🚀 **High performance encoders/decoders** for common protocols. The JSON and\n  MessagePack implementations regularly\n  [benchmark](https://jcristharif.com/msgspec/benchmarks.html) as the fastest\n  options for Python.\n\n- 🎉 **Support for a wide variety of Python types**. Additional types may be\n  supported through\n  [extensions](https://jcristharif.com/msgspec/extending.html).\n\n- 🔍 **Zero-cost schema validation** using familiar Python type annotations. In\n  [benchmarks](https://jcristharif.com/msgspec/benchmarks.html) `msgspec`\n  decodes *and* validates JSON faster than\n  [orjson](https://github.com/ijl/orjson) can decode it alone.\n\n- ✨ **A speedy Struct type** for representing structured data. If you already\n  use [dataclasses](https://docs.python.org/3/library/dataclasses.html) or\n  [attrs](https://www.attrs.org/en/stable/),\n  [structs](https://jcristharif.com/msgspec/structs.html) should feel familiar.\n  However, they're\n  [5-60x faster](https://jcristharif.com/msgspec/benchmarks.html#structs)\n  for common operations.\n\nAll of this is included in a\n[lightweight library](https://jcristharif.com/msgspec/benchmarks.html#library-size)\nwith no required dependencies.\n\n---\n\n`msgspec` may be used for serialization alone, as a faster JSON or\nMessagePack library. For the greatest benefit though, we recommend using\n`msgspec` to handle the full serialization \u0026 validation workflow:\n\n**Define** your message schemas using standard Python type annotations.\n\n```python\n\u003e\u003e\u003e import msgspec\n\n\u003e\u003e\u003e class User(msgspec.Struct):\n...     \"\"\"A new type describing a User\"\"\"\n...     name: str\n...     groups: set[str] = set()\n...     email: str | None = None\n```\n\n**Encode** messages as JSON, or one of the many other supported protocols.\n\n```python\n\u003e\u003e\u003e alice = User(\"alice\", groups={\"admin\", \"engineering\"})\n\n\u003e\u003e\u003e alice\nUser(name='alice', groups={\"admin\", \"engineering\"}, email=None)\n\n\u003e\u003e\u003e msg = msgspec.json.encode(alice)\n\n\u003e\u003e\u003e msg\nb'{\"name\":\"alice\",\"groups\":[\"admin\",\"engineering\"],\"email\":null}'\n```\n\n**Decode** messages back into Python objects, with optional schema validation.\n\n```python\n\u003e\u003e\u003e msgspec.json.decode(msg, type=User)\nUser(name='alice', groups={\"admin\", \"engineering\"}, email=None)\n\n\u003e\u003e\u003e msgspec.json.decode(b'{\"name\":\"bob\",\"groups\":[123]}', type=User)\nTraceback (most recent call last):\n  File \"\u003cstdin\u003e\", line 1, in \u003cmodule\u003e\nmsgspec.ValidationError: Expected `str`, got `int` - at `$.groups[0]`\n```\n\n`msgspec` is designed to be as performant as possible, while retaining some of\nthe nicities of validation libraries like\n[pydantic](https://docs.pydantic.dev/latest/). For supported types,\nencoding/decoding a message with `msgspec` can be\n[~10-80x faster than alternative libraries](https://jcristharif.com/msgspec/benchmarks.html).\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://jcristharif.com/msgspec/benchmarks.html\"\u003e\n    \u003cimg src=\"https://raw.githubusercontent.com/jcrist/msgspec/main/docs/_static/bench-validation.svg\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\nSee [the documentation](https://jcristharif.com/msgspec/) for more information.\n\n\n## LICENSE\n\nNew BSD. See the\n[License File](https://github.com/jcrist/msgspec/blob/main/LICENSE).\n","funding_links":[],"categories":["Python","yaml"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjcrist%2Fmsgspec","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjcrist%2Fmsgspec","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjcrist%2Fmsgspec/lists"}