yapl-kit 0.3.0__tar.gz → 0.4.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.
Files changed (103) hide show
  1. yapl_kit-0.4.0/LICENSE +21 -0
  2. yapl_kit-0.4.0/MANIFEST.in +4 -0
  3. yapl_kit-0.4.0/PKG-INFO +13 -0
  4. yapl_kit-0.4.0/README.md +61 -0
  5. yapl_kit-0.4.0/native/Cargo.lock +193 -0
  6. yapl_kit-0.4.0/native/Cargo.toml +19 -0
  7. yapl_kit-0.4.0/native/README.md +111 -0
  8. yapl_kit-0.4.0/native/src/copying.rs +293 -0
  9. yapl_kit-0.4.0/native/src/encoding.rs +396 -0
  10. yapl_kit-0.4.0/native/src/lib.rs +19 -0
  11. yapl_kit-0.4.0/native/src/plan.rs +363 -0
  12. yapl_kit-0.4.0/native/src/trimming.rs +111 -0
  13. yapl_kit-0.4.0/pyproject.toml +112 -0
  14. yapl_kit-0.4.0/setup.cfg +4 -0
  15. yapl_kit-0.4.0/setup.py +40 -0
  16. {yapl_kit-0.3.0 → yapl_kit-0.4.0}/src/yapl/__init__.py +30 -3
  17. yapl_kit-0.4.0/src/yapl/_handlers.py +48 -0
  18. yapl_kit-0.4.0/src/yapl/_native.pyi +45 -0
  19. {yapl_kit-0.3.0 → yapl_kit-0.4.0}/src/yapl/_optional.py +2 -2
  20. {yapl_kit-0.3.0 → yapl_kit-0.4.0}/src/yapl/_validation.py +1 -1
  21. {yapl_kit-0.3.0 → yapl_kit-0.4.0}/src/yapl/config.py +105 -41
  22. yapl_kit-0.4.0/src/yapl/context.py +107 -0
  23. {yapl_kit-0.3.0 → yapl_kit-0.4.0}/src/yapl/extensions/buffering/__init__.py +3 -2
  24. {yapl_kit-0.3.0 → yapl_kit-0.4.0}/src/yapl/extensions/buffering/capture.py +17 -4
  25. yapl_kit-0.4.0/src/yapl/extensions/buffering/context.py +370 -0
  26. yapl_kit-0.4.0/src/yapl/extensions/buffering/flush.py +76 -0
  27. yapl_kit-0.4.0/src/yapl/extensions/buffering/models.py +345 -0
  28. {yapl_kit-0.3.0 → yapl_kit-0.4.0}/src/yapl/extensions/coloring/__init__.py +1 -1
  29. {yapl_kit-0.3.0 → yapl_kit-0.4.0}/src/yapl/extensions/coloring/colors.py +1 -1
  30. {yapl_kit-0.3.0 → yapl_kit-0.4.0}/src/yapl/extensions/coloring/models.py +39 -9
  31. {yapl_kit-0.3.0 → yapl_kit-0.4.0}/src/yapl/extensions/coloring/plain.py +48 -21
  32. {yapl_kit-0.3.0 → yapl_kit-0.4.0}/src/yapl/extensions/coloring/policy.py +3 -1
  33. {yapl_kit-0.3.0 → yapl_kit-0.4.0}/src/yapl/extensions/coloring/registry.py +2 -1
  34. {yapl_kit-0.3.0 → yapl_kit-0.4.0}/src/yapl/extensions/coloring/structured.py +16 -28
  35. {yapl_kit-0.3.0 → yapl_kit-0.4.0}/src/yapl/extensions/coloring/text.py +5 -1
  36. {yapl_kit-0.3.0 → yapl_kit-0.4.0}/src/yapl/extensions/formatting/__init__.py +5 -1
  37. yapl_kit-0.4.0/src/yapl/extensions/formatting/_helpers.py +137 -0
  38. yapl_kit-0.4.0/src/yapl/extensions/formatting/formatters.py +166 -0
  39. {yapl_kit-0.3.0 → yapl_kit-0.4.0}/src/yapl/extensions/formatting/json.py +1 -1
  40. {yapl_kit-0.3.0 → yapl_kit-0.4.0}/src/yapl/extensions/formatting/logfmt.py +1 -1
  41. {yapl_kit-0.3.0 → yapl_kit-0.4.0}/src/yapl/extensions/formatting/plain.py +20 -5
  42. yapl_kit-0.4.0/src/yapl/extensions/formatting/policy.py +145 -0
  43. {yapl_kit-0.3.0 → yapl_kit-0.4.0}/src/yapl/extensions/formatting/processors.py +155 -90
  44. {yapl_kit-0.3.0 → yapl_kit-0.4.0}/src/yapl/extensions/formatting/structured.py +157 -100
  45. {yapl_kit-0.3.0 → yapl_kit-0.4.0}/src/yapl/extensions/formatting/text.py +1 -1
  46. yapl_kit-0.4.0/src/yapl/extensions/integrations/__init__.py +5 -0
  47. yapl_kit-0.4.0/src/yapl/extensions/integrations/asgi.py +90 -0
  48. yapl_kit-0.4.0/src/yapl/extensions/integrations/jobs.py +62 -0
  49. yapl_kit-0.4.0/src/yapl/extensions/metrics.py +140 -0
  50. yapl_kit-0.4.0/src/yapl/extensions/opentelemetry.py +163 -0
  51. {yapl_kit-0.3.0 → yapl_kit-0.4.0}/src/yapl/extensions/queueing/__init__.py +7 -2
  52. {yapl_kit-0.3.0 → yapl_kit-0.4.0}/src/yapl/extensions/queueing/handler.py +258 -60
  53. {yapl_kit-0.3.0 → yapl_kit-0.4.0}/src/yapl/extensions/queueing/models.py +42 -7
  54. {yapl_kit-0.3.0 → yapl_kit-0.4.0}/src/yapl/extensions/queueing/queue.py +4 -2
  55. {yapl_kit-0.3.0 → yapl_kit-0.4.0}/src/yapl/extensions/queueing/worker.py +12 -4
  56. {yapl_kit-0.3.0 → yapl_kit-0.4.0}/src/yapl/extensions/tracing.py +11 -1
  57. {yapl_kit-0.3.0 → yapl_kit-0.4.0}/src/yapl/extensions/webhook/__init__.py +3 -3
  58. {yapl_kit-0.3.0 → yapl_kit-0.4.0}/src/yapl/extensions/webhook/client.py +71 -33
  59. {yapl_kit-0.3.0 → yapl_kit-0.4.0}/src/yapl/extensions/webhook/handler.py +139 -43
  60. {yapl_kit-0.3.0 → yapl_kit-0.4.0}/src/yapl/extensions/webhook/models.py +29 -7
  61. {yapl_kit-0.3.0 → yapl_kit-0.4.0}/src/yapl/extensions/webhook/payloads.py +67 -110
  62. yapl_kit-0.4.0/src/yapl/factory.py +1275 -0
  63. {yapl_kit-0.3.0 → yapl_kit-0.4.0}/src/yapl/filters/__init__.py +6 -0
  64. yapl_kit-0.4.0/src/yapl/filters/contracts.py +146 -0
  65. {yapl_kit-0.3.0 → yapl_kit-0.4.0}/src/yapl/filters/enrichment.py +58 -5
  66. yapl_kit-0.4.0/src/yapl/filters/noise.py +210 -0
  67. yapl_kit-0.4.0/src/yapl/filters/suppression.py +45 -0
  68. {yapl_kit-0.3.0 → yapl_kit-0.4.0}/src/yapl/levels.py +22 -24
  69. yapl_kit-0.4.0/src/yapl/logger.py +506 -0
  70. {yapl_kit-0.3.0 → yapl_kit-0.4.0}/src/yapl/stack/__init__.py +1 -1
  71. {yapl_kit-0.3.0 → yapl_kit-0.4.0}/src/yapl/stack/callsite.py +14 -8
  72. {yapl_kit-0.3.0 → yapl_kit-0.4.0}/src/yapl/stack/tracer.py +73 -25
  73. yapl_kit-0.4.0/src/yapl/status.py +103 -0
  74. yapl_kit-0.4.0/src/yapl/testing.py +61 -0
  75. yapl_kit-0.4.0/src/yapl/types.py +63 -0
  76. yapl_kit-0.4.0/src/yapl_kit/py.typed +1 -0
  77. yapl_kit-0.4.0/src/yapl_kit.egg-info/PKG-INFO +13 -0
  78. yapl_kit-0.4.0/src/yapl_kit.egg-info/SOURCES.txt +84 -0
  79. yapl_kit-0.4.0/src/yapl_kit.egg-info/requires.txt +6 -0
  80. yapl_kit-0.4.0/src/yapl_kit.egg-info/top_level.txt +2 -0
  81. yapl_kit-0.3.0/PKG-INFO +0 -493
  82. yapl_kit-0.3.0/PUBLIC.md +0 -481
  83. yapl_kit-0.3.0/pyproject.toml +0 -78
  84. yapl_kit-0.3.0/pyproject.toml.orig +0 -77
  85. yapl_kit-0.3.0/src/yapl/context.py +0 -64
  86. yapl_kit-0.3.0/src/yapl/extensions/buffering/context.py +0 -175
  87. yapl_kit-0.3.0/src/yapl/extensions/buffering/flush.py +0 -76
  88. yapl_kit-0.3.0/src/yapl/extensions/buffering/models.py +0 -85
  89. yapl_kit-0.3.0/src/yapl/extensions/formatting/_helpers.py +0 -53
  90. yapl_kit-0.3.0/src/yapl/extensions/formatting/formatters.py +0 -130
  91. yapl_kit-0.3.0/src/yapl/extensions/formatting/policy.py +0 -111
  92. yapl_kit-0.3.0/src/yapl/factory.py +0 -759
  93. yapl_kit-0.3.0/src/yapl/filters/suppression.py +0 -69
  94. yapl_kit-0.3.0/src/yapl/logger.py +0 -268
  95. yapl_kit-0.3.0/src/yapl/status.py +0 -29
  96. yapl_kit-0.3.0/src/yapl/testing.py +0 -42
  97. yapl_kit-0.3.0/src/yapl/types.py +0 -29
  98. {yapl_kit-0.3.0 → yapl_kit-0.4.0}/src/yapl/extensions/coloring/themes.py +0 -0
  99. {yapl_kit-0.3.0 → yapl_kit-0.4.0}/src/yapl/extensions/formatting/_types.py +0 -0
  100. {yapl_kit-0.3.0 → yapl_kit-0.4.0}/src/yapl/extensions/queueing/policy.py +0 -0
  101. {yapl_kit-0.3.0 → yapl_kit-0.4.0}/src/yapl/py.typed +0 -0
  102. {yapl_kit-0.3.0 → yapl_kit-0.4.0}/src/yapl_kit/__init__.py +0 -0
  103. /yapl_kit-0.3.0/src/yapl_kit/py.typed → /yapl_kit-0.4.0/src/yapl_kit.egg-info/dependency_links.txt +0 -0
yapl_kit-0.4.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 SirKaiMartin
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,4 @@
1
+ include native/Cargo.toml native/Cargo.lock
2
+ include native/README.md
3
+ recursive-include native/src *.rs
4
+ include README.md
@@ -0,0 +1,13 @@
1
+ Metadata-Version: 2.4
2
+ Name: yapl-kit
3
+ Version: 0.4.0
4
+ Summary: YetAnotherPythonLogger - a minimal, extensible logging toolkit built on top of Python's standard logging module.
5
+ Author: SirKaiMartin
6
+ License-Expression: MIT
7
+ Requires-Python: >=3.13
8
+ License-File: LICENSE
9
+ Provides-Extra: webhook
10
+ Requires-Dist: httpx>=0.28.1; extra == "webhook"
11
+ Provides-Extra: opentelemetry
12
+ Requires-Dist: opentelemetry-api>=1.45.2; extra == "opentelemetry"
13
+ Dynamic: license-file
@@ -0,0 +1,61 @@
1
+ <p align="center">
2
+ <img src="docs/public/branding/yapl_kit_icon_banner_right.png" alt="YAPL Kit: Yet Another Python Logger" width="560">
3
+ </p>
4
+
5
+ # YAPL Kit
6
+
7
+ Yet Another Python Logger: a dependency-light toolkit built on Python's standard
8
+ `logging` module. Keep your loggers, handlers, filters, and propagation while
9
+ adding structured context and bounded background delivery.
10
+
11
+ **[Documentation](https://yapl.yapl-kit.workers.dev/guide/)** |
12
+ **[Changelogs](https://yapl.yapl-kit.workers.dev/changelogs/)** |
13
+ **[Demos](https://yapl.yapl-kit.workers.dev/demos/)** |
14
+ **[Benchmarks](https://yapl.yapl-kit.workers.dev/benchmarks/)**
15
+
16
+ - Structured fields, scoped request context, and reusable bound loggers.
17
+ - Independent sink policies for processing, redaction, enrichment, and fields.
18
+ - Text, JSONL, logfmt, and structured output with optional terminal colors.
19
+ - Queue-backed delivery, bounded shutdown, buffering, and flight recorders.
20
+ - ASGI requests, job lifecycle helpers, and optional webhook/OpenTelemetry delivery.
21
+
22
+ All feature families ship in `yapl-kit`. The base install has no required
23
+ third-party Python runtime dependencies. A required native extension handles
24
+ event processing.
25
+
26
+ ## Installation
27
+
28
+ Use GIL-enabled CPython 3.13 or newer:
29
+
30
+ ```bash
31
+ uv add yapl-kit
32
+ # Or:
33
+ pip install yapl-kit
34
+ ```
35
+
36
+ Install `yapl-kit[webhook]` for HTTP delivery or `yapl-kit[opentelemetry]` for
37
+ OpenTelemetry. Compatible wheels include the native extension; source installs
38
+ need Rust 1.85 or newer and a platform C/C++ linker. See the
39
+ [native build guide](native/README.md).
40
+
41
+ ## Quick start
42
+
43
+ ```python
44
+ import yapl
45
+
46
+ with yapl.logging_session(level="INFO", outputs=("stdout",), format="text"):
47
+ log = yapl.get_logger(__name__)
48
+ with yapl.context(request_id="req-42"):
49
+ log.info("application_started", service="orders")
50
+ ```
51
+
52
+ The session configures logging and drains background work on exit within its
53
+ shutdown budget. Read the [guide](https://yapl.yapl-kit.workers.dev/guide/)
54
+ for the public API, configuration, output formats, and delivery guarantees.
55
+
56
+ ## Development
57
+
58
+ See [testing and development instructions](tests/README.md) for the locked uv
59
+ workflow, tests, native checks, and runnable examples, and
60
+ [docs/README.md](docs/README.md) for the Astro site.
61
+ YAPL is released under the [MIT license](LICENSE).
@@ -0,0 +1,193 @@
1
+ # This file is automatically @generated by Cargo.
2
+ # It is not intended for manual editing.
3
+ version = 4
4
+
5
+ [[package]]
6
+ name = "heck"
7
+ version = "0.5.0"
8
+ source = "registry+https://github.com/rust-lang/crates.io-index"
9
+ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
10
+
11
+ [[package]]
12
+ name = "itoa"
13
+ version = "1.0.18"
14
+ source = "registry+https://github.com/rust-lang/crates.io-index"
15
+ checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682"
16
+
17
+ [[package]]
18
+ name = "libc"
19
+ version = "0.2.191"
20
+ source = "registry+https://github.com/rust-lang/crates.io-index"
21
+ checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a"
22
+
23
+ [[package]]
24
+ name = "memchr"
25
+ version = "2.8.3"
26
+ source = "registry+https://github.com/rust-lang/crates.io-index"
27
+ checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98"
28
+
29
+ [[package]]
30
+ name = "once_cell"
31
+ version = "1.21.4"
32
+ source = "registry+https://github.com/rust-lang/crates.io-index"
33
+ checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
34
+
35
+ [[package]]
36
+ name = "portable-atomic"
37
+ version = "1.15.0"
38
+ source = "registry+https://github.com/rust-lang/crates.io-index"
39
+ checksum = "05c8b63e8d9609db387f0324918f81d68fe27748f084ef092fb35954d0539a85"
40
+
41
+ [[package]]
42
+ name = "proc-macro2"
43
+ version = "1.0.107"
44
+ source = "registry+https://github.com/rust-lang/crates.io-index"
45
+ checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9"
46
+ dependencies = [
47
+ "unicode-ident",
48
+ ]
49
+
50
+ [[package]]
51
+ name = "pyo3"
52
+ version = "0.30.1"
53
+ source = "registry+https://github.com/rust-lang/crates.io-index"
54
+ checksum = "229ca13b8a15bb0d1487b81ab975bfcd97513416499a8312011b6036e42e0de4"
55
+ dependencies = [
56
+ "libc",
57
+ "once_cell",
58
+ "portable-atomic",
59
+ "pyo3-build-config",
60
+ "pyo3-ffi",
61
+ "pyo3-macros",
62
+ ]
63
+
64
+ [[package]]
65
+ name = "pyo3-build-config"
66
+ version = "0.30.1"
67
+ source = "registry+https://github.com/rust-lang/crates.io-index"
68
+ checksum = "70130e2b6dd1ee589a8788026a429561ca5c40fa7a2fa7914c2282eddae24700"
69
+ dependencies = [
70
+ "target-lexicon",
71
+ ]
72
+
73
+ [[package]]
74
+ name = "pyo3-ffi"
75
+ version = "0.30.1"
76
+ source = "registry+https://github.com/rust-lang/crates.io-index"
77
+ checksum = "5e7ff73c555c286d212d4ce7e5fbda845a973c4f61bd5f160f5f2c3c2a04d1c4"
78
+ dependencies = [
79
+ "libc",
80
+ "pyo3-build-config",
81
+ ]
82
+
83
+ [[package]]
84
+ name = "pyo3-macros"
85
+ version = "0.30.1"
86
+ source = "registry+https://github.com/rust-lang/crates.io-index"
87
+ checksum = "c46d2e5862c7bb8207e3b639f713dda3c499933444784154c11d013c5a691b60"
88
+ dependencies = [
89
+ "proc-macro2",
90
+ "pyo3-macros-backend",
91
+ "quote",
92
+ "syn",
93
+ ]
94
+
95
+ [[package]]
96
+ name = "pyo3-macros-backend"
97
+ version = "0.30.1"
98
+ source = "registry+https://github.com/rust-lang/crates.io-index"
99
+ checksum = "38b89f066f2ae72a2aef52d1537ca2fcd104440ebfadee06e97aa90738a25b9b"
100
+ dependencies = [
101
+ "heck",
102
+ "proc-macro2",
103
+ "quote",
104
+ "syn",
105
+ ]
106
+
107
+ [[package]]
108
+ name = "quote"
109
+ version = "1.0.47"
110
+ source = "registry+https://github.com/rust-lang/crates.io-index"
111
+ checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001"
112
+ dependencies = [
113
+ "proc-macro2",
114
+ ]
115
+
116
+ [[package]]
117
+ name = "serde"
118
+ version = "1.0.229"
119
+ source = "registry+https://github.com/rust-lang/crates.io-index"
120
+ checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba"
121
+ dependencies = [
122
+ "serde_core",
123
+ ]
124
+
125
+ [[package]]
126
+ name = "serde_core"
127
+ version = "1.0.229"
128
+ source = "registry+https://github.com/rust-lang/crates.io-index"
129
+ checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48"
130
+ dependencies = [
131
+ "serde_derive",
132
+ ]
133
+
134
+ [[package]]
135
+ name = "serde_derive"
136
+ version = "1.0.229"
137
+ source = "registry+https://github.com/rust-lang/crates.io-index"
138
+ checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348"
139
+ dependencies = [
140
+ "proc-macro2",
141
+ "quote",
142
+ "syn",
143
+ ]
144
+
145
+ [[package]]
146
+ name = "serde_json"
147
+ version = "1.0.154"
148
+ source = "registry+https://github.com/rust-lang/crates.io-index"
149
+ checksum = "e7e9cc8b1b85264074fbcc02a88680c4096b1e47df8f739dceb03bf482f04bd6"
150
+ dependencies = [
151
+ "itoa",
152
+ "memchr",
153
+ "serde",
154
+ "serde_core",
155
+ "zmij",
156
+ ]
157
+
158
+ [[package]]
159
+ name = "syn"
160
+ version = "3.0.9"
161
+ source = "registry+https://github.com/rust-lang/crates.io-index"
162
+ checksum = "d78c8dee4c7bf0e14673097256fed6142ce9d3b85a408189d07482442145823b"
163
+ dependencies = [
164
+ "proc-macro2",
165
+ "quote",
166
+ "unicode-ident",
167
+ ]
168
+
169
+ [[package]]
170
+ name = "target-lexicon"
171
+ version = "0.13.5"
172
+ source = "registry+https://github.com/rust-lang/crates.io-index"
173
+ checksum = "adb6935a6f5c20170eeceb1a3835a49e12e19d792f6dd344ccc76a985ca5a6ca"
174
+
175
+ [[package]]
176
+ name = "unicode-ident"
177
+ version = "1.0.27"
178
+ source = "registry+https://github.com/rust-lang/crates.io-index"
179
+ checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563"
180
+
181
+ [[package]]
182
+ name = "yapl-native"
183
+ version = "0.4.0"
184
+ dependencies = [
185
+ "pyo3",
186
+ "serde_json",
187
+ ]
188
+
189
+ [[package]]
190
+ name = "zmij"
191
+ version = "1.0.23"
192
+ source = "registry+https://github.com/rust-lang/crates.io-index"
193
+ checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b"
@@ -0,0 +1,19 @@
1
+ [package]
2
+ name = "yapl-native"
3
+ version = "0.4.0"
4
+ edition = "2021"
5
+ rust-version = "1.85"
6
+ publish = false
7
+ license = "MIT"
8
+
9
+ [lib]
10
+ name = "_native"
11
+ crate-type = ["cdylib"]
12
+
13
+ [dependencies]
14
+ pyo3 = { version = "0.30.1", features = ["extension-module", "abi3-py313"] }
15
+ serde_json = "1.0"
16
+
17
+ [profile.release]
18
+ lto = "thin"
19
+ codegen-units = 1
@@ -0,0 +1,111 @@
1
+ # Native event pipeline
2
+
3
+ YAPL requires its PyO3 extension for event isolation, policy processing, JSON,
4
+ logfmt, payload trimming, and policy batches. There is no Python implementation
5
+ or runtime backend switch. Importing without the extension fails.
6
+
7
+ Python owns configuration, stdlib record normalization, arbitrary processors and
8
+ object callbacks, exception capture, context management, transports, and lifecycle.
9
+ The extension starts no threads and retains no events between calls.
10
+
11
+ ## Building
12
+
13
+ Use GIL-enabled CPython >=3.13, Rust >=1.85, and a platform linker. On Windows,
14
+ install Visual Studio's Desktop development with C++ workload, including a Windows
15
+ SDK, and run from Developer PowerShell. Native wheels use CPython's 3.13 stable ABI.
16
+ Free-threaded and non-CPython builds are not supported.
17
+
18
+ On Linux, install a C/C++ build toolchain and Rust through rustup. On macOS,
19
+ install Xcode Command Line Tools and Rust. Ensure `cargo` and `rustc` are on PATH.
20
+ The Python build backend installs setuptools-rust automatically; it does not
21
+ install Rust or the operating system's linker and SDK.
22
+
23
+ From the repository root:
24
+
25
+ ```sh
26
+ uv sync --locked --all-extras --reinstall-package yapl-kit
27
+ uv run --locked --no-sync pytest
28
+ uv build --force-pep517
29
+ cargo fmt --manifest-path native/Cargo.toml --check
30
+ cargo clippy --manifest-path native/Cargo.toml --locked -- -D warnings
31
+ ```
32
+
33
+ Set CARGO_TARGET_DIR to the absolute path of build/cargo to keep Cargo artifacts
34
+ in the existing ignored build directory. For example, in PowerShell:
35
+
36
+ ```powershell
37
+ $env:CARGO_TARGET_DIR = Join-Path (Get-Location) 'build/cargo'
38
+ ```
39
+
40
+ Re-run the sync command with `--reinstall-package yapl-kit` after editing Rust;
41
+ an editable Python install does not automatically recompile the extension.
42
+ The build invalidates previous extension outputs and fails if
43
+ compilation fails. It cannot produce a Python-only wheel.
44
+
45
+ CI and releases share `.github/workflows/native-wheels.yml`. It builds CPython
46
+ 3.13 stable-ABI wheels, tests them on 3.13-3.15, and uses cibuildwheel's platform
47
+ repair and ABI audit steps. Targets are manylinux 2.28 x86-64, Windows x86-64,
48
+ macOS x86-64, and macOS arm64. Linux containers install their own Rust toolchain;
49
+ Windows and macOS use the host toolchain. Musl, Linux arm64, and Windows arm64
50
+ consumers currently build from source. No pure-Python distribution is produced.
51
+
52
+ The ordinary CI matrix runs the full suite, static checks, locked source-to-wheel
53
+ builds, the minimum Rust 1.85 check, and optional SDK integration. Release publishing
54
+ waits for the native-wheel jobs and source archive/tag checks. Workflow edits do
55
+ not run or publish a release locally.
56
+
57
+ ## Compiled plans
58
+
59
+ The private typed interface is compile_plan(policy, output_format), returning an
60
+ immutable plan with process_event(event) and process_batch(events). Output formats
61
+ are event (dict), json (str), bytes (UTF-8 JSON), and logfmt (str). Optional ordered
62
+ Python processors run on an isolated event before redaction and projection.
63
+
64
+ EventPolicy compiles markers and dotted paths at construction. Formatters derive
65
+ their output plans from that snapshot. The processing order is isolation,
66
+ processors, redaction, schema projection, then field selection. JSON plans write
67
+ selected values directly to one output buffer without a projected Python dict or
68
+ an intermediate serde_json value tree. serde_json handles string escaping, while
69
+ the Python value adapter preserves insertion order, arbitrary-size integers,
70
+ non-finite numbers, scalar keys, and str conversion for opaque objects.
71
+ Compact, spaced, and two-space indented JSON all use this encoder. Colored output
72
+ encodes all JSON fragments in one native call, then applies themes in Python.
73
+ Dictionary subclasses retain their `items()` protocol during traversal.
74
+ JSON and logfmt subclasses can still override `build_event()`; their hook builds
75
+ the event once before native encoding, preserving formatter-local policy ordering.
76
+
77
+ Rust implements graph copying, including aliases, cycles, custom __deepcopy__,
78
+ copyreg reductions, state, slots, and opaque uncopyable leaves. Custom Python
79
+ protocols still execute in Python, as application callbacks. Failed protocols
80
+ restart container isolation with a fresh native memo. Copying and serialization
81
+ reject nesting beyond 200 containers with RecursionError; redaction emits
82
+ [CYCLE] and [MAX_DEPTH] markers using its existing 100-container limit.
83
+
84
+ Redaction and isolation share a traversal when no processors require an isolated
85
+ intermediate event. Projection paths are split once. Payload trimming counts
86
+ UTF-8 and JSON escaping overhead while selecting a text prefix, avoiding repeated
87
+ binary-search serialization. Provider text/content envelopes remain intact.
88
+
89
+ All traversal state is call-local. Plans retain configuration strings only.
90
+ Container references are snapshotted before output allocations or Python callbacks
91
+ can mutate their source. The extension uses safe Rust and holds the GIL while
92
+ working with Python objects; this is not a multicore execution engine.
93
+
94
+ ## Validation and measurement
95
+
96
+ The tests cover public sink isolation, callback ordering, schema snapshots,
97
+ copy protocols, cycles, JSON compatibility, Unicode/escaping, byte budgets,
98
+ batch equivalence, concurrent calls, GC mutation, and required native artifacts.
99
+ Installed-wheel tests run outside the checkout with and without optional extras.
100
+ The wheel matrix copies the unit tests, demo fixtures, and pytest configuration
101
+ into an isolated test directory; it imports the installed wheel rather than the
102
+ checkout. Source-tree tests separately exercise artifact contents and build failures.
103
+
104
+ Run docs/examples/benchmarks/event_pipeline.py for repeatable operation timings.
105
+ Use docs/examples/benchmarks/runtime_survey.py and the delivery benchmarks for the
106
+ remaining Python orchestration costs. Buffer and sampling migrations require
107
+ separate evidence that moving their ownership and bookkeeping is worthwhile.
108
+
109
+ References: [PyO3 classes](https://pyo3.rs/v0.30.1/class),
110
+ [serde_json output](https://docs.rs/serde_json/latest/serde_json/fn.to_writer.html),
111
+ [cibuildwheel ABI3 checks](https://cibuildwheel.pypa.io/en/stable/faq/#building-cpython-abi3-wheels-limited-api).