yapl-kit 0.3.1__tar.gz → 0.4.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 (106) hide show
  1. yapl_kit-0.4.1/LICENSE +21 -0
  2. yapl_kit-0.4.1/MANIFEST.in +4 -0
  3. yapl_kit-0.4.1/PKG-INFO +92 -0
  4. yapl_kit-0.4.1/README.md +73 -0
  5. yapl_kit-0.4.1/native/Cargo.lock +193 -0
  6. yapl_kit-0.4.1/native/Cargo.toml +19 -0
  7. yapl_kit-0.4.1/native/README.md +111 -0
  8. yapl_kit-0.4.1/native/src/copying.rs +300 -0
  9. yapl_kit-0.4.1/native/src/encoding.rs +396 -0
  10. yapl_kit-0.4.1/native/src/lib.rs +19 -0
  11. yapl_kit-0.4.1/native/src/plan.rs +352 -0
  12. yapl_kit-0.4.1/native/src/trimming.rs +111 -0
  13. yapl_kit-0.4.1/pyproject.toml +194 -0
  14. yapl_kit-0.4.1/setup.cfg +4 -0
  15. yapl_kit-0.4.1/setup.py +41 -0
  16. {yapl_kit-0.3.1 → yapl_kit-0.4.1}/src/yapl/__init__.py +30 -3
  17. yapl_kit-0.4.1/src/yapl/_handlers.py +59 -0
  18. yapl_kit-0.4.1/src/yapl/_native.pyi +48 -0
  19. {yapl_kit-0.3.1 → yapl_kit-0.4.1}/src/yapl/_optional.py +5 -6
  20. {yapl_kit-0.3.1 → yapl_kit-0.4.1}/src/yapl/_validation.py +1 -1
  21. {yapl_kit-0.3.1 → yapl_kit-0.4.1}/src/yapl/config.py +129 -61
  22. yapl_kit-0.4.1/src/yapl/context.py +107 -0
  23. {yapl_kit-0.3.1 → yapl_kit-0.4.1}/src/yapl/extensions/buffering/__init__.py +3 -2
  24. {yapl_kit-0.3.1 → yapl_kit-0.4.1}/src/yapl/extensions/buffering/capture.py +25 -12
  25. yapl_kit-0.4.1/src/yapl/extensions/buffering/context.py +379 -0
  26. yapl_kit-0.4.1/src/yapl/extensions/buffering/flush.py +81 -0
  27. yapl_kit-0.4.1/src/yapl/extensions/buffering/models.py +400 -0
  28. {yapl_kit-0.3.1 → yapl_kit-0.4.1}/src/yapl/extensions/coloring/__init__.py +1 -1
  29. {yapl_kit-0.3.1 → yapl_kit-0.4.1}/src/yapl/extensions/coloring/colors.py +3 -2
  30. {yapl_kit-0.3.1 → yapl_kit-0.4.1}/src/yapl/extensions/coloring/models.py +45 -17
  31. {yapl_kit-0.3.1 → yapl_kit-0.4.1}/src/yapl/extensions/coloring/plain.py +63 -30
  32. {yapl_kit-0.3.1 → yapl_kit-0.4.1}/src/yapl/extensions/coloring/policy.py +3 -1
  33. {yapl_kit-0.3.1 → yapl_kit-0.4.1}/src/yapl/extensions/coloring/registry.py +10 -7
  34. {yapl_kit-0.3.1 → yapl_kit-0.4.1}/src/yapl/extensions/coloring/structured.py +17 -29
  35. {yapl_kit-0.3.1 → yapl_kit-0.4.1}/src/yapl/extensions/coloring/text.py +5 -3
  36. {yapl_kit-0.3.1 → yapl_kit-0.4.1}/src/yapl/extensions/formatting/__init__.py +5 -1
  37. yapl_kit-0.4.1/src/yapl/extensions/formatting/_helpers.py +138 -0
  38. yapl_kit-0.4.1/src/yapl/extensions/formatting/formatters.py +164 -0
  39. {yapl_kit-0.3.1 → yapl_kit-0.4.1}/src/yapl/extensions/formatting/json.py +1 -1
  40. {yapl_kit-0.3.1 → yapl_kit-0.4.1}/src/yapl/extensions/formatting/logfmt.py +1 -1
  41. {yapl_kit-0.3.1 → yapl_kit-0.4.1}/src/yapl/extensions/formatting/plain.py +20 -5
  42. yapl_kit-0.4.1/src/yapl/extensions/formatting/policy.py +178 -0
  43. yapl_kit-0.4.1/src/yapl/extensions/formatting/processors.py +493 -0
  44. {yapl_kit-0.3.1 → yapl_kit-0.4.1}/src/yapl/extensions/formatting/structured.py +211 -129
  45. {yapl_kit-0.3.1 → yapl_kit-0.4.1}/src/yapl/extensions/formatting/text.py +1 -1
  46. yapl_kit-0.4.1/src/yapl/extensions/integrations/__init__.py +5 -0
  47. yapl_kit-0.4.1/src/yapl/extensions/integrations/asgi.py +90 -0
  48. yapl_kit-0.4.1/src/yapl/extensions/integrations/jobs.py +62 -0
  49. yapl_kit-0.4.1/src/yapl/extensions/metrics.py +179 -0
  50. yapl_kit-0.4.1/src/yapl/extensions/opentelemetry.py +169 -0
  51. {yapl_kit-0.3.1 → yapl_kit-0.4.1}/src/yapl/extensions/queueing/__init__.py +7 -2
  52. yapl_kit-0.4.1/src/yapl/extensions/queueing/handler.py +657 -0
  53. {yapl_kit-0.3.1 → yapl_kit-0.4.1}/src/yapl/extensions/queueing/models.py +50 -12
  54. {yapl_kit-0.3.1 → yapl_kit-0.4.1}/src/yapl/extensions/queueing/policy.py +0 -2
  55. {yapl_kit-0.3.1 → yapl_kit-0.4.1}/src/yapl/extensions/queueing/queue.py +6 -6
  56. {yapl_kit-0.3.1 → yapl_kit-0.4.1}/src/yapl/extensions/queueing/worker.py +16 -4
  57. {yapl_kit-0.3.1 → yapl_kit-0.4.1}/src/yapl/extensions/tracing.py +12 -1
  58. {yapl_kit-0.3.1 → yapl_kit-0.4.1}/src/yapl/extensions/webhook/__init__.py +5 -4
  59. {yapl_kit-0.3.1 → yapl_kit-0.4.1}/src/yapl/extensions/webhook/client.py +87 -47
  60. yapl_kit-0.4.1/src/yapl/extensions/webhook/handler.py +407 -0
  61. {yapl_kit-0.3.1 → yapl_kit-0.4.1}/src/yapl/extensions/webhook/models.py +54 -21
  62. {yapl_kit-0.3.1 → yapl_kit-0.4.1}/src/yapl/extensions/webhook/payloads.py +71 -114
  63. yapl_kit-0.4.1/src/yapl/factory.py +1337 -0
  64. {yapl_kit-0.3.1 → yapl_kit-0.4.1}/src/yapl/filters/__init__.py +6 -0
  65. yapl_kit-0.4.1/src/yapl/filters/contracts.py +161 -0
  66. {yapl_kit-0.3.1 → yapl_kit-0.4.1}/src/yapl/filters/enrichment.py +60 -10
  67. yapl_kit-0.4.1/src/yapl/filters/noise.py +231 -0
  68. yapl_kit-0.4.1/src/yapl/filters/suppression.py +45 -0
  69. {yapl_kit-0.3.1 → yapl_kit-0.4.1}/src/yapl/levels.py +50 -38
  70. yapl_kit-0.4.1/src/yapl/logger.py +477 -0
  71. {yapl_kit-0.3.1 → yapl_kit-0.4.1}/src/yapl/stack/__init__.py +1 -1
  72. {yapl_kit-0.3.1 → yapl_kit-0.4.1}/src/yapl/stack/callsite.py +15 -9
  73. {yapl_kit-0.3.1 → yapl_kit-0.4.1}/src/yapl/stack/tracer.py +91 -34
  74. yapl_kit-0.4.1/src/yapl/status.py +111 -0
  75. yapl_kit-0.4.1/src/yapl/testing.py +59 -0
  76. yapl_kit-0.4.1/src/yapl/types.py +65 -0
  77. yapl_kit-0.4.1/src/yapl_kit/py.typed +1 -0
  78. yapl_kit-0.4.1/src/yapl_kit.egg-info/PKG-INFO +92 -0
  79. yapl_kit-0.4.1/src/yapl_kit.egg-info/SOURCES.txt +84 -0
  80. yapl_kit-0.4.1/src/yapl_kit.egg-info/requires.txt +6 -0
  81. yapl_kit-0.4.1/src/yapl_kit.egg-info/top_level.txt +2 -0
  82. yapl_kit-0.3.1/PKG-INFO +0 -494
  83. yapl_kit-0.3.1/PUBLIC.md +0 -481
  84. yapl_kit-0.3.1/pyproject.toml +0 -79
  85. yapl_kit-0.3.1/pyproject.toml.orig +0 -78
  86. yapl_kit-0.3.1/src/yapl/context.py +0 -64
  87. yapl_kit-0.3.1/src/yapl/extensions/buffering/context.py +0 -175
  88. yapl_kit-0.3.1/src/yapl/extensions/buffering/flush.py +0 -76
  89. yapl_kit-0.3.1/src/yapl/extensions/buffering/models.py +0 -85
  90. yapl_kit-0.3.1/src/yapl/extensions/formatting/_helpers.py +0 -53
  91. yapl_kit-0.3.1/src/yapl/extensions/formatting/formatters.py +0 -130
  92. yapl_kit-0.3.1/src/yapl/extensions/formatting/policy.py +0 -111
  93. yapl_kit-0.3.1/src/yapl/extensions/formatting/processors.py +0 -412
  94. yapl_kit-0.3.1/src/yapl/extensions/queueing/handler.py +0 -421
  95. yapl_kit-0.3.1/src/yapl/extensions/webhook/handler.py +0 -281
  96. yapl_kit-0.3.1/src/yapl/factory.py +0 -759
  97. yapl_kit-0.3.1/src/yapl/filters/suppression.py +0 -69
  98. yapl_kit-0.3.1/src/yapl/logger.py +0 -268
  99. yapl_kit-0.3.1/src/yapl/status.py +0 -29
  100. yapl_kit-0.3.1/src/yapl/testing.py +0 -42
  101. yapl_kit-0.3.1/src/yapl/types.py +0 -29
  102. {yapl_kit-0.3.1 → yapl_kit-0.4.1}/src/yapl/extensions/coloring/themes.py +0 -0
  103. {yapl_kit-0.3.1 → yapl_kit-0.4.1}/src/yapl/extensions/formatting/_types.py +0 -0
  104. {yapl_kit-0.3.1 → yapl_kit-0.4.1}/src/yapl/py.typed +0 -0
  105. {yapl_kit-0.3.1 → yapl_kit-0.4.1}/src/yapl_kit/__init__.py +0 -0
  106. /yapl_kit-0.3.1/src/yapl_kit/py.typed → /yapl_kit-0.4.1/src/yapl_kit.egg-info/dependency_links.txt +0 -0
yapl_kit-0.4.1/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,92 @@
1
+ Metadata-Version: 2.4
2
+ Name: yapl-kit
3
+ Version: 0.4.1
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
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: Programming Language :: Python :: 3.13
9
+ Classifier: Programming Language :: Python :: 3.14
10
+ Classifier: Programming Language :: Python :: 3.15
11
+ Requires-Python: >=3.13
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+ Provides-Extra: webhook
15
+ Requires-Dist: httpx>=0.29.0; extra == "webhook"
16
+ Provides-Extra: opentelemetry
17
+ Requires-Dist: opentelemetry-api>=1.45.3; extra == "opentelemetry"
18
+ Dynamic: license-file
19
+
20
+ <p align="center">
21
+ <img src="https://yapl.yapl-kit.workers.dev/branding/yapl_kit_icon_banner_right.png" alt="YAPL: Yet Another Python Logger" width="560">
22
+ </p>
23
+
24
+ <h1 align="center">YAPL</h1>
25
+
26
+ <p align="center">
27
+ Structured context and bounded background delivery for Python's standard <code>logging</code> module.
28
+ </p>
29
+
30
+ <p align="center">
31
+ <a href="https://pypi.org/project/yapl-kit/"><img src="https://img.shields.io/pypi/v/yapl-kit?color=blue&label=PyPI" alt="PyPI"></a>
32
+ <a href="https://pypi.org/project/yapl-kit/"><img src="https://img.shields.io/pypi/pyversions/yapl-kit?label=Python" alt="Python 3.13+"></a>
33
+ <a href="https://pypi.org/project/yapl-kit/"><img src="https://img.shields.io/pypi/l/yapl-kit?label=License" alt="MIT License"></a>
34
+ <a href="https://yapl.yapl-kit.workers.dev/guide/"><img src="https://img.shields.io/badge/docs-yapl--kit-teal" alt="Documentation"></a>
35
+ </p>
36
+
37
+ ## Highlights
38
+
39
+ - Add structured fields to log calls or scope them to a context.
40
+ - Use bound logger views for reusable fields such as a service or component name.
41
+ - Move formatting and output work to a bounded queue when background delivery is useful.
42
+ - Extend logging with bundled formatting, coloring, buffering, stack helpers, webhooks, and OpenTelemetry support.
43
+ - Install the core package without third-party Python runtime dependencies; webhook and OpenTelemetry dependencies are optional extras.
44
+
45
+ ## Installation
46
+
47
+ YAPL requires GIL-enabled CPython 3.13 or newer.
48
+
49
+ ```bash
50
+ pip install yapl-kit
51
+ ```
52
+
53
+ Or add it to a `uv` project:
54
+
55
+ ```bash
56
+ uv add yapl-kit
57
+ ```
58
+
59
+ Install optional integrations only when you need them:
60
+
61
+ ```bash
62
+ pip install 'yapl-kit[webhook]'
63
+ pip install 'yapl-kit[opentelemetry]'
64
+ ```
65
+
66
+ ## Quick start
67
+
68
+ ```python
69
+ import yapl
70
+
71
+ yapl.setup_logging(level="INFO", outputs=("stdout",), format="text")
72
+ log = yapl.get_logger(__name__)
73
+
74
+ log.info("Request received", request_id="req-42")
75
+
76
+ with yapl.context(request_id="req-43"):
77
+ log.info("Processing request")
78
+
79
+ yapl.shutdown_logging()
80
+ ```
81
+
82
+ The main import is `yapl`. For scripts that need setup and shutdown around a block, use `yapl.logging_session(...)` instead.
83
+
84
+ ## Documentation
85
+
86
+ | Resource | What it covers |
87
+ | --- | --- |
88
+ | [User guide](https://yapl.yapl-kit.workers.dev/guide/) | Setup, configuration, and output formats |
89
+ | [Native build guide](https://yapl.yapl-kit.workers.dev/native-build/) | Source builds and native extension details |
90
+ | [Demos](https://yapl.yapl-kit.workers.dev/demos/) | Runnable examples and integrations |
91
+ | [Benchmarks](https://yapl.yapl-kit.workers.dev/benchmarks/) | Throughput and latency results |
92
+ | [Changelog](https://yapl.yapl-kit.workers.dev/changelogs/) | Release notes |
@@ -0,0 +1,73 @@
1
+ <p align="center">
2
+ <img src="https://yapl.yapl-kit.workers.dev/branding/yapl_kit_icon_banner_right.png" alt="YAPL: Yet Another Python Logger" width="560">
3
+ </p>
4
+
5
+ <h1 align="center">YAPL</h1>
6
+
7
+ <p align="center">
8
+ Structured context and bounded background delivery for Python's standard <code>logging</code> module.
9
+ </p>
10
+
11
+ <p align="center">
12
+ <a href="https://pypi.org/project/yapl-kit/"><img src="https://img.shields.io/pypi/v/yapl-kit?color=blue&label=PyPI" alt="PyPI"></a>
13
+ <a href="https://pypi.org/project/yapl-kit/"><img src="https://img.shields.io/pypi/pyversions/yapl-kit?label=Python" alt="Python 3.13+"></a>
14
+ <a href="https://pypi.org/project/yapl-kit/"><img src="https://img.shields.io/pypi/l/yapl-kit?label=License" alt="MIT License"></a>
15
+ <a href="https://yapl.yapl-kit.workers.dev/guide/"><img src="https://img.shields.io/badge/docs-yapl--kit-teal" alt="Documentation"></a>
16
+ </p>
17
+
18
+ ## Highlights
19
+
20
+ - Add structured fields to log calls or scope them to a context.
21
+ - Use bound logger views for reusable fields such as a service or component name.
22
+ - Move formatting and output work to a bounded queue when background delivery is useful.
23
+ - Extend logging with bundled formatting, coloring, buffering, stack helpers, webhooks, and OpenTelemetry support.
24
+ - Install the core package without third-party Python runtime dependencies; webhook and OpenTelemetry dependencies are optional extras.
25
+
26
+ ## Installation
27
+
28
+ YAPL requires GIL-enabled CPython 3.13 or newer.
29
+
30
+ ```bash
31
+ pip install yapl-kit
32
+ ```
33
+
34
+ Or add it to a `uv` project:
35
+
36
+ ```bash
37
+ uv add yapl-kit
38
+ ```
39
+
40
+ Install optional integrations only when you need them:
41
+
42
+ ```bash
43
+ pip install 'yapl-kit[webhook]'
44
+ pip install 'yapl-kit[opentelemetry]'
45
+ ```
46
+
47
+ ## Quick start
48
+
49
+ ```python
50
+ import yapl
51
+
52
+ yapl.setup_logging(level="INFO", outputs=("stdout",), format="text")
53
+ log = yapl.get_logger(__name__)
54
+
55
+ log.info("Request received", request_id="req-42")
56
+
57
+ with yapl.context(request_id="req-43"):
58
+ log.info("Processing request")
59
+
60
+ yapl.shutdown_logging()
61
+ ```
62
+
63
+ The main import is `yapl`. For scripts that need setup and shutdown around a block, use `yapl.logging_session(...)` instead.
64
+
65
+ ## Documentation
66
+
67
+ | Resource | What it covers |
68
+ | --- | --- |
69
+ | [User guide](https://yapl.yapl-kit.workers.dev/guide/) | Setup, configuration, and output formats |
70
+ | [Native build guide](https://yapl.yapl-kit.workers.dev/native-build/) | Source builds and native extension details |
71
+ | [Demos](https://yapl.yapl-kit.workers.dev/demos/) | Runnable examples and integrations |
72
+ | [Benchmarks](https://yapl.yapl-kit.workers.dev/benchmarks/) | Throughput and latency results |
73
+ | [Changelog](https://yapl.yapl-kit.workers.dev/changelogs/) | Release notes |
@@ -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.19"
14
+ source = "registry+https://github.com/rust-lang/crates.io-index"
15
+ checksum = "3bd1574e617a9a6c1f8f8181bd7e841e1f20e4277607ef28945765188d6284d4"
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.10"
161
+ source = "registry+https://github.com/rust-lang/crates.io-index"
162
+ checksum = "4ae9ccbea3a7b0b09443036490c8f34a8b1b760fd345e5c0dae0aac718faea79"
163
+ dependencies = [
164
+ "proc-macro2",
165
+ "quote",
166
+ "unicode-ident",
167
+ ]
168
+
169
+ [[package]]
170
+ name = "target-lexicon"
171
+ version = "0.13.6"
172
+ source = "registry+https://github.com/rust-lang/crates.io-index"
173
+ checksum = "8c447be3a2abfa84b2d91680c56600bd6b2873866de27b36ec911be705e291da"
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.1"
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.1"
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.154"
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).