nox-rune 2.1.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.
@@ -0,0 +1,5 @@
1
+ Metadata-Version: 2.1
2
+ Name: nox-rune
3
+ Version: 2.1.0
4
+ Summary: Native Python bindings (CPython 3.15+ abi3t, free-threaded) for Rune terminal & ANSI utilities
5
+ Requires-Python: >=3.15
@@ -0,0 +1,11 @@
1
+ # nox-rune
2
+
3
+ Native Python (`CPython 3.15+` `abi3t`, free-threaded `3.15t`) bindings for [rune](https://github.com/mburakmmm/rune).
4
+
5
+ ```python
6
+ import nox_rune
7
+
8
+ st = nox_rune.Style(fg="red", bold=True)
9
+ styled = st.apply("hello")
10
+ assert nox_rune.strip_ansi(styled) == "hello"
11
+ ```
@@ -0,0 +1,14 @@
1
+ {
2
+ "name": "nox_rune_bridge",
3
+ "version": "2.1.0",
4
+ "source": "nox",
5
+ "entry": "src/lib.nox",
6
+ "requires": [
7
+ {
8
+ "alias": "rune",
9
+ "repo": "https://github.com/mburakmmm/rune.git",
10
+ "ref": "d90b66a68aacc08963beef0a1021ceb5c5a45cb2",
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-rune"
7
+ version = "2.1.0"
8
+ description = "Native Python bindings (CPython 3.15+ abi3t, free-threaded) for Rune terminal & ANSI utilities"
9
+ readme = "README.md"
10
+ license = { text = "MIT" }
11
+ requires-python = ">=3.15"
12
+
13
+ [tool.noxpy]
14
+ module-name = "nox_rune"
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,87 @@
1
+ import rune.core
2
+
3
+
4
+ @export("instance_locked")
5
+ class Style:
6
+ _inner: rune.core.Style
7
+
8
+ def __init__(
9
+ self,
10
+ fg: str = "",
11
+ bg: str = "",
12
+ bold: bool = False,
13
+ dim: bool = False,
14
+ italic: bool = False,
15
+ underline: bool = False,
16
+ reverse: bool = False,
17
+ ) -> None:
18
+ self._inner = rune.core.Style(fg, bg, bold, dim, italic, underline, reverse)
19
+
20
+ def is_plain(self) -> bool:
21
+ return self._inner.is_plain()
22
+
23
+ def to_ansi(self) -> str:
24
+ return self._inner.to_ansi()
25
+
26
+ def apply(self, text: str) -> str:
27
+ return self._inner.apply(text)
28
+
29
+
30
+ @export
31
+ def esc_code() -> str:
32
+ return rune.core.esc_code()
33
+
34
+
35
+ @export
36
+ def reset_code() -> str:
37
+ return rune.core.reset_code()
38
+
39
+
40
+ @export
41
+ def clamp_byte(val: int) -> int:
42
+ return rune.core.clamp_byte(val)
43
+
44
+
45
+ @export
46
+ def color_256(n: int) -> str:
47
+ return rune.core.color_256(n)
48
+
49
+
50
+ @export
51
+ def bg_256(n: int) -> str:
52
+ return rune.core.bg_256(n)
53
+
54
+
55
+ @export
56
+ def color_rgb(r: int, g: int, b: int) -> str:
57
+ return rune.core.color_rgb(r, g, b)
58
+
59
+
60
+ @export
61
+ def bg_rgb(r: int, g: int, b: int) -> str:
62
+ return rune.core.bg_rgb(r, g, b)
63
+
64
+
65
+ @export
66
+ def hex_to_rgb(hex_str: str) -> str:
67
+ return rune.core.hex_to_rgb(hex_str)
68
+
69
+
70
+ @export
71
+ def hex_to_bg_rgb(hex_str: str) -> str:
72
+ return rune.core.hex_to_bg_rgb(hex_str)
73
+
74
+
75
+ @export
76
+ def strip_ansi(s: str) -> str:
77
+ return rune.core.strip_ansi(s)
78
+
79
+
80
+ @export
81
+ def sanitize_ansi(s: str) -> str:
82
+ return rune.core.sanitize_ansi(s)
83
+
84
+
85
+ @export
86
+ def char_width(c: str) -> int:
87
+ return rune.core.char_width(c)