msgspec-arise 0.20.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. msgspec_arise-0.20.1/.cibuildwheel.toml +5 -0
  2. msgspec_arise-0.20.1/LICENSE +27 -0
  3. msgspec_arise-0.20.1/MANIFEST.in +9 -0
  4. msgspec_arise-0.20.1/PKG-INFO +149 -0
  5. msgspec_arise-0.20.1/README.md +123 -0
  6. msgspec_arise-0.20.1/pyproject.toml +126 -0
  7. msgspec_arise-0.20.1/setup.cfg +4 -0
  8. msgspec_arise-0.20.1/setup.py +66 -0
  9. msgspec_arise-0.20.1/src/msgspec/__init__.py +28 -0
  10. msgspec_arise-0.20.1/src/msgspec/__init__.pyi +231 -0
  11. msgspec_arise-0.20.1/src/msgspec/_core.c +22708 -0
  12. msgspec_arise-0.20.1/src/msgspec/_json_schema.py +439 -0
  13. msgspec_arise-0.20.1/src/msgspec/_typing_utils.py +42 -0
  14. msgspec_arise-0.20.1/src/msgspec/_typing_utils.pyi +6 -0
  15. msgspec_arise-0.20.1/src/msgspec/_utils.py +312 -0
  16. msgspec_arise-0.20.1/src/msgspec/_version.py +24 -0
  17. msgspec_arise-0.20.1/src/msgspec/atof.h +439 -0
  18. msgspec_arise-0.20.1/src/msgspec/atof_consts.h +675 -0
  19. msgspec_arise-0.20.1/src/msgspec/common.h +23 -0
  20. msgspec_arise-0.20.1/src/msgspec/inspect.py +1004 -0
  21. msgspec_arise-0.20.1/src/msgspec/itoa.h +190 -0
  22. msgspec_arise-0.20.1/src/msgspec/json.py +8 -0
  23. msgspec_arise-0.20.1/src/msgspec/json.pyi +122 -0
  24. msgspec_arise-0.20.1/src/msgspec/msgpack.py +7 -0
  25. msgspec_arise-0.20.1/src/msgspec/msgpack.pyi +114 -0
  26. msgspec_arise-0.20.1/src/msgspec/py.typed +0 -0
  27. msgspec_arise-0.20.1/src/msgspec/ryu.h +995 -0
  28. msgspec_arise-0.20.1/src/msgspec/structs.py +114 -0
  29. msgspec_arise-0.20.1/src/msgspec/structs.pyi +37 -0
  30. msgspec_arise-0.20.1/src/msgspec/toml.py +198 -0
  31. msgspec_arise-0.20.1/src/msgspec/yaml.py +193 -0
  32. msgspec_arise-0.20.1/src/msgspec_arise.egg-info/PKG-INFO +149 -0
  33. msgspec_arise-0.20.1/src/msgspec_arise.egg-info/SOURCES.txt +66 -0
  34. msgspec_arise-0.20.1/src/msgspec_arise.egg-info/dependency_links.txt +1 -0
  35. msgspec_arise-0.20.1/src/msgspec_arise.egg-info/requires.txt +9 -0
  36. msgspec_arise-0.20.1/src/msgspec_arise.egg-info/top_level.txt +1 -0
  37. msgspec_arise-0.20.1/tests/__init__.py +0 -0
  38. msgspec_arise-0.20.1/tests/conftest.py +94 -0
  39. msgspec_arise-0.20.1/tests/prof/__init__.py +0 -0
  40. msgspec_arise-0.20.1/tests/prof/perf/__init__.py +0 -0
  41. msgspec_arise-0.20.1/tests/prof/perf/conftest.py +42 -0
  42. msgspec_arise-0.20.1/tests/prof/perf/test_basic.py +19 -0
  43. msgspec_arise-0.20.1/tests/typing/__init__.py +0 -0
  44. msgspec_arise-0.20.1/tests/typing/basic_typing_examples.py +1170 -0
  45. msgspec_arise-0.20.1/tests/typing/conftest.py +8 -0
  46. msgspec_arise-0.20.1/tests/typing/test_mypy.py +33 -0
  47. msgspec_arise-0.20.1/tests/typing/test_pyright.py +29 -0
  48. msgspec_arise-0.20.1/tests/unit/__init__.py +0 -0
  49. msgspec_arise-0.20.1/tests/unit/conftest.py +53 -0
  50. msgspec_arise-0.20.1/tests/unit/test_JSONTestSuite.py +310 -0
  51. msgspec_arise-0.20.1/tests/unit/test_common.py +4575 -0
  52. msgspec_arise-0.20.1/tests/unit/test_constraints.py +809 -0
  53. msgspec_arise-0.20.1/tests/unit/test_convert.py +2567 -0
  54. msgspec_arise-0.20.1/tests/unit/test_cpylint.py +47 -0
  55. msgspec_arise-0.20.1/tests/unit/test_inspect.py +875 -0
  56. msgspec_arise-0.20.1/tests/unit/test_integration.py +38 -0
  57. msgspec_arise-0.20.1/tests/unit/test_json.py +3142 -0
  58. msgspec_arise-0.20.1/tests/unit/test_msgpack.py +1987 -0
  59. msgspec_arise-0.20.1/tests/unit/test_performance.py +51 -0
  60. msgspec_arise-0.20.1/tests/unit/test_raw.py +135 -0
  61. msgspec_arise-0.20.1/tests/unit/test_schema.py +1292 -0
  62. msgspec_arise-0.20.1/tests/unit/test_struct.py +2679 -0
  63. msgspec_arise-0.20.1/tests/unit/test_struct_meta.py +652 -0
  64. msgspec_arise-0.20.1/tests/unit/test_to_builtins.py +656 -0
  65. msgspec_arise-0.20.1/tests/unit/test_toml.py +217 -0
  66. msgspec_arise-0.20.1/tests/unit/test_utils.py +227 -0
  67. msgspec_arise-0.20.1/tests/unit/test_yaml.py +176 -0
  68. msgspec_arise-0.20.1/tests/unit/utils.py +60 -0
@@ -0,0 +1,5 @@
1
+ [tool.cibuildwheel]
2
+ build = "cp39-* cp310-* cp311-* cp312-* cp313-* cp314-* cp314t-*"
3
+ build-frontend = "build[uv]"
4
+ test-command = "pytest {project}/tests/unit"
5
+ test-groups = ["test-unit"]
@@ -0,0 +1,27 @@
1
+ Copyright (c) 2021, Jim Crist-Harif
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without
5
+ modification, are permitted provided that the following conditions are met:
6
+
7
+ 1. Redistributions of source code must retain the above copyright notice, this
8
+ list of conditions and the following disclaimer.
9
+
10
+ 2. Redistributions in binary form must reproduce the above copyright notice,
11
+ this list of conditions and the following disclaimer in the documentation
12
+ and/or other materials provided with the distribution.
13
+
14
+ 3. Neither the name of the copyright holder nor the names of its contributors
15
+ may be used to endorse or promote products derived from this software
16
+ without specific prior written permission.
17
+
18
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
22
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,9 @@
1
+ prune .devcontainer
2
+ prune .github
3
+ prune benchmarks
4
+ prune docs
5
+ prune examples
6
+ prune scripts
7
+ exclude lychee.toml
8
+ exclude .*
9
+ include .cibuildwheel.toml
@@ -0,0 +1,149 @@
1
+ Metadata-Version: 2.4
2
+ Name: msgspec-arise
3
+ Version: 0.20.1
4
+ Summary: A fast serialization and validation library, with builtin support for JSON, MessagePack, YAML, and TOML.
5
+ Maintainer: Aleksandr Tseluyko
6
+ License-Expression: BSD-3-Clause
7
+ Project-URL: Homepage, https://github.com/Siyet/msgspec-arise
8
+ Project-URL: Issue Tracker, https://github.com/Siyet/msgspec-arise/issues
9
+ Project-URL: Source, https://github.com/Siyet/msgspec-arise
10
+ Keywords: JSON,MessagePack,TOML,YAML,msgpack,schema,serialization,validation
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Programming Language :: Python :: 3.10
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Programming Language :: Python :: 3.13
16
+ Classifier: Programming Language :: Python :: 3.14
17
+ Requires-Python: >=3.10
18
+ Description-Content-Type: text/markdown
19
+ License-File: LICENSE
20
+ Provides-Extra: toml
21
+ Requires-Dist: tomli; python_version < "3.11" and extra == "toml"
22
+ Requires-Dist: tomli_w; extra == "toml"
23
+ Provides-Extra: yaml
24
+ Requires-Dist: pyyaml; extra == "yaml"
25
+ Dynamic: license-file
26
+
27
+ <p align="center">
28
+ <a href="https://github.com/Siyet/msgspec-arise">
29
+ <img src="https://raw.githubusercontent.com/jcrist/msgspec/main/docs/_static/msgspec-logo-light.svg" width="35%" alt="msgspec-arise">
30
+ </a>
31
+ </p>
32
+
33
+ <div align="center">
34
+
35
+ [![CI](https://github.com/Siyet/msgspec-arise/actions/workflows/ci.yml/badge.svg)](https://github.com/Siyet/msgspec-arise/actions/workflows/ci.yml)
36
+ [![License](https://img.shields.io/github/license/Siyet/msgspec-arise.svg)](https://github.com/Siyet/msgspec-arise/blob/main/LICENSE)
37
+ [![PyPI Version](https://img.shields.io/pypi/v/msgspec-arise.svg)](https://pypi.org/project/msgspec-arise/)
38
+
39
+ </div>
40
+
41
+ > **Temporary community fork of [msgspec](https://github.com/jcrist/msgspec).**
42
+ > The original project is [no longer maintained](https://github.com/jcrist/msgspec/issues/990) — the sole owner is unreachable and the only other collaborator has stepped away.
43
+ > This fork exists to keep the project alive: merge pending fixes, review community PRs, and publish new releases.
44
+ > If `jcrist` returns and resumes maintenance, this fork will be archived.
45
+ > Drop-in replacement — `import msgspec` works as before.
46
+
47
+ `msgspec` is a *fast* serialization and validation library, with builtin
48
+ support for [JSON](https://json.org), [MessagePack](https://msgpack.org),
49
+ [YAML](https://yaml.org), and [TOML](https://toml.io/en/). It features:
50
+
51
+ - 🚀 **High performance encoders/decoders** for common protocols. The JSON and
52
+ MessagePack implementations regularly
53
+ [benchmark](https://siyet.github.io/msgspec-arise/benchmarks.html) as the fastest
54
+ options for Python.
55
+
56
+ - 🎉 **Support for a wide variety of Python types**. Additional types may be
57
+ supported through
58
+ [extensions](https://siyet.github.io/msgspec-arise/extending.html).
59
+
60
+ - 🔍 **Zero-cost schema validation** using familiar Python type annotations. In
61
+ [benchmarks](https://siyet.github.io/msgspec-arise/benchmarks.html) `msgspec`
62
+ decodes *and* validates JSON faster than
63
+ [orjson](https://github.com/ijl/orjson) can decode it alone.
64
+
65
+ - ✨ **A speedy Struct type** for representing structured data. If you already
66
+ use [dataclasses](https://docs.python.org/3/library/dataclasses.html) or
67
+ [attrs](https://www.attrs.org/en/stable/),
68
+ [structs](https://siyet.github.io/msgspec-arise/structs.html) should feel familiar.
69
+ However, they're
70
+ [5-60x faster](https://siyet.github.io/msgspec-arise/benchmarks.html#structs)
71
+ for common operations.
72
+
73
+ All of this is included in a
74
+ [lightweight library](https://siyet.github.io/msgspec-arise/benchmarks.html#library-size)
75
+ with no required dependencies.
76
+
77
+ ---
78
+
79
+ `msgspec` may be used for serialization alone, as a faster JSON or
80
+ MessagePack library. For the greatest benefit though, we recommend using
81
+ `msgspec` to handle the full serialization & validation workflow:
82
+
83
+ **Define** your message schemas using standard Python type annotations.
84
+
85
+ ```python
86
+ >>> import msgspec
87
+
88
+ >>> class User(msgspec.Struct):
89
+ ... """A new type describing a User"""
90
+ ... name: str
91
+ ... groups: set[str] = set()
92
+ ... email: str | None = None
93
+ ```
94
+
95
+ **Encode** messages as JSON, or one of the many other supported protocols.
96
+
97
+ ```python
98
+ >>> alice = User("alice", groups={"admin", "engineering"})
99
+
100
+ >>> alice
101
+ User(name='alice', groups={"admin", "engineering"}, email=None)
102
+
103
+ >>> msg = msgspec.json.encode(alice)
104
+
105
+ >>> msg
106
+ b'{"name":"alice","groups":["admin","engineering"],"email":null}'
107
+ ```
108
+
109
+ **Decode** messages back into Python objects, with optional schema validation.
110
+
111
+ ```python
112
+ >>> msgspec.json.decode(msg, type=User)
113
+ User(name='alice', groups={"admin", "engineering"}, email=None)
114
+
115
+ >>> msgspec.json.decode(b'{"name":"bob","groups":[123]}', type=User)
116
+ Traceback (most recent call last):
117
+ File "<stdin>", line 1, in <module>
118
+ msgspec.ValidationError: Expected `str`, got `int` - at `$.groups[0]`
119
+ ```
120
+
121
+ `msgspec` is designed to be as performant as possible, while retaining some of
122
+ the nicities of validation libraries like
123
+ [pydantic](https://docs.pydantic.dev/latest/). For supported types,
124
+ encoding/decoding a message with `msgspec` can be
125
+ [~10-80x faster than alternative libraries](https://siyet.github.io/msgspec-arise/benchmarks.html).
126
+
127
+ <p align="center">
128
+ <a href="https://siyet.github.io/msgspec-arise/benchmarks.html">
129
+ <img src="https://raw.githubusercontent.com/jcrist/msgspec/main/docs/_static/bench-validation.svg">
130
+ </a>
131
+ </p>
132
+
133
+ See [the documentation](https://siyet.github.io/msgspec-arise/) for more information.
134
+
135
+ ## Installation
136
+
137
+ ```bash
138
+ pip install msgspec-arise
139
+ ```
140
+
141
+ ## LICENSE
142
+
143
+ New BSD. See the
144
+ [License File](https://github.com/Siyet/msgspec-arise/blob/main/LICENSE).
145
+
146
+ ## Acknowledgments
147
+
148
+ This is a community fork of [msgspec](https://github.com/jcrist/msgspec) by Jim Crist-Harif.
149
+ All credit for the original library goes to the original author and contributors.
@@ -0,0 +1,123 @@
1
+ <p align="center">
2
+ <a href="https://github.com/Siyet/msgspec-arise">
3
+ <img src="https://raw.githubusercontent.com/jcrist/msgspec/main/docs/_static/msgspec-logo-light.svg" width="35%" alt="msgspec-arise">
4
+ </a>
5
+ </p>
6
+
7
+ <div align="center">
8
+
9
+ [![CI](https://github.com/Siyet/msgspec-arise/actions/workflows/ci.yml/badge.svg)](https://github.com/Siyet/msgspec-arise/actions/workflows/ci.yml)
10
+ [![License](https://img.shields.io/github/license/Siyet/msgspec-arise.svg)](https://github.com/Siyet/msgspec-arise/blob/main/LICENSE)
11
+ [![PyPI Version](https://img.shields.io/pypi/v/msgspec-arise.svg)](https://pypi.org/project/msgspec-arise/)
12
+
13
+ </div>
14
+
15
+ > **Temporary community fork of [msgspec](https://github.com/jcrist/msgspec).**
16
+ > The original project is [no longer maintained](https://github.com/jcrist/msgspec/issues/990) — the sole owner is unreachable and the only other collaborator has stepped away.
17
+ > This fork exists to keep the project alive: merge pending fixes, review community PRs, and publish new releases.
18
+ > If `jcrist` returns and resumes maintenance, this fork will be archived.
19
+ > Drop-in replacement — `import msgspec` works as before.
20
+
21
+ `msgspec` is a *fast* serialization and validation library, with builtin
22
+ support for [JSON](https://json.org), [MessagePack](https://msgpack.org),
23
+ [YAML](https://yaml.org), and [TOML](https://toml.io/en/). It features:
24
+
25
+ - 🚀 **High performance encoders/decoders** for common protocols. The JSON and
26
+ MessagePack implementations regularly
27
+ [benchmark](https://siyet.github.io/msgspec-arise/benchmarks.html) as the fastest
28
+ options for Python.
29
+
30
+ - 🎉 **Support for a wide variety of Python types**. Additional types may be
31
+ supported through
32
+ [extensions](https://siyet.github.io/msgspec-arise/extending.html).
33
+
34
+ - 🔍 **Zero-cost schema validation** using familiar Python type annotations. In
35
+ [benchmarks](https://siyet.github.io/msgspec-arise/benchmarks.html) `msgspec`
36
+ decodes *and* validates JSON faster than
37
+ [orjson](https://github.com/ijl/orjson) can decode it alone.
38
+
39
+ - ✨ **A speedy Struct type** for representing structured data. If you already
40
+ use [dataclasses](https://docs.python.org/3/library/dataclasses.html) or
41
+ [attrs](https://www.attrs.org/en/stable/),
42
+ [structs](https://siyet.github.io/msgspec-arise/structs.html) should feel familiar.
43
+ However, they're
44
+ [5-60x faster](https://siyet.github.io/msgspec-arise/benchmarks.html#structs)
45
+ for common operations.
46
+
47
+ All of this is included in a
48
+ [lightweight library](https://siyet.github.io/msgspec-arise/benchmarks.html#library-size)
49
+ with no required dependencies.
50
+
51
+ ---
52
+
53
+ `msgspec` may be used for serialization alone, as a faster JSON or
54
+ MessagePack library. For the greatest benefit though, we recommend using
55
+ `msgspec` to handle the full serialization & validation workflow:
56
+
57
+ **Define** your message schemas using standard Python type annotations.
58
+
59
+ ```python
60
+ >>> import msgspec
61
+
62
+ >>> class User(msgspec.Struct):
63
+ ... """A new type describing a User"""
64
+ ... name: str
65
+ ... groups: set[str] = set()
66
+ ... email: str | None = None
67
+ ```
68
+
69
+ **Encode** messages as JSON, or one of the many other supported protocols.
70
+
71
+ ```python
72
+ >>> alice = User("alice", groups={"admin", "engineering"})
73
+
74
+ >>> alice
75
+ User(name='alice', groups={"admin", "engineering"}, email=None)
76
+
77
+ >>> msg = msgspec.json.encode(alice)
78
+
79
+ >>> msg
80
+ b'{"name":"alice","groups":["admin","engineering"],"email":null}'
81
+ ```
82
+
83
+ **Decode** messages back into Python objects, with optional schema validation.
84
+
85
+ ```python
86
+ >>> msgspec.json.decode(msg, type=User)
87
+ User(name='alice', groups={"admin", "engineering"}, email=None)
88
+
89
+ >>> msgspec.json.decode(b'{"name":"bob","groups":[123]}', type=User)
90
+ Traceback (most recent call last):
91
+ File "<stdin>", line 1, in <module>
92
+ msgspec.ValidationError: Expected `str`, got `int` - at `$.groups[0]`
93
+ ```
94
+
95
+ `msgspec` is designed to be as performant as possible, while retaining some of
96
+ the nicities of validation libraries like
97
+ [pydantic](https://docs.pydantic.dev/latest/). For supported types,
98
+ encoding/decoding a message with `msgspec` can be
99
+ [~10-80x faster than alternative libraries](https://siyet.github.io/msgspec-arise/benchmarks.html).
100
+
101
+ <p align="center">
102
+ <a href="https://siyet.github.io/msgspec-arise/benchmarks.html">
103
+ <img src="https://raw.githubusercontent.com/jcrist/msgspec/main/docs/_static/bench-validation.svg">
104
+ </a>
105
+ </p>
106
+
107
+ See [the documentation](https://siyet.github.io/msgspec-arise/) for more information.
108
+
109
+ ## Installation
110
+
111
+ ```bash
112
+ pip install msgspec-arise
113
+ ```
114
+
115
+ ## LICENSE
116
+
117
+ New BSD. See the
118
+ [License File](https://github.com/Siyet/msgspec-arise/blob/main/LICENSE).
119
+
120
+ ## Acknowledgments
121
+
122
+ This is a community fork of [msgspec](https://github.com/jcrist/msgspec) by Jim Crist-Harif.
123
+ All credit for the original library goes to the original author and contributors.
@@ -0,0 +1,126 @@
1
+ [build-system]
2
+ requires = [
3
+ "setuptools>=80",
4
+ "setuptools-scm>=8",
5
+ ]
6
+ build-backend = "setuptools.build_meta"
7
+
8
+ [project]
9
+ name = "msgspec-arise"
10
+ dynamic = [
11
+ "version",
12
+ ]
13
+ description = "A fast serialization and validation library, with builtin support for JSON, MessagePack, YAML, and TOML."
14
+ readme = "README.md"
15
+ license = "BSD-3-Clause"
16
+ license-files = [
17
+ "LICENSE",
18
+ ]
19
+ requires-python = ">=3.10"
20
+ maintainers = [
21
+ { name = "Aleksandr Tseluyko" },
22
+ ]
23
+ keywords = [
24
+ "JSON",
25
+ "MessagePack",
26
+ "TOML",
27
+ "YAML",
28
+ "msgpack",
29
+ "schema",
30
+ "serialization",
31
+ "validation",
32
+ ]
33
+ classifiers = [
34
+ "Development Status :: 4 - Beta",
35
+ "Programming Language :: Python :: 3.10",
36
+ "Programming Language :: Python :: 3.11",
37
+ "Programming Language :: Python :: 3.12",
38
+ "Programming Language :: Python :: 3.13",
39
+ "Programming Language :: Python :: 3.14",
40
+ ]
41
+
42
+ [project.optional-dependencies]
43
+ toml = [
44
+ "tomli ; python_version < '3.11'",
45
+ "tomli_w",
46
+ ]
47
+ yaml = [
48
+ "pyyaml",
49
+ ]
50
+
51
+ [project.urls]
52
+ Homepage = "https://github.com/Siyet/msgspec-arise"
53
+ "Issue Tracker" = "https://github.com/Siyet/msgspec-arise/issues"
54
+ Source = "https://github.com/Siyet/msgspec-arise"
55
+
56
+ [dependency-groups]
57
+ bench = [
58
+ "cattrs==25.3.0",
59
+ "mashumaro==3.17",
60
+ "msgpack==1.1.2",
61
+ "orjson==3.11.4",
62
+ "ormsgpack==1.11.0",
63
+ "pydantic==2.12.4",
64
+ "python-rapidjson==1.22",
65
+ "pysimdjson==7.0.2",
66
+ "requests",
67
+ "ujson==5.11.0",
68
+ ]
69
+ dev = [
70
+ "rust-just",
71
+ ]
72
+ doc = [
73
+ "furo",
74
+ "ipython",
75
+ "myst-parser",
76
+ "sphinx",
77
+ "sphinx-copybutton",
78
+ "sphinx-design",
79
+ ]
80
+ hooks = [
81
+ "codespell==2.4.1",
82
+ "prek>=0.2.13",
83
+ "ruff==0.14.1",
84
+ ]
85
+ test-base = [
86
+ "pytest>=9",
87
+ ]
88
+ test-prof = [
89
+ { include-group = "test-base" },
90
+ "memray; sys_platform != 'win32'",
91
+ "pytest-benchmark",
92
+ "pytest-memray; sys_platform != 'win32'",
93
+ ]
94
+ test-typing = [
95
+ { include-group = "test-base" },
96
+ "mypy",
97
+ "pyright",
98
+ ]
99
+ test-unit = [
100
+ { include-group = "test-base" },
101
+ "attrs",
102
+ "coverage",
103
+ "msgpack",
104
+ "pyyaml",
105
+ "tomli; python_version < '3.11'",
106
+ "tomli-w",
107
+ ]
108
+
109
+ [tool.setuptools]
110
+ packages = ["msgspec"]
111
+
112
+ [tool.setuptools.package-dir]
113
+ "" = "src"
114
+
115
+ [tool.setuptools.exclude-package-data]
116
+ msgspec = [
117
+ "*.c",
118
+ "*.h",
119
+ ]
120
+
121
+ [tool.setuptools_scm]
122
+ version_file = "src/msgspec/_version.py"
123
+ parentdir_prefix_version = "msgspec-arise-"
124
+
125
+ [tool.uv.config-settings]
126
+ editable_mode = "compat"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,66 @@
1
+ import os
2
+ import platform
3
+ import sys
4
+
5
+ from setuptools import setup
6
+ from setuptools.extension import Extension
7
+
8
+ # Check for 32-bit windows builds, which currently aren't supported. We can't
9
+ # rely on `platform.architecture` here since users can still run 32-bit python
10
+ # builds on 64 bit architectures.
11
+ if sys.platform == "win32" and sys.maxsize == (2**31 - 1):
12
+ import textwrap
13
+
14
+ error = """
15
+ ====================================================================
16
+ `msgspec` currently doesn't support 32-bit Python windows builds. If
17
+ this is important for your use case, please comment on this issue:
18
+
19
+ https://github.com/jcrist/msgspec/issues/845
20
+ ====================================================================
21
+ """
22
+ print(textwrap.dedent(error))
23
+ exit(1)
24
+
25
+
26
+ SANITIZE = os.environ.get("MSGSPEC_SANITIZE", False)
27
+ COVERAGE = os.environ.get("MSGSPEC_COVERAGE", False)
28
+ DEBUG = os.environ.get("MSGSPEC_DEBUG", SANITIZE or COVERAGE)
29
+
30
+ extra_compile_args = []
31
+ extra_link_args = []
32
+ if SANITIZE:
33
+ extra_compile_args.extend(["-fsanitize=address", "-fsanitize=undefined"])
34
+ extra_link_args.extend(["-lasan", "-lubsan"])
35
+ if COVERAGE:
36
+ extra_compile_args.append("--coverage")
37
+ extra_link_args.append("-lgcov")
38
+ if DEBUG:
39
+ extra_compile_args.extend(["-O0", "-g", "-UNDEBUG"])
40
+ elif sys.platform != "win32":
41
+ extra_compile_args.extend(["-g0"])
42
+ if sys.platform == "darwin" and platform.machine().lower() == "arm64":
43
+ extra_compile_args.extend(["-flto=thin"])
44
+ extra_link_args.extend(["-flto=thin"])
45
+
46
+ # from https://py-free-threading.github.io/faq/#im-trying-to-build-a-library-on-windows-but-msvc-says-c-atomic-support-is-not-enabled
47
+ if sys.platform == "win32":
48
+ extra_compile_args.extend(
49
+ [
50
+ "/std:c11",
51
+ "/experimental:c11atomics",
52
+ ]
53
+ )
54
+
55
+ ext_modules = [
56
+ Extension(
57
+ "msgspec._core",
58
+ [os.path.join("src", "msgspec", "_core.c")],
59
+ extra_compile_args=extra_compile_args,
60
+ extra_link_args=extra_link_args,
61
+ )
62
+ ]
63
+
64
+ setup(
65
+ ext_modules=ext_modules,
66
+ )
@@ -0,0 +1,28 @@
1
+ from ._core import (
2
+ NODEFAULT,
3
+ UNSET,
4
+ DecodeError,
5
+ EncodeError,
6
+ Field as _Field,
7
+ Meta,
8
+ MsgspecError,
9
+ Raw,
10
+ Struct,
11
+ StructMeta,
12
+ UnsetType,
13
+ ValidationError,
14
+ convert,
15
+ defstruct,
16
+ to_builtins,
17
+ )
18
+
19
+
20
+ def field(*, default=NODEFAULT, default_factory=NODEFAULT, name=None):
21
+ return _Field(default=default, default_factory=default_factory, name=name)
22
+
23
+
24
+ field.__doc__ = _Field.__doc__
25
+
26
+
27
+ from . import inspect, json, msgpack, structs, toml, yaml
28
+ from ._version import __version__