{"id":21596,"library":"msgspec-m","title":"msgspec-m","description":"A fast serialization and validation library with builtin support for JSON, MessagePack, YAML, and TOML. Currently at version 0.19.3. This is a community fork of the original msgspec library, providing Python 3.14 and free-threading support. Release cadence is irregular.","status":"active","version":"0.19.3","language":"python","source_language":"en","source_url":"https://github.com/marimo-team/msgspec","tags":["serialization","validation","json","messagepack","yaml","toml","fork"],"install":[{"cmd":"pip install msgspec-m","lang":"bash","label":"Install msgspec-m"}],"dependencies":[],"imports":[{"note":"Since version 0.19.2, the package name was reverted to 'msgspec'; no alias needed.","wrong":"import msgspec_m as msgspec","symbol":"msgspec","correct":"import msgspec"},{"note":"This fork uses the same module structure as the original msgspec.","wrong":"from msgspec_m import json","symbol":"JSON","correct":"from msgspec import json"}],"quickstart":{"code":"import msgspec\n\n# Define a struct (similar to dataclass)\nclass Person(msgspec.Struct):\n    name: str\n    age: int\n\n# Encode to JSON\nperson = Person(name=\"Alice\", age=30)\nencoded = msgspec.json.encode(person)\nprint(encoded)  # b'{\"name\":\"Alice\",\"age\":30}'\n\n# Decode from JSON\ndecoded = msgspec.json.decode(encoded, type=Person)\nprint(decoded)  # Person(name='Alice', age=30)","lang":"python","description":"Basic usage: define a struct and encode/decode JSON."},"warnings":[{"fix":"Change 'import msgspec_m as msgspec' to 'import msgspec' and update any usage of 'msgspec_m' module path to 'msgspec'.","message":"Version 0.19.1 required 'import msgspec_m as msgspec'. Version 0.19.2 reverted to 'import msgspec'. If you were using 0.19.1, you must change all imports back to 'import msgspec'.","severity":"breaking","affected_versions":">=0.19.1, <0.19.2"},{"fix":"Run 'pip install msgspec-m' and in code use 'import msgspec'.","message":"The package is named 'msgspec-m' on PyPI, but the import name is 'msgspec'. Ensure you install 'msgspec-m' but import as 'import msgspec'.","severity":"gotcha","affected_versions":"all"},{"fix":"Use 'import msgspec' instead.","message":"Using 'import msgspec_m' directly is deprecated since version 0.19.2 and will likely be removed in a future release.","severity":"deprecated","affected_versions":">=0.19.2"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Install this fork: pip install msgspec-m","cause":"You installed the original 'msgspec' package via pip, but it may be outdated or you need this fork. The fork is installed as 'msgspec-m'.","error":"ModuleNotFoundError: No module named 'msgspec'"},{"fix":"Change your import to: import msgspec","cause":"You are trying to import 'msgspec_m', but since version 0.19.2 the import name is 'msgspec'.","error":"ModuleNotFoundError: No module named 'msgspec_m'"},{"fix":"Uninstall both: pip uninstall msgspec msgspec-m, then reinstall: pip install msgspec-m","cause":"You may have accidentally installed the original 'msgspec' package instead of 'msgspec-m', or the version is too old. The original msgspec may not include Struct.","error":"AttributeError: module 'msgspec' has no attribute 'Struct'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}