tmsgpack 0.1.3__tar.gz → 0.2.0__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.
- tmsgpack-0.2.0/COPYING +2 -0
- tmsgpack-0.2.0/LICENSE +5 -0
- tmsgpack-0.2.0/MANIFEST.in +5 -0
- tmsgpack-0.2.0/PKG-INFO +29 -0
- tmsgpack-0.2.0/README.md +4 -0
- tmsgpack-0.2.0/pyproject.toml +7 -0
- {tmsgpack-0.1.3 → tmsgpack-0.2.0}/setup.cfg +8 -11
- tmsgpack-0.2.0/setup.py +23 -0
- tmsgpack-0.2.0/tmsgpack/__init__.py +22 -0
- tmsgpack-0.2.0/tmsgpack/cython/__init__.py +0 -0
- tmsgpack-0.2.0/tmsgpack/cython/api.py +46 -0
- tmsgpack-0.2.0/tmsgpack/cython/tmsgpack.c +29933 -0
- tmsgpack-0.2.0/tmsgpack/cython/tmsgpack.pyx +486 -0
- tmsgpack-0.2.0/tmsgpack/pure_python/__init__.py +11 -0
- tmsgpack-0.2.0/tmsgpack/pure_python/api.py +98 -0
- tmsgpack-0.2.0/tmsgpack/pure_python/buffers.py +77 -0
- tmsgpack-0.2.0/tmsgpack/pure_python/engine.py +218 -0
- tmsgpack-0.2.0/tmsgpack/pure_python/exceptions.py +2 -0
- tmsgpack-0.2.0/tmsgpack.egg-info/PKG-INFO +29 -0
- tmsgpack-0.2.0/tmsgpack.egg-info/SOURCES.txt +21 -0
- tmsgpack-0.1.3/COPYING +0 -14
- tmsgpack-0.1.3/MANIFEST.in +0 -5
- tmsgpack-0.1.3/PKG-INFO +0 -303
- tmsgpack-0.1.3/README.md +0 -279
- tmsgpack-0.1.3/pyproject.toml +0 -13
- tmsgpack-0.1.3/setup.py +0 -94
- tmsgpack-0.1.3/test/contexts_for_tests.py +0 -19
- tmsgpack-0.1.3/test/test_buffer.py +0 -32
- tmsgpack-0.1.3/test/test_case.py +0 -119
- tmsgpack-0.1.3/test/test_except.py +0 -46
- tmsgpack-0.1.3/test/test_format.py +0 -90
- tmsgpack-0.1.3/test/test_limits.py +0 -151
- tmsgpack-0.1.3/test/test_memoryview.py +0 -72
- tmsgpack-0.1.3/test/test_newspec.py +0 -68
- tmsgpack-0.1.3/test/test_pack.py +0 -127
- tmsgpack-0.1.3/test/test_roundtrip.py +0 -51
- tmsgpack-0.1.3/test/test_seq.py +0 -41
- tmsgpack-0.1.3/test/test_sequnpack.py +0 -133
- tmsgpack-0.1.3/test/test_subtype.py +0 -26
- tmsgpack-0.1.3/test/test_trace_from_x.py +0 -78
- tmsgpack-0.1.3/test/test_typed_objects.py +0 -87
- tmsgpack-0.1.3/test/test_unpack.py +0 -33
- tmsgpack-0.1.3/tmsgpack/__init__.py +0 -131
- tmsgpack-0.1.3/tmsgpack/_ctmsgpack.cpp +0 -19260
- tmsgpack-0.1.3/tmsgpack/_ctmsgpack.pyx +0 -4
- tmsgpack-0.1.3/tmsgpack/_packer.pyx +0 -276
- tmsgpack-0.1.3/tmsgpack/_unpacker.pyx +0 -377
- tmsgpack-0.1.3/tmsgpack/buff_converter.h +0 -8
- tmsgpack-0.1.3/tmsgpack/exceptions.py +0 -48
- tmsgpack-0.1.3/tmsgpack/fallback.py +0 -656
- tmsgpack-0.1.3/tmsgpack/pack.h +0 -71
- tmsgpack-0.1.3/tmsgpack/pack_template.h +0 -725
- tmsgpack-0.1.3/tmsgpack/sysdep.h +0 -194
- tmsgpack-0.1.3/tmsgpack/unpack.h +0 -256
- tmsgpack-0.1.3/tmsgpack/unpack_define.h +0 -95
- tmsgpack-0.1.3/tmsgpack/unpack_template.h +0 -401
- tmsgpack-0.1.3/tmsgpack.egg-info/PKG-INFO +0 -303
- tmsgpack-0.1.3/tmsgpack.egg-info/SOURCES.txt +0 -40
- {tmsgpack-0.1.3 → tmsgpack-0.2.0}/tmsgpack.egg-info/dependency_links.txt +0 -0
- {tmsgpack-0.1.3 → tmsgpack-0.2.0}/tmsgpack.egg-info/top_level.txt +0 -0
tmsgpack-0.2.0/COPYING
ADDED
tmsgpack-0.2.0/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.
|
tmsgpack-0.2.0/PKG-INFO
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: tmsgpack
|
|
3
|
+
Version: 0.2.0
|
|
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.
|
tmsgpack-0.2.0/README.md
ADDED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
[metadata]
|
|
2
2
|
name = tmsgpack
|
|
3
|
-
version =
|
|
4
|
-
license =
|
|
5
|
-
author =
|
|
3
|
+
version = 0.2.0
|
|
4
|
+
license = MIT
|
|
5
|
+
author = Yaakov Belch
|
|
6
6
|
author_email = yaakov.belch@gmail.com
|
|
7
|
-
description = Typed MessagePack serializer (
|
|
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
|
|
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
|
|
14
|
-
Tracker = https://github.com/Yaakov-Belch/tmsgpack
|
|
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
|
tmsgpack-0.2.0/setup.py
ADDED
|
@@ -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.0' #
|
|
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()
|