signet-lang 26.0b70__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,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Daniel Desai
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,322 @@
1
+ Metadata-Version: 2.4
2
+ Name: signet-lang
3
+ Version: 26.0b70
4
+ Summary: Signet: a coordination language that wires modules in any language together with Signals
5
+ Author: Daniel Desai
6
+ License-Expression: MIT
7
+ Project-URL: Source, https://github.com/ddesai76/signet
8
+ Classifier: Programming Language :: Other
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Operating System :: POSIX :: Linux
11
+ Classifier: Operating System :: Microsoft :: Windows
12
+ Classifier: Topic :: Software Development :: Interpreters
13
+ Requires-Python: >=3.8
14
+ Description-Content-Type: text/markdown
15
+ License-File: LICENSE
16
+ Dynamic: license-file
17
+
18
+ # Signet
19
+
20
+ **Signet 26** (26.b.0.1.7) is a lightweight coordination language for building systems of programs written in any language. The programs, called **modules**, pass results to one another as **Signals**. Signet is the wiring between them: a typed directed multigraph where modules are nodes and Signals are arrows.
21
+
22
+ Signet was first developed for [Starfire](https://github.com/ddesai76/starfire), a test design suite where each test point can run a module. It also runs on its own, as wiring code in any folder of modules.
23
+
24
+ This repository goes with the book *The Signet Programming Language* (Daniel Desai, 2026). The book is the full guide; this README covers getting started.
25
+
26
+ ## Contents
27
+
28
+ | File | What it is |
29
+ |---|---|
30
+ | `signet.py` | The reference implementation: the evaluator, CLI and embedded module helpers |
31
+ | `build.sh` | Builds the standalone `signet` binary from `signet.py` on Linux (`--onefile` for a single file) |
32
+ | `build.ps1` | The same on Windows: `signet.exe` (`-OneFile` for a single file) |
33
+ | `pyproject.toml` | The PyPI package, `signet-lang` |
34
+ | `.github/workflows/regress.yml` | Runs `signet-tests/regress.py` on Linux and Windows, from source, the pipx install and both binaries |
35
+ | `.github/workflows/release.yml` | Publishes a tagged release to PyPI once the regression passes |
36
+ | `signet.rs` | The Rust module helper, as written by `--export-helpers` |
37
+ | `visualizer.py` | Draws a system as SVG, in the style of Starfire's System view |
38
+ | `sys2dot.py` | Turns `--connections` JSON into a Graphviz graph |
39
+
40
+ ## Install
41
+
42
+ From PyPI, as `signet-lang` (the command is `signet`). pipx keeps it in its own environment:
43
+
44
+ ```sh
45
+ pipx install signet-lang
46
+ signet hello.sg
47
+ pipx upgrade signet-lang # a newer release
48
+ ```
49
+
50
+ On Linux, `#!/usr/bin/env signet` as a program's first line lets `chmod +x hello.sg && ./hello.sg` run it.
51
+
52
+ `signet.py` needs only Python 3.8 or later and its standard library, so it also runs without installing. Put `signet.py`, or the `signet` binary, in the working folder:
53
+
54
+ ```sh
55
+ python3 signet.py hello.sg # from source
56
+ ./signet hello.sg # standalone binary
57
+ ```
58
+
59
+ To build the binary, run `./build.sh` on Linux, or `powershell -ExecutionPolicy Bypass -File build.ps1` on Windows (needs `python -m pip install nuitka`).
60
+
61
+ On Windows, run `python signet.py hello.sg` or `signet.exe hello.sg`. Compiled modules need the compilers on `PATH`: MSYS2's UCRT64 toolchain (`gcc`, `g++`, `gfortran`, `gnatmake`), Rust, and GHC; shell modules need Git Bash. Windows support is new in 26.b.0.1.7 and so far checked only by the CI workflow.
62
+
63
+ ## Hello, Signal
64
+
65
+ `hello.sg`:
66
+
67
+ ```
68
+ echo('Hello, world!')
69
+ ```
70
+
71
+ ```
72
+ $ ./signet hello.sg
73
+ → line 1: 'Hello, world!' = "Hello, world!"
74
+ ```
75
+
76
+ That is a statement, not yet a Signal. To send one, make `hello.sg` a module with an output port, write a module that receives it, and wire the two together:
77
+
78
+ `hello.sg`
79
+ ```
80
+ # signet: out text::message
81
+ let hello = 'Hello, world!'
82
+ output(text::message, hello)
83
+ ```
84
+
85
+ `world.cpp`
86
+ ```cpp
87
+ // signet: in text::input
88
+ #include <signet.hpp>
89
+ #include <iostream>
90
+ int main() {
91
+ auto m = signet::in<std::string>("input");
92
+ std::cout << m << '\n';
93
+ return 0;
94
+ }
95
+ ```
96
+
97
+ `messenger.sg`
98
+ ```
99
+ run(hello)
100
+ connect(hello.message!, world.input)
101
+ run(world)
102
+ ```
103
+
104
+ ```
105
+ $ ./signet messenger.sg
106
+ → Hello, world!
107
+ ```
108
+
109
+ `connect` is an arrow from one module's output port to another module's input port. Within a single pass the graph is acyclic, because a module can only read a Signal that already exists. Feedback loops are written as passes, each reading what the one before it wrote.
110
+
111
+ ## Signals
112
+
113
+ A Signal is a `.sig` file: one named result of one module run, written as JSON. In code, `!` is shorthand for `.sig`, so `messenger.output!` means `messenger.output.sig`.
114
+
115
+ ```json
116
+ {"value": "Hello, world!", "type": "text", "origin": "hello.hello",
117
+ "generated": "2026-10-23T17:08:22Z", "hash": "5daa9ee1…"}
118
+ ```
119
+
120
+ When a module's run ends cleanly, Signet **stamps** each Signal it wrote. A stamp records the hash of every input value and where it came from: a Signal by its stamp, a file by its SHA-256, a parameter by its value. It also records the module file. If anyone edits the Signal afterwards, it no longer matches its stamp.
121
+
122
+ ## The language at a glance
123
+
124
+ Signet borrows from Python, Julia, MATLAB, BASIC, Fortran 90, Rust, Haskell, C++ and the Unix shell. Typing is strong and dynamic, with optional `type::` annotations. Indexing is zero-based by default; `index(1)` changes that. Slices include both ends, and `last` names the last element.
125
+
126
+ Signet is deliberately **not Turing-complete**. Each loop is capped at 100,000 iterations, there is no unbounded `while`, and functions can't recurse, so every script terminates. Anything that needs more belongs in a module.
127
+
128
+ ```
129
+ # Comments start with #
130
+ let mass = $mass # A parameter, from --param mass=…
131
+ where gravity = 9.81 # A constant
132
+ let weight = mass * gravity # A variable
133
+ echo(weight)
134
+
135
+ for k = 0:2 # Loops are bounded
136
+ if k == 1 then
137
+ echo(k)
138
+ end if
139
+ next k
140
+
141
+ f(x) = x**2 + 1 # Short form of function … end function
142
+ let v = map(f, [1, 2, 3])
143
+
144
+ connect(v, plot.y) # Give a module's input a value
145
+ run(plot)
146
+ lineage(plot.figure!) # Print the chain that made a Signal
147
+ ```
148
+
149
+ **Types:** `int`, `float`, `real`, `num`, `bool`, `hex`, `bits::<n>`, `text`, `complex`, `quaternion`, `hypercomplex`, `vector::<type>`, `tuple`, `range`, `series::<domain>::<float|complex|quaternion>`, `stream::<domain>::<float|complex>`, `bus`, or a file extension such as `csv`.
150
+
151
+ **Routing:** `route(v, exit, [a, b])` fans a value out to several inputs, and `route(s, merge, [t, u])` appends Signals. Optional case markers state a value's role: `ex` (`.sta`), `ab` (`.lta`) and `ad` (`.lle`).
152
+
153
+ **Waiting:** `when c within s by s … end when` waits for a condition, with deadlines. Streams (timestamped samples that arrive while their source is running) are read with `sample(s)`, `$sample(s)`, `@sample(s)` and `freeze(s)`.
154
+
155
+ Appendix A of the book has the full quick reference: 120 reserved words, the operators in order of precedence, and the built-in functions. The additions since the book follow.
156
+
157
+ ### Quick reference: new in 26.b.0.1.7
158
+
159
+ | Syntax | Definition |
160
+ |---|---|
161
+ | `if c then … elseif d then … else … end if` | Further conditions, tested in turn; one `end if` closes the chain. `then` is optional. |
162
+ | `base(value, from, to)` | An integer's digits read in base `from` and written in base `to` (2 to 36): `base(255, 10, 16)` is `"FF"`, `base('FF', 16, 10)` is `255`. Base 10 gives an `int`, any other base `text`. A hex or bits value gives its own digits. |
163
+ | `(w, x, y, z)` | A quaternion, w + xi + yj + zk: `let quaternion::q = (1, 0, 0, 0)` |
164
+ | `quaternion` | A quaternion; also `vector::quaternion` and `series::<domain>::quaternion` |
165
+ | `hypercomplex` | A real, complex or quaternion number |
166
+ | `+ - * /` on quaternions | Hamilton's product (`i * j` is `k`); a real or complex number promotes. `p / q` is `p` times the inverse of `q`. Only `==` and `/=` compare. |
167
+ | `abs(q)`, `\|q\|`, `conj(q)`, `q‾`, `arg(q)` | Norm, conjugate, and the angle from the real axis (0 to π) |
168
+ | `q ** n`, `power(q, n)`, `root(q, n)` | A real power or root (principal value) |
169
+ | `Re(q)`, `Im(q)` | The real part `w`, and the vector part `[x, y, z]` |
170
+ | `versor(q)` | `q` over its norm |
171
+ | `ang2quat(Z, Y, X)` | The unit quaternion of a rotation by Z, then Y, then X (yaw, pitch, roll), in radians |
172
+ | `quat2ang(q)` | `[Z, Y, X]` back, in radians; at a pitch of ±π/2 the roll is 0 and Z takes the rest |
173
+ | `sum`, `product`, `mean`, `norm`, `length` | Also work on a `vector::quaternion` (`product` multiplies in order) |
174
+
175
+ `num` is still a real or complex number, so existing `num` ports are unchanged. `quaternion::` doesn't turn a real into a quaternion (as `complex::` doesn't); arithmetic does. Streams of quaternions are planned for a later version.
176
+
177
+ Built-in words added: `versor`, `quat2ang`, `ang2quat` (built-in functions, so not variable names) and `hypercomplex` (a type). `elseif` and `base` now do what they were reserved for.
178
+
179
+ ## Modules
180
+
181
+ A module is any program that reads its inputs and writes its outputs as Signals. A module declares its ports in a comment, using its own language's comment marker (`#`, `//`, `--` or `!`):
182
+
183
+ ```python
184
+ # signet: in float::volts, in float::amps, out float::watts
185
+ from signet import signals
186
+ signals.watts = signals.volts * signals.amps # Writes multiply.watts.sig
187
+ ```
188
+
189
+ `run(multiply)` finds `multiply.<ext>` in the working folder. There can be only one module per name: if `multiply.py` and `multiply.sg` are both present, Signet reports `multiply matches multiply.py, multiply.sg`.
190
+
191
+ | Language | Extension | How it runs |
192
+ |---|---|---|
193
+ | Signet | `.sg` | Natively |
194
+ | Python | `.py` | Interpreted (`from signet import signals`) |
195
+ | Julia | `.jl` | Interpreted (`using Signet: signals`; needs JSON3) |
196
+ | ALGOL 68 | `.a68` | Interpreted |
197
+ | C, C++ | `.c`, `.cpp` | Compiled by Signet (C11, C++17) |
198
+ | Rust | `.rs` | Compiled by Signet with `rustc` (no Cargo) |
199
+ | Ada | `.adb` | Compiled by Signet with `gnatmake` |
200
+ | Fortran | `.f90` | Compiled by Signet with `gfortran` |
201
+ | Haskell | `.hs` | Compiled by Signet with `ghc` (`import Signet`) |
202
+
203
+ Signet compiles a module the first time it runs, and again only when its source or Signet changes. On Debian or Ubuntu, install the compilers with:
204
+
205
+ ```sh
206
+ sudo apt install gcc g++ gnat gfortran rustc ghc
207
+ ```
208
+
209
+ A Haskell module, `multiply.hs`:
210
+
211
+ ```haskell
212
+ -- signet: in float::volts, in float::amps, out float::watts
213
+ import Signet
214
+
215
+ main :: IO ()
216
+ main = do
217
+ v <- getFloat "volts"
218
+ i <- getFloat "amps"
219
+ put "watts" (v * i) ""
220
+ ```
221
+
222
+ Quaternion ports work in every helper: `Quaternion` in Python, Quaternions.jl's `Quaternion` in Julia (loaded only when a quaternion is used, so other Julia modules still need only JSON3), `signet::Quaternion` in C++, `signet_quaternion` in C, `signet::Quaternion` in Rust, `Signet.Quaternion` in Ada, `type(signet_quaternion)` in Fortran, `SIGNETQUAT` in ALGOL 68 and `Quaternion` in Haskell. A quaternion input reads a real or complex number as a quaternion too, which is how a `hypercomplex` port is read in a compiled language.
223
+
224
+ ### Helpers
225
+
226
+ The helper files are embedded in Signet. To write them out, run:
227
+
228
+ ```sh
229
+ ./signet --export-helpers include
230
+ ```
231
+
232
+ | Language | File | Use |
233
+ |---|---|---|
234
+ | Ada | `signet.ads`, `signet.adb` | `with Signet;` |
235
+ | C | `signet.h` | `#include <signet.h>` |
236
+ | C++ | `signet.hpp` | `#include <signet.hpp>` |
237
+ | Fortran | `signet.f90` | `use signet` |
238
+ | Haskell | `Signet.hs` | `import Signet` |
239
+ | Rust | `signet.rs` | `use signet::get_f64;` |
240
+
241
+ The helpers only change when Signet does, so export them again after updating. To compile a module yourself and check it for errors before wiring it in:
242
+
243
+ ```sh
244
+ gcc -O2 -std=c11 -I include module.c -o module -lm
245
+ g++ -O2 -std=c++17 -I include module.cpp -o module
246
+
247
+ # Rust: build the library once, then each module
248
+ rustc --edition 2021 -O --crate-type rlib --crate-name signet include/signet.rs -o include/libsignet.rlib
249
+ rustc --edition 2021 -O --extern signet=include/libsignet.rlib module.rs -o module
250
+
251
+ # Fortran: compile the helper once, then link each module
252
+ gfortran -O2 -c -J include include/signet.f90 -o include/signet.o
253
+ gfortran -O2 -I include module.f90 include/signet.o -o module
254
+
255
+ # Ada
256
+ mkdir -p obj && gnatmake -q -O2 -gnat2012 -Iinclude -D obj module.adb -o module
257
+
258
+ # Haskell
259
+ ghc -O1 -iinclude -outputdir obj module.hs -o module
260
+ ```
261
+
262
+ Streams default to a window of 1024 samples. For example, in Python:
263
+
264
+ ```python
265
+ v = signals.stream("volts", domain="time", window=1024)
266
+ v.write(t, x)
267
+ ```
268
+
269
+ ## Command line
270
+
271
+ ```
272
+ signet [file] [--param NAME=VALUE] [--check] [--lineage SIG]
273
+ [--export-helpers DIR] [--connections] [--version]
274
+ ```
275
+
276
+ | Flag | Does |
277
+ |---|---|
278
+ | `--param NAME=VALUE` | Sets `$NAME` (repeatable) |
279
+ | `--check` | Reads the file and reports every suspect line, without running it |
280
+ | `--lineage SIG` | Prints the chain that made a Signal in this folder (`name.sig` or `name!`) |
281
+ | `--export-helpers DIR` | Writes the module helpers into `DIR` |
282
+ | `--connections` | Prints the file's `connect()`s as JSON, without running it |
283
+ | `--version` | Prints the version |
284
+
285
+ **Exit codes:** `0` means the file ran to the end, `1` means an error (the message names the line), and `2` means the code reached `break`.
286
+
287
+ Both `.sg` and the older `.signet` extension are accepted.
288
+
289
+ ### Lineage
290
+
291
+ ```
292
+ $ ./signet --lineage performance_test.report!
293
+ performance_test.report! = true bool made by chamber:performance_test.report at …, stamp ok
294
+ module performance_test.rs (unchanged)
295
+ temperature <-
296
+ tvac.temperature! = {…} stream::time::float made by chamber:tvac.temperature at …, stamp ok
297
+ module tvac.rs (unchanged)
298
+ setpoint <- written in the code
299
+ ```
300
+
301
+ Problems are reported in the chain as `edited after it was stamped`, `replaced by a later run`, `missing`, `module … (changed since)` or `file … (changed since)`.
302
+
303
+ ## Visualizing a system
304
+
305
+ Run either tool in the system's working folder:
306
+
307
+ ```sh
308
+ python3 visualizer.py wiring.sg -o diagram.svg --theme light --large --label car=10:speed
309
+ ./signet wiring.sg --connections | python3 sys2dot.py | dot -Tsvg -o system.svg
310
+ ```
311
+
312
+ `visualizer.py` uses only the standard library. It uses `signet.py` from its own folder if present, or else the `signet` binary. A line is solid where its source Signal exists and faint where there is no data yet. `sys2dot.py` needs Graphviz (`sudo apt install graphviz`). In both, stepped feedback lines are dashed.
313
+
314
+ ## Starfire
315
+
316
+ In Starfire, Signet code goes in each test point's **Signals** box, and a point's Signal is written `10:module.port!`. If `signet.py` is next to `starfire.py`, Starfire imports it. See the [Starfire README](https://github.com/ddesai76/starfire).
317
+
318
+ ## License
319
+
320
+ MIT. The software is provided "as is", without warranty of any kind. See `LICENSE`.
321
+
322
+ Developed with AI assistance (Claude, Anthropic); all technical claims and results were reviewed and verified by the author.
@@ -0,0 +1,305 @@
1
+ # Signet
2
+
3
+ **Signet 26** (26.b.0.1.7) is a lightweight coordination language for building systems of programs written in any language. The programs, called **modules**, pass results to one another as **Signals**. Signet is the wiring between them: a typed directed multigraph where modules are nodes and Signals are arrows.
4
+
5
+ Signet was first developed for [Starfire](https://github.com/ddesai76/starfire), a test design suite where each test point can run a module. It also runs on its own, as wiring code in any folder of modules.
6
+
7
+ This repository goes with the book *The Signet Programming Language* (Daniel Desai, 2026). The book is the full guide; this README covers getting started.
8
+
9
+ ## Contents
10
+
11
+ | File | What it is |
12
+ |---|---|
13
+ | `signet.py` | The reference implementation: the evaluator, CLI and embedded module helpers |
14
+ | `build.sh` | Builds the standalone `signet` binary from `signet.py` on Linux (`--onefile` for a single file) |
15
+ | `build.ps1` | The same on Windows: `signet.exe` (`-OneFile` for a single file) |
16
+ | `pyproject.toml` | The PyPI package, `signet-lang` |
17
+ | `.github/workflows/regress.yml` | Runs `signet-tests/regress.py` on Linux and Windows, from source, the pipx install and both binaries |
18
+ | `.github/workflows/release.yml` | Publishes a tagged release to PyPI once the regression passes |
19
+ | `signet.rs` | The Rust module helper, as written by `--export-helpers` |
20
+ | `visualizer.py` | Draws a system as SVG, in the style of Starfire's System view |
21
+ | `sys2dot.py` | Turns `--connections` JSON into a Graphviz graph |
22
+
23
+ ## Install
24
+
25
+ From PyPI, as `signet-lang` (the command is `signet`). pipx keeps it in its own environment:
26
+
27
+ ```sh
28
+ pipx install signet-lang
29
+ signet hello.sg
30
+ pipx upgrade signet-lang # a newer release
31
+ ```
32
+
33
+ On Linux, `#!/usr/bin/env signet` as a program's first line lets `chmod +x hello.sg && ./hello.sg` run it.
34
+
35
+ `signet.py` needs only Python 3.8 or later and its standard library, so it also runs without installing. Put `signet.py`, or the `signet` binary, in the working folder:
36
+
37
+ ```sh
38
+ python3 signet.py hello.sg # from source
39
+ ./signet hello.sg # standalone binary
40
+ ```
41
+
42
+ To build the binary, run `./build.sh` on Linux, or `powershell -ExecutionPolicy Bypass -File build.ps1` on Windows (needs `python -m pip install nuitka`).
43
+
44
+ On Windows, run `python signet.py hello.sg` or `signet.exe hello.sg`. Compiled modules need the compilers on `PATH`: MSYS2's UCRT64 toolchain (`gcc`, `g++`, `gfortran`, `gnatmake`), Rust, and GHC; shell modules need Git Bash. Windows support is new in 26.b.0.1.7 and so far checked only by the CI workflow.
45
+
46
+ ## Hello, Signal
47
+
48
+ `hello.sg`:
49
+
50
+ ```
51
+ echo('Hello, world!')
52
+ ```
53
+
54
+ ```
55
+ $ ./signet hello.sg
56
+ → line 1: 'Hello, world!' = "Hello, world!"
57
+ ```
58
+
59
+ That is a statement, not yet a Signal. To send one, make `hello.sg` a module with an output port, write a module that receives it, and wire the two together:
60
+
61
+ `hello.sg`
62
+ ```
63
+ # signet: out text::message
64
+ let hello = 'Hello, world!'
65
+ output(text::message, hello)
66
+ ```
67
+
68
+ `world.cpp`
69
+ ```cpp
70
+ // signet: in text::input
71
+ #include <signet.hpp>
72
+ #include <iostream>
73
+ int main() {
74
+ auto m = signet::in<std::string>("input");
75
+ std::cout << m << '\n';
76
+ return 0;
77
+ }
78
+ ```
79
+
80
+ `messenger.sg`
81
+ ```
82
+ run(hello)
83
+ connect(hello.message!, world.input)
84
+ run(world)
85
+ ```
86
+
87
+ ```
88
+ $ ./signet messenger.sg
89
+ → Hello, world!
90
+ ```
91
+
92
+ `connect` is an arrow from one module's output port to another module's input port. Within a single pass the graph is acyclic, because a module can only read a Signal that already exists. Feedback loops are written as passes, each reading what the one before it wrote.
93
+
94
+ ## Signals
95
+
96
+ A Signal is a `.sig` file: one named result of one module run, written as JSON. In code, `!` is shorthand for `.sig`, so `messenger.output!` means `messenger.output.sig`.
97
+
98
+ ```json
99
+ {"value": "Hello, world!", "type": "text", "origin": "hello.hello",
100
+ "generated": "2026-10-23T17:08:22Z", "hash": "5daa9ee1…"}
101
+ ```
102
+
103
+ When a module's run ends cleanly, Signet **stamps** each Signal it wrote. A stamp records the hash of every input value and where it came from: a Signal by its stamp, a file by its SHA-256, a parameter by its value. It also records the module file. If anyone edits the Signal afterwards, it no longer matches its stamp.
104
+
105
+ ## The language at a glance
106
+
107
+ Signet borrows from Python, Julia, MATLAB, BASIC, Fortran 90, Rust, Haskell, C++ and the Unix shell. Typing is strong and dynamic, with optional `type::` annotations. Indexing is zero-based by default; `index(1)` changes that. Slices include both ends, and `last` names the last element.
108
+
109
+ Signet is deliberately **not Turing-complete**. Each loop is capped at 100,000 iterations, there is no unbounded `while`, and functions can't recurse, so every script terminates. Anything that needs more belongs in a module.
110
+
111
+ ```
112
+ # Comments start with #
113
+ let mass = $mass # A parameter, from --param mass=…
114
+ where gravity = 9.81 # A constant
115
+ let weight = mass * gravity # A variable
116
+ echo(weight)
117
+
118
+ for k = 0:2 # Loops are bounded
119
+ if k == 1 then
120
+ echo(k)
121
+ end if
122
+ next k
123
+
124
+ f(x) = x**2 + 1 # Short form of function … end function
125
+ let v = map(f, [1, 2, 3])
126
+
127
+ connect(v, plot.y) # Give a module's input a value
128
+ run(plot)
129
+ lineage(plot.figure!) # Print the chain that made a Signal
130
+ ```
131
+
132
+ **Types:** `int`, `float`, `real`, `num`, `bool`, `hex`, `bits::<n>`, `text`, `complex`, `quaternion`, `hypercomplex`, `vector::<type>`, `tuple`, `range`, `series::<domain>::<float|complex|quaternion>`, `stream::<domain>::<float|complex>`, `bus`, or a file extension such as `csv`.
133
+
134
+ **Routing:** `route(v, exit, [a, b])` fans a value out to several inputs, and `route(s, merge, [t, u])` appends Signals. Optional case markers state a value's role: `ex` (`.sta`), `ab` (`.lta`) and `ad` (`.lle`).
135
+
136
+ **Waiting:** `when c within s by s … end when` waits for a condition, with deadlines. Streams (timestamped samples that arrive while their source is running) are read with `sample(s)`, `$sample(s)`, `@sample(s)` and `freeze(s)`.
137
+
138
+ Appendix A of the book has the full quick reference: 120 reserved words, the operators in order of precedence, and the built-in functions. The additions since the book follow.
139
+
140
+ ### Quick reference: new in 26.b.0.1.7
141
+
142
+ | Syntax | Definition |
143
+ |---|---|
144
+ | `if c then … elseif d then … else … end if` | Further conditions, tested in turn; one `end if` closes the chain. `then` is optional. |
145
+ | `base(value, from, to)` | An integer's digits read in base `from` and written in base `to` (2 to 36): `base(255, 10, 16)` is `"FF"`, `base('FF', 16, 10)` is `255`. Base 10 gives an `int`, any other base `text`. A hex or bits value gives its own digits. |
146
+ | `(w, x, y, z)` | A quaternion, w + xi + yj + zk: `let quaternion::q = (1, 0, 0, 0)` |
147
+ | `quaternion` | A quaternion; also `vector::quaternion` and `series::<domain>::quaternion` |
148
+ | `hypercomplex` | A real, complex or quaternion number |
149
+ | `+ - * /` on quaternions | Hamilton's product (`i * j` is `k`); a real or complex number promotes. `p / q` is `p` times the inverse of `q`. Only `==` and `/=` compare. |
150
+ | `abs(q)`, `\|q\|`, `conj(q)`, `q‾`, `arg(q)` | Norm, conjugate, and the angle from the real axis (0 to π) |
151
+ | `q ** n`, `power(q, n)`, `root(q, n)` | A real power or root (principal value) |
152
+ | `Re(q)`, `Im(q)` | The real part `w`, and the vector part `[x, y, z]` |
153
+ | `versor(q)` | `q` over its norm |
154
+ | `ang2quat(Z, Y, X)` | The unit quaternion of a rotation by Z, then Y, then X (yaw, pitch, roll), in radians |
155
+ | `quat2ang(q)` | `[Z, Y, X]` back, in radians; at a pitch of ±π/2 the roll is 0 and Z takes the rest |
156
+ | `sum`, `product`, `mean`, `norm`, `length` | Also work on a `vector::quaternion` (`product` multiplies in order) |
157
+
158
+ `num` is still a real or complex number, so existing `num` ports are unchanged. `quaternion::` doesn't turn a real into a quaternion (as `complex::` doesn't); arithmetic does. Streams of quaternions are planned for a later version.
159
+
160
+ Built-in words added: `versor`, `quat2ang`, `ang2quat` (built-in functions, so not variable names) and `hypercomplex` (a type). `elseif` and `base` now do what they were reserved for.
161
+
162
+ ## Modules
163
+
164
+ A module is any program that reads its inputs and writes its outputs as Signals. A module declares its ports in a comment, using its own language's comment marker (`#`, `//`, `--` or `!`):
165
+
166
+ ```python
167
+ # signet: in float::volts, in float::amps, out float::watts
168
+ from signet import signals
169
+ signals.watts = signals.volts * signals.amps # Writes multiply.watts.sig
170
+ ```
171
+
172
+ `run(multiply)` finds `multiply.<ext>` in the working folder. There can be only one module per name: if `multiply.py` and `multiply.sg` are both present, Signet reports `multiply matches multiply.py, multiply.sg`.
173
+
174
+ | Language | Extension | How it runs |
175
+ |---|---|---|
176
+ | Signet | `.sg` | Natively |
177
+ | Python | `.py` | Interpreted (`from signet import signals`) |
178
+ | Julia | `.jl` | Interpreted (`using Signet: signals`; needs JSON3) |
179
+ | ALGOL 68 | `.a68` | Interpreted |
180
+ | C, C++ | `.c`, `.cpp` | Compiled by Signet (C11, C++17) |
181
+ | Rust | `.rs` | Compiled by Signet with `rustc` (no Cargo) |
182
+ | Ada | `.adb` | Compiled by Signet with `gnatmake` |
183
+ | Fortran | `.f90` | Compiled by Signet with `gfortran` |
184
+ | Haskell | `.hs` | Compiled by Signet with `ghc` (`import Signet`) |
185
+
186
+ Signet compiles a module the first time it runs, and again only when its source or Signet changes. On Debian or Ubuntu, install the compilers with:
187
+
188
+ ```sh
189
+ sudo apt install gcc g++ gnat gfortran rustc ghc
190
+ ```
191
+
192
+ A Haskell module, `multiply.hs`:
193
+
194
+ ```haskell
195
+ -- signet: in float::volts, in float::amps, out float::watts
196
+ import Signet
197
+
198
+ main :: IO ()
199
+ main = do
200
+ v <- getFloat "volts"
201
+ i <- getFloat "amps"
202
+ put "watts" (v * i) ""
203
+ ```
204
+
205
+ Quaternion ports work in every helper: `Quaternion` in Python, Quaternions.jl's `Quaternion` in Julia (loaded only when a quaternion is used, so other Julia modules still need only JSON3), `signet::Quaternion` in C++, `signet_quaternion` in C, `signet::Quaternion` in Rust, `Signet.Quaternion` in Ada, `type(signet_quaternion)` in Fortran, `SIGNETQUAT` in ALGOL 68 and `Quaternion` in Haskell. A quaternion input reads a real or complex number as a quaternion too, which is how a `hypercomplex` port is read in a compiled language.
206
+
207
+ ### Helpers
208
+
209
+ The helper files are embedded in Signet. To write them out, run:
210
+
211
+ ```sh
212
+ ./signet --export-helpers include
213
+ ```
214
+
215
+ | Language | File | Use |
216
+ |---|---|---|
217
+ | Ada | `signet.ads`, `signet.adb` | `with Signet;` |
218
+ | C | `signet.h` | `#include <signet.h>` |
219
+ | C++ | `signet.hpp` | `#include <signet.hpp>` |
220
+ | Fortran | `signet.f90` | `use signet` |
221
+ | Haskell | `Signet.hs` | `import Signet` |
222
+ | Rust | `signet.rs` | `use signet::get_f64;` |
223
+
224
+ The helpers only change when Signet does, so export them again after updating. To compile a module yourself and check it for errors before wiring it in:
225
+
226
+ ```sh
227
+ gcc -O2 -std=c11 -I include module.c -o module -lm
228
+ g++ -O2 -std=c++17 -I include module.cpp -o module
229
+
230
+ # Rust: build the library once, then each module
231
+ rustc --edition 2021 -O --crate-type rlib --crate-name signet include/signet.rs -o include/libsignet.rlib
232
+ rustc --edition 2021 -O --extern signet=include/libsignet.rlib module.rs -o module
233
+
234
+ # Fortran: compile the helper once, then link each module
235
+ gfortran -O2 -c -J include include/signet.f90 -o include/signet.o
236
+ gfortran -O2 -I include module.f90 include/signet.o -o module
237
+
238
+ # Ada
239
+ mkdir -p obj && gnatmake -q -O2 -gnat2012 -Iinclude -D obj module.adb -o module
240
+
241
+ # Haskell
242
+ ghc -O1 -iinclude -outputdir obj module.hs -o module
243
+ ```
244
+
245
+ Streams default to a window of 1024 samples. For example, in Python:
246
+
247
+ ```python
248
+ v = signals.stream("volts", domain="time", window=1024)
249
+ v.write(t, x)
250
+ ```
251
+
252
+ ## Command line
253
+
254
+ ```
255
+ signet [file] [--param NAME=VALUE] [--check] [--lineage SIG]
256
+ [--export-helpers DIR] [--connections] [--version]
257
+ ```
258
+
259
+ | Flag | Does |
260
+ |---|---|
261
+ | `--param NAME=VALUE` | Sets `$NAME` (repeatable) |
262
+ | `--check` | Reads the file and reports every suspect line, without running it |
263
+ | `--lineage SIG` | Prints the chain that made a Signal in this folder (`name.sig` or `name!`) |
264
+ | `--export-helpers DIR` | Writes the module helpers into `DIR` |
265
+ | `--connections` | Prints the file's `connect()`s as JSON, without running it |
266
+ | `--version` | Prints the version |
267
+
268
+ **Exit codes:** `0` means the file ran to the end, `1` means an error (the message names the line), and `2` means the code reached `break`.
269
+
270
+ Both `.sg` and the older `.signet` extension are accepted.
271
+
272
+ ### Lineage
273
+
274
+ ```
275
+ $ ./signet --lineage performance_test.report!
276
+ performance_test.report! = true bool made by chamber:performance_test.report at …, stamp ok
277
+ module performance_test.rs (unchanged)
278
+ temperature <-
279
+ tvac.temperature! = {…} stream::time::float made by chamber:tvac.temperature at …, stamp ok
280
+ module tvac.rs (unchanged)
281
+ setpoint <- written in the code
282
+ ```
283
+
284
+ Problems are reported in the chain as `edited after it was stamped`, `replaced by a later run`, `missing`, `module … (changed since)` or `file … (changed since)`.
285
+
286
+ ## Visualizing a system
287
+
288
+ Run either tool in the system's working folder:
289
+
290
+ ```sh
291
+ python3 visualizer.py wiring.sg -o diagram.svg --theme light --large --label car=10:speed
292
+ ./signet wiring.sg --connections | python3 sys2dot.py | dot -Tsvg -o system.svg
293
+ ```
294
+
295
+ `visualizer.py` uses only the standard library. It uses `signet.py` from its own folder if present, or else the `signet` binary. A line is solid where its source Signal exists and faint where there is no data yet. `sys2dot.py` needs Graphviz (`sudo apt install graphviz`). In both, stepped feedback lines are dashed.
296
+
297
+ ## Starfire
298
+
299
+ In Starfire, Signet code goes in each test point's **Signals** box, and a point's Signal is written `10:module.port!`. If `signet.py` is next to `starfire.py`, Starfire imports it. See the [Starfire README](https://github.com/ddesai76/starfire).
300
+
301
+ ## License
302
+
303
+ MIT. The software is provided "as is", without warranty of any kind. See `LICENSE`.
304
+
305
+ Developed with AI assistance (Claude, Anthropic); all technical claims and results were reviewed and verified by the author.
@@ -0,0 +1,36 @@
1
+ # pyproject.toml: SIGNET ON PYPI (signet-lang; the command is signet)
2
+ # AUTHOR: DANIEL DESAI
3
+ # UPDATED: 2026-11-17
4
+ # VERSION: 26.b.0.1.7
5
+ #
6
+ # PyPI version: 26.b.0.1.N is 26.0bN0 (betas); the stable release is 26.0. regress.py checks it matches VERSION.
7
+
8
+ [build-system]
9
+ requires = ["setuptools>=77"]
10
+ build-backend = "setuptools.build_meta"
11
+
12
+ [project]
13
+ name = "signet-lang"
14
+ version = "26.0b70"
15
+ description = "Signet: a coordination language that wires modules in any language together with Signals"
16
+ readme = "README.md"
17
+ license = "MIT"
18
+ license-files = ["LICENSE"]
19
+ authors = [{name = "Daniel Desai"}]
20
+ requires-python = ">=3.8"
21
+ classifiers = [
22
+ "Programming Language :: Other",
23
+ "Programming Language :: Python :: 3",
24
+ "Operating System :: POSIX :: Linux",
25
+ "Operating System :: Microsoft :: Windows",
26
+ "Topic :: Software Development :: Interpreters",
27
+ ]
28
+
29
+ [project.urls]
30
+ Source = "https://github.com/ddesai76/signet"
31
+
32
+ [project.scripts]
33
+ signet = "signet:main"
34
+
35
+ [tool.setuptools]
36
+ py-modules = ["signet"]