You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/source/changelog.rst
+84Lines changed: 84 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,6 +3,90 @@ Changelog
3
3
4
4
.. currentmodule:: msgspec
5
5
6
+
Version 0.20.0 (2025-01-03)
7
+
---------------------------
8
+
9
+
**🎉 MAJOR: Community Fork Release**
10
+
11
+
This is the first release of ``msgspec-x``, a community-driven fork of the original msgspec library by Jim Crist-Harif. This fork was created to accelerate community contributions and provide a platform for extended features while maintaining full backward compatibility.
12
+
13
+
**🚀 NEW MAJOR FEATURE: StructMeta Subclasses Support**
14
+
15
+
- **Add comprehensive support for StructMeta subclasses** - the primary feature that motivated this fork.
16
+
- Enable custom metaclasses that inherit from `StructMeta` to work seamlessly with all msgspec functions.
17
+
- **TECHNICAL**: Modified C code to use `PyType_IsSubtype()` instead of direct type comparison for StructMeta detection.
18
+
- Affected functions now support StructMeta subclasses:
19
+
20
+
- `msgspec.structs.asdict` - Convert struct instances to dictionaries
21
+
- `msgspec.structs.astuple` - Convert struct instances to tuples
22
+
- `msgspec.structs.replace` - Create modified copies of struct instances
23
+
- `msgspec.structs.force_setattr` - Force attribute setting on frozen structs
24
+
- JSON encoding/decoding operations
25
+
- MessagePack encoding/decoding operations
26
+
- `msgspec.convert` - Type conversion operations
27
+
- `msgspec.to_builtins` - Convert to builtin types
28
+
29
+
- Comprehensive test coverage for StructMeta subclasses including:
30
+
31
+
- Single-level StructMeta inheritance
32
+
- Multi-level StructMeta inheritance chains
33
+
- Integration with all struct utility functions
34
+
- Encoder/decoder compatibility testing
35
+
- Nested struct support with custom metaclasses
36
+
37
+
- **Use Cases**: This enables advanced users to create custom struct behaviors through metaclass programming while maintaining full compatibility with msgspec's serialization ecosystem.
38
+
39
+
**Project Rename and Fork**
40
+
41
+
- **BREAKING**: Project renamed from ``msgspec`` to ``msgspec-x``. Do not install both packages simultaneously.
42
+
- Fork created due to slow upstream maintenance and to enable faster community contribution cycles.
43
+
- All project metadata, URLs, and documentation updated to reflect the new ``msgspec-x`` identity.
44
+
- Repository moved to ``https://github.com/nightsailer/msgspec-x``.
45
+
- Maintainer changed to Night Sailer (nightsailer@gmail.com).
46
+
47
+
**Dual Namespace Architecture**
48
+
49
+
- Introduce dual namespace architecture to support both compatibility and extensions:
50
+
51
+
- ``msgspec`` namespace: 100% API compatibility with the original library for drop-in replacement.
52
+
- ``msgspec_x`` namespace: Extended features and community contributions (placeholder structure created).
53
+
54
+
- All existing code using ``import msgspec`` will continue to work without changes.
55
+
- New extended features will be available under ``msgspec_x`` namespace.
- Added clear warnings about not installing both ``msgspec`` and ``msgspec-x`` in the same environment.
62
+
- Updated versioneer configuration to use ``msgspec-x-`` prefix for source distributions.
63
+
64
+
**Documentation Overhaul**
65
+
66
+
- Comprehensive documentation update to reflect the project fork and new architecture.
67
+
- Added explanation of the dual namespace system and community-driven development model.
68
+
- Updated all GitHub links, issue tracker URLs, and example source references.
69
+
- Enhanced installation documentation with compatibility warnings.
70
+
- Updated contributing guidelines and security policies for the new project structure.
71
+
72
+
**Community and Development**
73
+
74
+
- Established faster review and merge cycles for community contributions.
75
+
- Updated GitHub issue templates and workflows for the new repository.
76
+
- Created placeholder structure for experimental features in ``msgspec_x`` namespace.
77
+
- Enhanced project documentation to welcome community contributions.
78
+
79
+
**Technical Infrastructure**
80
+
81
+
- Updated build configuration (``setup.py``, ``setup.cfg``, ``MANIFEST.in``) for the new package structure.
82
+
- Enhanced CI/CD workflows for the dual namespace architecture.
83
+
- Updated type stub files and package metadata for both namespaces.
84
+
- Maintained all existing performance characteristics and API compatibility.
85
+
86
+
**Acknowledgments**
87
+
88
+
This release acknowledges and thanks Jim Crist-Harif for creating the original msgspec library. This fork exists to complement and extend his excellent work, not to replace it.
Copy file name to clipboardExpand all lines: docs/source/structs.rst
+195Lines changed: 195 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -998,6 +998,201 @@ container types. It is your responsibility to ensure cycles with these objects
998
998
don't occur, as a cycle containing only ``gc=False`` structs will *never* be
999
999
collected (leading to a memory leak).
1000
1000
1001
+
1002
+
.. _struct-meta-subclasses:
1003
+
1004
+
StructMeta Subclasses (Advanced)
1005
+
-------------------------------
1006
+
1007
+
.. versionadded:: 0.20.0
1008
+
1009
+
``msgspec-x`` provides comprehensive support for custom metaclasses that inherit from `msgspec.StructMeta`. This advanced feature enables users to create custom struct behaviors through metaclass programming while maintaining full compatibility with msgspec's serialization ecosystem.
1010
+
1011
+
**What are StructMeta Subclasses?**
1012
+
1013
+
StructMeta subclasses allow you to extend or customize the behavior of struct creation and management by defining your own metaclass that inherits from `msgspec.StructMeta`. This enables advanced patterns like:
1014
+
1015
+
- Adding custom validation logic during struct class creation
1016
+
- Implementing custom field processing or transformation
1017
+
- Integrating with external frameworks or ORMs
1018
+
- Creating domain-specific struct variants with specialized behaviors
1019
+
1020
+
**Basic Usage**
1021
+
1022
+
Here's a simple example of creating and using a custom StructMeta subclass:
1023
+
1024
+
.. code-block:: python
1025
+
1026
+
>>>import msgspec
1027
+
>>>from msgspec import StructMeta
1028
+
1029
+
>>>classCustomMeta(StructMeta):
1030
+
..."""A custom metaclass that extends StructMeta"""
``msgspec-x`` achieves StructMeta subclass support by modifying the core C implementation to use `PyType_IsSubtype()` checks instead of direct type comparisons. This change affects all core msgspec operations including:
The implementation maintains full backward compatibility - existing code continues to work unchanged, while new code can take advantage of the enhanced metaclass support.
1183
+
1184
+
**Use Cases**
1185
+
1186
+
StructMeta subclasses enable advanced patterns such as:
1187
+
1188
+
- **Framework Integration**: Creating structs that automatically integrate with web frameworks, ORMs, or validation libraries
1189
+
- **Domain-Specific Languages**: Building specialized struct types for specific problem domains
1190
+
- **Automatic Documentation**: Metaclasses that generate documentation or schema information
1191
+
- **Validation Enhancement**: Adding complex validation logic at the class level
1192
+
- **Serialization Customization**: Implementing custom serialization behaviors for specific use cases
1193
+
1194
+
This feature is particularly valuable for library authors who want to build higher-level abstractions on top of msgspec's fast serialization capabilities.
0 commit comments