sltcore 0.2.0__tar.gz → 0.2.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.
sltcore-0.2.1/PKG-INFO ADDED
@@ -0,0 +1,106 @@
1
+ Metadata-Version: 2.4
2
+ Name: sltcore
3
+ Version: 0.2.1
4
+ Summary: A toolkit for handling structured data layouts and bit-level operations.
5
+ Project-URL: Homepage, https://github.com/fangface-hub/StructLayoutToolkitCore
6
+ Project-URL: Documentation, https://readthedocs.org
7
+ Project-URL: Repository, https://github.com/fangface-hub/StructLayoutToolkitCore
8
+ Project-URL: Issues, https://github.com/fangface-hub/StructLayoutToolkitCore/issues
9
+ Author: fangface
10
+ License-Expression: MIT
11
+ License-File: LICENSE
12
+ Keywords: bit,byte,data,deserialization,layout,serialization,struct
13
+ Requires-Python: >=3.12
14
+ Description-Content-Type: text/markdown
15
+
16
+ # StructLayoutToolkitCore
17
+
18
+ stlcore is a minimal, high‑cohesion core library for bit‑accurate binary slicing. It provides the fundamental primitives (bits_get, bits_set, InfoSize) required to build struct layout analyzers, binary editors, protocol inspectors, and low‑level testing tools. Designed for clarity, correctness, and composability.
19
+
20
+ ## What You Can Do After Installing sltcore
21
+
22
+ sltcore provides a minimal and consistent bit-level abstraction layer for building higher‑level tools such as binary editors, protocol analyzers, and structured layout systems.
23
+
24
+ After installing the package, you can:
25
+
26
+ - Extract arbitrary bit ranges from a bytearray using bits_get
27
+ - Write arbitrary bit ranges into a bytearray using bits_set
28
+ - Represent sizes and offsets uniformly with InfoSize
29
+ - Build structured binary layouts on top of a stable bit‑operation core
30
+
31
+ ## Quick Examples: bits_get / bits_set
32
+
33
+ ```python
34
+
35
+ from sltcore.types import InfoSize, Info
36
+ from sltcore.bits import bits_get, bits_set
37
+
38
+ buf = bytearray(b"\x12\x34\x56\x78")
39
+
40
+ # Extract 4 bits at offset (1 byte, 0 bits)
41
+ value = bits_get(buf, InfoSize(1, 0), InfoSize(0, 4))
42
+ print(value.to_hex) # 0x3
43
+
44
+ # Write 5 bits at offset (2 bytes, 3 bits)
45
+ bits_set(buf, InfoSize(2, 3), InfoSize(0, 5), 0b10101)
46
+ print(buf.hex()) # 12345578
47
+
48
+ ```
49
+
50
+ ## sltcore.type.InfoSize
51
+
52
+ InfoSize is a type that represents offsets and sizes in a unified way.
53
+ It supports addition and subtraction, and stores both byte and bit components.
54
+
55
+ - byte: the byte component
56
+ - bit: the bit component (0–7)
57
+
58
+ always normalized so that bit < 8
59
+
60
+ It is used for both offset and size, allowing consistent structural layout definitions.
61
+
62
+ ## sltcore.type.Info
63
+
64
+ Info stores an InfoSize and a raw integer value.
65
+
66
+ - The value returned by bits_get is an Info instance
67
+ - The value passed to bits_set is also an Info instance
68
+
69
+ This allows higher‑level code to treat extracted fields as structured units rather than plain integers.
70
+
71
+ ## sltcore.bits.bits_get
72
+
73
+ bits_get extracts a field from a bytearray using an offset and size, and returns an Info object.
74
+
75
+ Input:
76
+
77
+ - bytearray buffer
78
+ - InfoSize offset
79
+ - InfoSize size
80
+
81
+ Output:
82
+
83
+ - Info containing the extracted value and its size
84
+
85
+ ## sltcore.bits.bits_set
86
+
87
+ bits_set writes a value into a bytearray at the specified offset.
88
+
89
+ Input:
90
+
91
+ - bytearray buffer
92
+ - InfoSize offset
93
+ - Info value (which includes its size)
94
+
95
+ The function masks and replaces the target bit range inside the buffer.
96
+
97
+ ## Documentation
98
+
99
+ For detailed usage, examples, and parameter descriptions, refer to the docstrings via:
100
+
101
+ python
102
+
103
+ - help(sltcore.type.InfoSize)
104
+ - help(sltcore.type.Info)
105
+ - help(sltcore.bits.bits_get)
106
+ - help(sltcore.bits.bits_set)
@@ -0,0 +1,91 @@
1
+ # StructLayoutToolkitCore
2
+
3
+ stlcore is a minimal, high‑cohesion core library for bit‑accurate binary slicing. It provides the fundamental primitives (bits_get, bits_set, InfoSize) required to build struct layout analyzers, binary editors, protocol inspectors, and low‑level testing tools. Designed for clarity, correctness, and composability.
4
+
5
+ ## What You Can Do After Installing sltcore
6
+
7
+ sltcore provides a minimal and consistent bit-level abstraction layer for building higher‑level tools such as binary editors, protocol analyzers, and structured layout systems.
8
+
9
+ After installing the package, you can:
10
+
11
+ - Extract arbitrary bit ranges from a bytearray using bits_get
12
+ - Write arbitrary bit ranges into a bytearray using bits_set
13
+ - Represent sizes and offsets uniformly with InfoSize
14
+ - Build structured binary layouts on top of a stable bit‑operation core
15
+
16
+ ## Quick Examples: bits_get / bits_set
17
+
18
+ ```python
19
+
20
+ from sltcore.types import InfoSize, Info
21
+ from sltcore.bits import bits_get, bits_set
22
+
23
+ buf = bytearray(b"\x12\x34\x56\x78")
24
+
25
+ # Extract 4 bits at offset (1 byte, 0 bits)
26
+ value = bits_get(buf, InfoSize(1, 0), InfoSize(0, 4))
27
+ print(value.to_hex) # 0x3
28
+
29
+ # Write 5 bits at offset (2 bytes, 3 bits)
30
+ bits_set(buf, InfoSize(2, 3), InfoSize(0, 5), 0b10101)
31
+ print(buf.hex()) # 12345578
32
+
33
+ ```
34
+
35
+ ## sltcore.type.InfoSize
36
+
37
+ InfoSize is a type that represents offsets and sizes in a unified way.
38
+ It supports addition and subtraction, and stores both byte and bit components.
39
+
40
+ - byte: the byte component
41
+ - bit: the bit component (0–7)
42
+
43
+ always normalized so that bit < 8
44
+
45
+ It is used for both offset and size, allowing consistent structural layout definitions.
46
+
47
+ ## sltcore.type.Info
48
+
49
+ Info stores an InfoSize and a raw integer value.
50
+
51
+ - The value returned by bits_get is an Info instance
52
+ - The value passed to bits_set is also an Info instance
53
+
54
+ This allows higher‑level code to treat extracted fields as structured units rather than plain integers.
55
+
56
+ ## sltcore.bits.bits_get
57
+
58
+ bits_get extracts a field from a bytearray using an offset and size, and returns an Info object.
59
+
60
+ Input:
61
+
62
+ - bytearray buffer
63
+ - InfoSize offset
64
+ - InfoSize size
65
+
66
+ Output:
67
+
68
+ - Info containing the extracted value and its size
69
+
70
+ ## sltcore.bits.bits_set
71
+
72
+ bits_set writes a value into a bytearray at the specified offset.
73
+
74
+ Input:
75
+
76
+ - bytearray buffer
77
+ - InfoSize offset
78
+ - Info value (which includes its size)
79
+
80
+ The function masks and replaces the target bit range inside the buffer.
81
+
82
+ ## Documentation
83
+
84
+ For detailed usage, examples, and parameter descriptions, refer to the docstrings via:
85
+
86
+ python
87
+
88
+ - help(sltcore.type.InfoSize)
89
+ - help(sltcore.type.Info)
90
+ - help(sltcore.bits.bits_get)
91
+ - help(sltcore.bits.bits_set)
@@ -1,6 +1,8 @@
1
1
  [project]
2
2
  name = "sltcore"
3
- version = "0.2.0"
3
+ version = "0.2.1"
4
+ license = "MIT"
5
+ license-files = ["LICENSE"]
4
6
  description = "A toolkit for handling structured data layouts and bit-level operations."
5
7
  readme = "README.md"
6
8
  authors = [
@@ -8,13 +10,20 @@ authors = [
8
10
  ]
9
11
  requires-python = ">=3.12"
10
12
  dependencies = []
13
+ keywords = ["struct", "byte", "bit", "layout", "data", "serialization", "deserialization"]
14
+
15
+ [project.urls]
16
+ Homepage = "https://github.com/fangface-hub/StructLayoutToolkitCore"
17
+ Documentation = "https://readthedocs.org"
18
+ Repository = "https://github.com/fangface-hub/StructLayoutToolkitCore"
19
+ Issues = "https://github.com/fangface-hub/StructLayoutToolkitCore/issues"
11
20
 
12
21
  [build-system]
13
22
  requires = ["hatchling"]
14
23
  build-backend = "hatchling.build"
15
24
 
16
25
  [tool.hatch.build.targets.wheel]
17
- packages = ["sltcore"]
26
+ packages = ["src/sltcore"]
18
27
 
19
28
  [dependency-groups]
20
29
  dev = [
sltcore-0.2.0/PKG-INFO DELETED
@@ -1,12 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: sltcore
3
- Version: 0.2.0
4
- Summary: A toolkit for handling structured data layouts and bit-level operations.
5
- Author: fangface
6
- License-File: LICENSE
7
- Requires-Python: >=3.12
8
- Description-Content-Type: text/markdown
9
-
10
- # StructLayoutToolkitCore
11
-
12
- stlcore is a minimal, high‑cohesion core library for bit‑accurate binary slicing. It provides the fundamental primitives (bits_get, bits_set, InfoSize) required to build struct layout analyzers, binary editors, protocol inspectors, and low‑level testing tools. Designed for clarity, correctness, and composability.
sltcore-0.2.0/README.md DELETED
@@ -1,3 +0,0 @@
1
- # StructLayoutToolkitCore
2
-
3
- stlcore is a minimal, high‑cohesion core library for bit‑accurate binary slicing. It provides the fundamental primitives (bits_get, bits_set, InfoSize) required to build struct layout analyzers, binary editors, protocol inspectors, and low‑level testing tools. Designed for clarity, correctness, and composability.
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes