tmsgpack 0.1.4__tar.gz → 0.2.2__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 (61) hide show
  1. tmsgpack-0.2.2/COPYING +2 -0
  2. tmsgpack-0.2.2/LICENSE +5 -0
  3. tmsgpack-0.2.2/MANIFEST.in +5 -0
  4. tmsgpack-0.2.2/PKG-INFO +29 -0
  5. tmsgpack-0.2.2/README.md +4 -0
  6. tmsgpack-0.2.2/pyproject.toml +7 -0
  7. {tmsgpack-0.1.4 → tmsgpack-0.2.2}/setup.cfg +8 -11
  8. tmsgpack-0.2.2/setup.py +23 -0
  9. tmsgpack-0.2.2/tmsgpack/__init__.py +22 -0
  10. tmsgpack-0.2.2/tmsgpack/cython/__init__.py +0 -0
  11. tmsgpack-0.2.2/tmsgpack/cython/api.py +46 -0
  12. tmsgpack-0.2.2/tmsgpack/cython/tmsgpack.c +29933 -0
  13. tmsgpack-0.2.2/tmsgpack/cython/tmsgpack.pyx +486 -0
  14. tmsgpack-0.2.2/tmsgpack/pure_python/__init__.py +11 -0
  15. tmsgpack-0.2.2/tmsgpack/pure_python/api.py +98 -0
  16. tmsgpack-0.2.2/tmsgpack/pure_python/buffers.py +77 -0
  17. tmsgpack-0.2.2/tmsgpack/pure_python/engine.py +218 -0
  18. tmsgpack-0.2.2/tmsgpack/pure_python/exceptions.py +2 -0
  19. tmsgpack-0.2.2/tmsgpack.egg-info/PKG-INFO +29 -0
  20. tmsgpack-0.2.2/tmsgpack.egg-info/SOURCES.txt +21 -0
  21. tmsgpack-0.1.4/COPYING +0 -2
  22. tmsgpack-0.1.4/LICENSE +0 -201
  23. tmsgpack-0.1.4/MANIFEST.in +0 -5
  24. tmsgpack-0.1.4/PKG-INFO +0 -304
  25. tmsgpack-0.1.4/README.md +0 -279
  26. tmsgpack-0.1.4/pyproject.toml +0 -13
  27. tmsgpack-0.1.4/setup.py +0 -94
  28. tmsgpack-0.1.4/test/contexts_for_tests.py +0 -19
  29. tmsgpack-0.1.4/test/test_buffer.py +0 -32
  30. tmsgpack-0.1.4/test/test_case.py +0 -119
  31. tmsgpack-0.1.4/test/test_except.py +0 -46
  32. tmsgpack-0.1.4/test/test_format.py +0 -90
  33. tmsgpack-0.1.4/test/test_limits.py +0 -151
  34. tmsgpack-0.1.4/test/test_memoryview.py +0 -72
  35. tmsgpack-0.1.4/test/test_newspec.py +0 -68
  36. tmsgpack-0.1.4/test/test_pack.py +0 -127
  37. tmsgpack-0.1.4/test/test_roundtrip.py +0 -51
  38. tmsgpack-0.1.4/test/test_seq.py +0 -41
  39. tmsgpack-0.1.4/test/test_sequnpack.py +0 -133
  40. tmsgpack-0.1.4/test/test_subtype.py +0 -26
  41. tmsgpack-0.1.4/test/test_trace_from_x.py +0 -78
  42. tmsgpack-0.1.4/test/test_typed_objects.py +0 -87
  43. tmsgpack-0.1.4/test/test_unpack.py +0 -33
  44. tmsgpack-0.1.4/tmsgpack/__init__.py +0 -121
  45. tmsgpack-0.1.4/tmsgpack/_ctmsgpack.cpp +0 -19260
  46. tmsgpack-0.1.4/tmsgpack/_ctmsgpack.pyx +0 -4
  47. tmsgpack-0.1.4/tmsgpack/_packer.pyx +0 -276
  48. tmsgpack-0.1.4/tmsgpack/_unpacker.pyx +0 -377
  49. tmsgpack-0.1.4/tmsgpack/buff_converter.h +0 -8
  50. tmsgpack-0.1.4/tmsgpack/exceptions.py +0 -48
  51. tmsgpack-0.1.4/tmsgpack/fallback.py +0 -656
  52. tmsgpack-0.1.4/tmsgpack/pack.h +0 -71
  53. tmsgpack-0.1.4/tmsgpack/pack_template.h +0 -725
  54. tmsgpack-0.1.4/tmsgpack/sysdep.h +0 -194
  55. tmsgpack-0.1.4/tmsgpack/unpack.h +0 -256
  56. tmsgpack-0.1.4/tmsgpack/unpack_define.h +0 -95
  57. tmsgpack-0.1.4/tmsgpack/unpack_template.h +0 -401
  58. tmsgpack-0.1.4/tmsgpack.egg-info/PKG-INFO +0 -304
  59. tmsgpack-0.1.4/tmsgpack.egg-info/SOURCES.txt +0 -41
  60. {tmsgpack-0.1.4 → tmsgpack-0.2.2}/tmsgpack.egg-info/dependency_links.txt +0 -0
  61. {tmsgpack-0.1.4 → tmsgpack-0.2.2}/tmsgpack.egg-info/top_level.txt +0 -0
tmsgpack-0.2.2/COPYING ADDED
@@ -0,0 +1,2 @@
1
+ Copyright (C) 2025 Yaakov Belch <yaakov.belch@gmail.com>
2
+ Licensed under the MIT license. See LICENSE file for details.
tmsgpack-0.2.2/LICENSE ADDED
@@ -0,0 +1,5 @@
1
+ Copyright 2025 Yaakov Belch.
2
+
3
+ Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
4
+
5
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
@@ -0,0 +1,5 @@
1
+ include setup.py
2
+ include COPYING
3
+ include LICENSE
4
+ include README.md
5
+ recursive-include tmsgpack *.pyx *.c *.h
@@ -0,0 +1,29 @@
1
+ Metadata-Version: 2.4
2
+ Name: tmsgpack
3
+ Version: 0.2.2
4
+ Summary: Typed MessagePack serializer (inspired by but different from msgpack)
5
+ Home-page: https://github.com/Yaakov-Belch/tmsgpack
6
+ Author: Yaakov Belch
7
+ Author-email: yaakov.belch@gmail.com
8
+ License: MIT
9
+ Project-URL: Source, https://github.com/Yaakov-Belch/tmsgpack
10
+ Project-URL: Tracker, https://github.com/Yaakov-Belch/tmsgpack/issues
11
+ Project-URL: Python Package, https://github.com/Yaakov-Belch/tmsgpack/tree/main/Python
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.9
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Programming Language :: Python :: 3.14
19
+ Classifier: Programming Language :: Python :: Implementation :: CPython
20
+ Classifier: Intended Audience :: Developers
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+ License-File: COPYING
24
+ Dynamic: license-file
25
+
26
+ ## tmsgpack: Typed MessagePack serializer (inspired by but different from msgpack)
27
+
28
+ In addition to primitives (numbers, strings, and a handful of constants),
29
+ the tmsgpack format expresses **typed objects**: typed lists/dicts and typed byte-arrays.
@@ -0,0 +1,4 @@
1
+ ## tmsgpack: Typed MessagePack serializer (inspired by but different from msgpack)
2
+
3
+ In addition to primitives (numbers, strings, and a handful of constants),
4
+ the tmsgpack format expresses **typed objects**: typed lists/dicts and typed byte-arrays.
@@ -0,0 +1,7 @@
1
+ [build-system]
2
+ requires = [
3
+ "Cython~=3.0.0",
4
+ "setuptools >= 35.0.2",
5
+ ]
6
+ build-backend = "setuptools.build_meta"
7
+
@@ -1,17 +1,18 @@
1
1
  [metadata]
2
2
  name = tmsgpack
3
- version = attr: tmsgpack.__version__
4
- license = Apache-2.0
5
- author = Inada Naoki, Yaakov Belch
3
+ version = 0.2.2
4
+ license = MIT
5
+ author = Yaakov Belch
6
6
  author_email = yaakov.belch@gmail.com
7
- description = Typed MessagePack serializer (similar but incompatible with msgpack)
7
+ description = Typed MessagePack serializer (inspired by but different from msgpack)
8
8
  long_description = file: README.md
9
9
  long_description_content_type = text/markdown
10
- url = https://github.com/Yaakov-Belch/tmsgpack-py
10
+ url = https://github.com/Yaakov-Belch/tmsgpack
11
11
  python_requires = >=3.9
12
12
  project_urls =
13
- Source = https://github.com/Yaakov-Belch/tmsgpack-py
14
- Tracker = https://github.com/Yaakov-Belch/tmsgpack-py/issues
13
+ Source = https://github.com/Yaakov-Belch/tmsgpack
14
+ Tracker = https://github.com/Yaakov-Belch/tmsgpack/issues
15
+ Python Package = https://github.com/Yaakov-Belch/tmsgpack/tree/main/Python
15
16
  classifiers =
16
17
  Programming Language :: Python :: 3
17
18
  Programming Language :: Python :: 3.9
@@ -21,12 +22,8 @@ classifiers =
21
22
  Programming Language :: Python :: 3.13
22
23
  Programming Language :: Python :: 3.14
23
24
  Programming Language :: Python :: Implementation :: CPython
24
- Programming Language :: Python :: Implementation :: PyPy
25
25
  Intended Audience :: Developers
26
26
 
27
- [flake8]
28
- max_line_length = 100
29
-
30
27
  [egg_info]
31
28
  tag_build =
32
29
  tag_date = 0
@@ -0,0 +1,23 @@
1
+ from setuptools import setup, find_packages
2
+ from Cython.Build import cythonize
3
+ import glob
4
+
5
+ # Automatically find all .pyx files in src/
6
+ pyx_files = glob.glob("tmsgpack/cython/*.pyx")
7
+
8
+ print("Found packages:", find_packages())
9
+
10
+
11
+ setup(
12
+ name="tmsgpack",
13
+ packages=find_packages(),
14
+ ext_modules=cythonize(
15
+ pyx_files,
16
+ compiler_directives={
17
+ 'language_level': 3,
18
+ 'boundscheck': True,
19
+ 'wraparound': False,
20
+ 'cdivision': True,
21
+ }
22
+ )
23
+ )
@@ -0,0 +1,22 @@
1
+ """tmsgpack - Typed MessagePack serializer"""
2
+
3
+ ####################### Keep version in sync with setup.cfg #######################
4
+ __version__ = '0.2.2' #
5
+ ###################################################################################
6
+
7
+ __all__ = [
8
+ 'EncodeDecode', 'basic_codec', 'BasicCodec',
9
+ 'EncodeBuffer', 'DecodeBuffer',
10
+ 'ebuf_put_value', 'dbuf_take_value',
11
+ ]
12
+
13
+ def __getattr__(name):
14
+ if name in __all__:
15
+ from .cython.tmsgpack import EncodeBuffer, DecodeBuffer
16
+ from .cython.tmsgpack import ebuf_put_value, dbuf_take_value
17
+ from .cython.api import EncodeDecode, BasicCodec, basic_codec
18
+ return locals()[name]
19
+ elif name == 'pure_python':
20
+ return locals()[name]
21
+ raise AttributeError(f"module '{__name__}' has no attribute '{name}'")
22
+
File without changes
@@ -0,0 +1,46 @@
1
+ from typing import Any, Tuple
2
+ from dataclasses import dataclass
3
+ from tmsgpack.cython.tmsgpack import EncodeBuffer, DecodeBuffer
4
+ from tmsgpack.cython.tmsgpack import ebuf_put_value, dbuf_take_value
5
+
6
+ class EncodeDecode:
7
+ def encode(self, value, target=None):
8
+ codec_type, new_codec, new_value = self.prep_encode(value, target)
9
+ ebuf = EncodeBuffer()
10
+ self.ebuf_put_value(ebuf, codec_type)
11
+ if new_codec is None: ebuf.put_bytes(new_value)
12
+ else: new_codec.ebuf_put_value(ebuf, new_value)
13
+ return ebuf.as_bytes()
14
+
15
+ def ebuf_put_value(self, ebuf, value): ebuf_put_value(self, ebuf, value)
16
+
17
+ def decode(self, msg, source=None):
18
+ dbuf = DecodeBuffer(msg=msg, start=0, end=len(msg))
19
+ codec_type = self.dbuf_take_value(dbuf)
20
+ new_codec = self.decode_codec(codec_type, source)
21
+ value = new_codec.dbuf_take_value(dbuf)
22
+ return value
23
+
24
+ def dbuf_take_value(self, dbuf): return dbuf_take_value(self, dbuf)
25
+
26
+
27
+ @dataclass
28
+ class BasicCodec(EncodeDecode):
29
+ sort_keys = True
30
+ def prep_encode(self, value, target): return [None, self, value]
31
+
32
+ def decode_codec(self, codec_type, source):
33
+ if codec_type is None: return self
34
+ raise TMsgpackDecodingError(f'Unsupported codec_type: {codec_type}')
35
+
36
+ def decompose_value(self, value):
37
+ raise TMsgpackEncodingError(f'Unsupported value: {value}')
38
+
39
+ def value_from_bytes(self, obj_type, data: bytes):
40
+ raise TMsgpackDecodingError(f'No bytes extension defined: {obj_type=} {data=}')
41
+
42
+ def value_from_list(self, obj_type, values: list):
43
+ raise TMsgpackDecodingError(f'No tuple extension defined: {obj_type=} {values=}')
44
+
45
+
46
+ basic_codec = BasicCodec()