nox-pulse 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.
- nox_pulse-0.2.0/PKG-INFO +5 -0
- nox_pulse-0.2.0/README.md +12 -0
- nox_pulse-0.2.0/nox.json +14 -0
- nox_pulse-0.2.0/pyproject.toml +27 -0
- nox_pulse-0.2.0/src/lib.nox +124 -0
nox_pulse-0.2.0/PKG-INFO
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# nox-pulse
|
|
2
|
+
|
|
3
|
+
Native Python (`CPython 3.15+` `abi3t`, free-threaded `3.15t`) bindings for [pulse](https://github.com/mburakmmm/pulse).
|
|
4
|
+
|
|
5
|
+
```python
|
|
6
|
+
import nox_pulse
|
|
7
|
+
|
|
8
|
+
tid = nox_pulse.generate_trace_id()
|
|
9
|
+
clk = nox_pulse.TestClock(1000, 2000)
|
|
10
|
+
clk.advance(500, 500)
|
|
11
|
+
assert clk.wall_time_ns() == 1500
|
|
12
|
+
```
|
nox_pulse-0.2.0/nox.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "nox_pulse_bridge",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"source": "nox",
|
|
5
|
+
"entry": "src/lib.nox",
|
|
6
|
+
"requires": [
|
|
7
|
+
{
|
|
8
|
+
"alias": "pulse",
|
|
9
|
+
"repo": "https://github.com/mburakmmm/pulse.git",
|
|
10
|
+
"ref": "7bfb4a31286755323f418ca744bcca28d7b80073",
|
|
11
|
+
"require_signed_commit": false
|
|
12
|
+
}
|
|
13
|
+
]
|
|
14
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["noxpy>=0.7.0a2"]
|
|
3
|
+
build-backend = "noxpy.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "nox-pulse"
|
|
7
|
+
version = "0.2.0"
|
|
8
|
+
description = "Native Python bindings (CPython 3.15+ abi3t, free-threaded) for Pulse observability primitives"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = { text = "MIT" }
|
|
11
|
+
requires-python = ">=3.15"
|
|
12
|
+
|
|
13
|
+
[tool.noxpy]
|
|
14
|
+
module-name = "nox_pulse"
|
|
15
|
+
source = "src/lib.nox"
|
|
16
|
+
backend = "llvm"
|
|
17
|
+
abi = "abi3t"
|
|
18
|
+
free-threaded = true
|
|
19
|
+
generate-stubs = true
|
|
20
|
+
export = "public"
|
|
21
|
+
|
|
22
|
+
[tool.noxpy.publish]
|
|
23
|
+
enabled = true
|
|
24
|
+
repository = "pypi"
|
|
25
|
+
trigger = "release-tag"
|
|
26
|
+
include-sdist = true
|
|
27
|
+
require-attestation = true
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import pulse.core.attributes
|
|
2
|
+
import pulse.core.clock
|
|
3
|
+
import pulse.core.ids
|
|
4
|
+
import pulse.core.limits
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
@export("instance_locked")
|
|
8
|
+
class TraceId:
|
|
9
|
+
_inner: pulse.core.ids.TraceId
|
|
10
|
+
|
|
11
|
+
def __init__(self, value: str) -> None:
|
|
12
|
+
self._inner = pulse.core.ids.TraceId(value)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class _Raw_TraceId(TraceId):
|
|
16
|
+
def __init__(self, inner: pulse.core.ids.TraceId) -> None:
|
|
17
|
+
self._inner = inner
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
@export("instance_locked")
|
|
21
|
+
class SpanId:
|
|
22
|
+
_inner: pulse.core.ids.SpanId
|
|
23
|
+
|
|
24
|
+
def __init__(self, value: str) -> None:
|
|
25
|
+
self._inner = pulse.core.ids.SpanId(value)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class _Raw_SpanId(SpanId):
|
|
29
|
+
def __init__(self, inner: pulse.core.ids.SpanId) -> None:
|
|
30
|
+
self._inner = inner
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
@export("instance_locked")
|
|
34
|
+
class TestClock:
|
|
35
|
+
_inner: pulse.core.clock.TestClock
|
|
36
|
+
|
|
37
|
+
def __init__(self, wall_ns: int, monotonic_ns: int) -> None:
|
|
38
|
+
self._inner = pulse.core.clock.TestClock(wall_ns, monotonic_ns)
|
|
39
|
+
|
|
40
|
+
def wall_time_ns(self) -> int:
|
|
41
|
+
return self._inner.wall_time_ns()
|
|
42
|
+
|
|
43
|
+
def monotonic_time_ns(self) -> int:
|
|
44
|
+
return self._inner.monotonic_time_ns()
|
|
45
|
+
|
|
46
|
+
def advance(self, wall_delta_ns: int, monotonic_delta_ns: int) -> None:
|
|
47
|
+
self._inner.advance(wall_delta_ns, monotonic_delta_ns)
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
@export("instance_locked")
|
|
51
|
+
class SystemClock:
|
|
52
|
+
_inner: pulse.core.clock.SystemClock
|
|
53
|
+
|
|
54
|
+
def __init__(self) -> None:
|
|
55
|
+
self._inner = pulse.core.clock.SystemClock()
|
|
56
|
+
|
|
57
|
+
def wall_time_ns(self) -> int:
|
|
58
|
+
return self._inner.wall_time_ns()
|
|
59
|
+
|
|
60
|
+
def monotonic_time_ns(self) -> int:
|
|
61
|
+
return self._inner.monotonic_time_ns()
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
@export("instance_locked")
|
|
65
|
+
class AttributeLimits:
|
|
66
|
+
_inner: pulse.core.limits.AttributeLimits
|
|
67
|
+
|
|
68
|
+
def __init__(
|
|
69
|
+
self,
|
|
70
|
+
max_attributes: int,
|
|
71
|
+
max_key_bytes: int,
|
|
72
|
+
max_string_bytes: int,
|
|
73
|
+
max_array_elements: int,
|
|
74
|
+
max_string_array_element_bytes: int,
|
|
75
|
+
max_total_bytes: int,
|
|
76
|
+
) -> None:
|
|
77
|
+
self._inner = pulse.core.limits.AttributeLimits(
|
|
78
|
+
max_attributes,
|
|
79
|
+
max_key_bytes,
|
|
80
|
+
max_string_bytes,
|
|
81
|
+
max_array_elements,
|
|
82
|
+
max_string_array_element_bytes,
|
|
83
|
+
max_total_bytes,
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
class _Raw_AttributeLimits(AttributeLimits):
|
|
88
|
+
def __init__(self, inner: pulse.core.limits.AttributeLimits) -> None:
|
|
89
|
+
self._inner = inner
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
@export
|
|
93
|
+
def is_lower_hex(value: str, expected_bytes: int) -> bool:
|
|
94
|
+
return pulse.core.ids.is_lower_hex(value, expected_bytes)
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
@export
|
|
98
|
+
def hex_nibble(byte_value: int) -> int:
|
|
99
|
+
return pulse.core.ids.hex_nibble(byte_value)
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
@export
|
|
103
|
+
def generate_trace_id() -> TraceId:
|
|
104
|
+
return _Raw_TraceId(pulse.core.ids.generate_trace_id())
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
@export
|
|
108
|
+
def generate_span_id() -> SpanId:
|
|
109
|
+
return _Raw_SpanId(pulse.core.ids.generate_span_id())
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
@export
|
|
113
|
+
def is_finite(value: float) -> bool:
|
|
114
|
+
return pulse.core.attributes.is_finite(value)
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
@export
|
|
118
|
+
def is_sensitive_key(key: str) -> bool:
|
|
119
|
+
return pulse.core.attributes.is_sensitive_key(key)
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
@export
|
|
123
|
+
def default_attribute_limits() -> AttributeLimits:
|
|
124
|
+
return _Raw_AttributeLimits(pulse.core.limits.default_attribute_limits())
|