sr-zero 0.9.0__tar.gz → 0.9.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 (41) hide show
  1. {sr_zero-0.9.0 → sr_zero-0.9.1}/PKG-INFO +19 -9
  2. {sr_zero-0.9.0 → sr_zero-0.9.1}/README.pypi.md +18 -8
  3. {sr_zero-0.9.0 → sr_zero-0.9.1}/pyproject.toml +7 -1
  4. {sr_zero-0.9.0 → sr_zero-0.9.1}/sr_zero.egg-info/PKG-INFO +19 -9
  5. {sr_zero-0.9.0 → sr_zero-0.9.1}/system_zero/__init__.py +1 -1
  6. {sr_zero-0.9.0 → sr_zero-0.9.1}/system_zero/console.py +11 -1
  7. {sr_zero-0.9.0 → sr_zero-0.9.1}/DATA_SOURCES.md +0 -0
  8. {sr_zero-0.9.0 → sr_zero-0.9.1}/LICENSE +0 -0
  9. {sr_zero-0.9.0 → sr_zero-0.9.1}/MANIFEST.in +0 -0
  10. {sr_zero-0.9.0 → sr_zero-0.9.1}/NOTICE +0 -0
  11. {sr_zero-0.9.0 → sr_zero-0.9.1}/setup.cfg +0 -0
  12. {sr_zero-0.9.0 → sr_zero-0.9.1}/sr_zero.egg-info/SOURCES.txt +0 -0
  13. {sr_zero-0.9.0 → sr_zero-0.9.1}/sr_zero.egg-info/dependency_links.txt +0 -0
  14. {sr_zero-0.9.0 → sr_zero-0.9.1}/sr_zero.egg-info/entry_points.txt +0 -0
  15. {sr_zero-0.9.0 → sr_zero-0.9.1}/sr_zero.egg-info/top_level.txt +0 -0
  16. {sr_zero-0.9.0 → sr_zero-0.9.1}/system_zero/__main__.py +0 -0
  17. {sr_zero-0.9.0 → sr_zero-0.9.1}/system_zero/cli.py +0 -0
  18. {sr_zero-0.9.0 → sr_zero-0.9.1}/system_zero/cues.py +0 -0
  19. {sr_zero-0.9.0 → sr_zero-0.9.1}/system_zero/decision_index.py +0 -0
  20. {sr_zero-0.9.0 → sr_zero-0.9.1}/system_zero/evidence.py +0 -0
  21. {sr_zero-0.9.0 → sr_zero-0.9.1}/system_zero/marks.py +0 -0
  22. {sr_zero-0.9.0 → sr_zero-0.9.1}/system_zero/model.py +0 -0
  23. {sr_zero-0.9.0 → sr_zero-0.9.1}/system_zero/modules/__init__.py +0 -0
  24. {sr_zero-0.9.0 → sr_zero-0.9.1}/system_zero/modules/match.py +0 -0
  25. {sr_zero-0.9.0 → sr_zero-0.9.1}/system_zero/modules/music.py +0 -0
  26. {sr_zero-0.9.0 → sr_zero-0.9.1}/system_zero/modules/puzzles.py +0 -0
  27. {sr_zero-0.9.0 → sr_zero-0.9.1}/system_zero/modules/run.py +0 -0
  28. {sr_zero-0.9.0 → sr_zero-0.9.1}/system_zero/modules/scenes.py +0 -0
  29. {sr_zero-0.9.0 → sr_zero-0.9.1}/system_zero/modules/tools.py +0 -0
  30. {sr_zero-0.9.0 → sr_zero-0.9.1}/system_zero/modules/verse.py +0 -0
  31. {sr_zero-0.9.0 → sr_zero-0.9.1}/system_zero/request.py +0 -0
  32. {sr_zero-0.9.0 → sr_zero-0.9.1}/system_zero/rules/__init__.py +0 -0
  33. {sr_zero-0.9.0 → sr_zero-0.9.1}/system_zero/rules/cues.py +0 -0
  34. {sr_zero-0.9.0 → sr_zero-0.9.1}/system_zero/rules/frames.py +0 -0
  35. {sr_zero-0.9.0 → sr_zero-0.9.1}/system_zero/rules/modules.py +0 -0
  36. {sr_zero-0.9.0 → sr_zero-0.9.1}/system_zero/rules/option_sets.py +0 -0
  37. {sr_zero-0.9.0 → sr_zero-0.9.1}/system_zero/rules/options.py +0 -0
  38. {sr_zero-0.9.0 → sr_zero-0.9.1}/system_zero/scopes.py +0 -0
  39. {sr_zero-0.9.0 → sr_zero-0.9.1}/system_zero/server.py +0 -0
  40. {sr_zero-0.9.0 → sr_zero-0.9.1}/system_zero/systemone.py +0 -0
  41. {sr_zero-0.9.0 → sr_zero-0.9.1}/system_zero/text.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sr-zero
3
- Version: 0.9.0
3
+ Version: 0.9.1
4
4
  Summary: A decision model with no learned weights: readable rule tables learned from data, plus hand-written modules. Pure Python, no dependencies.
5
5
  Author: vLLM Semantic Router
6
6
  License-Expression: Apache-2.0 AND LicenseRef-System-Zero-Rule-Tables
@@ -48,7 +48,7 @@ their licence is under review. Check `DATA_SOURCES.md`, installed with the packa
48
48
  ## Install
49
49
 
50
50
  ```sh
51
- uvx sr-zero "Check out my channel and subscribe!" -q "Is this comment spam?" --yes-no
51
+ uvx sr-zero 'Check out my channel and subscribe' -q 'Is this comment spam?' --yes-no
52
52
  ```
53
53
 
54
54
  ```sh
@@ -56,9 +56,24 @@ uv tool install sr-zero # or: pip install sr-zero
56
56
  sr-zero serve --port 8000
57
57
  ```
58
58
 
59
+ Then, from another terminal, one question over HTTP:
60
+
61
+ ```sh
62
+ curl -s http://localhost:8000/v1/systemone \
63
+ -H 'Content-Type: application/json' \
64
+ -d '{"state": "Check out my channel and subscribe",
65
+ "questions": {"spam": {"type": "noul", "instructions": "Is this comment spam?"}}}'
66
+ ```
67
+
68
+ ```json
69
+ {"model":"system-zero","answers":{"spam":{"type":"noul","noul":0.9059390425448562}},"usage":{"input_tokens":10,"output_tokens":0}}
70
+ ```
71
+
59
72
  Python 3.9 or newer. The package installs the command `sr-zero`, also available as `system-zero`, and the Python
60
- package `system_zero`. Each process loads the rule tables once, which took 10 to 17 seconds and about 1.5 GB of
61
- memory in our tests, so for more than a few questions, run `sr-zero serve` or pass a file with `-j`.
73
+ package `system_zero`. Every process loads all the rule tables before its first answer: 8.5 to 21 seconds and 1.2 to
74
+ 1.4 GB of memory in our tests, depending on the Python version (the newer, the faster). `sr-zero serve` loads them
75
+ once and keeps them loaded, so for more than a few questions, run it or pass a file of requests with `-j`. A compact
76
+ rules format that loads lazily is planned for a later release.
62
77
 
63
78
  ## From the command line
64
79
 
@@ -104,11 +119,6 @@ extensions define it, so System One clients work unchanged.
104
119
  | `noul` | `instructions`; optionally `criteria.true` and `criteria.false` | `noul`: P(yes) |
105
120
  | `score` | `criteria`: 2 to 10 levels, lowest first | `score` (the expected level), `confidence`, `legend` and each level's `probabilities` |
106
121
 
107
- ```sh
108
- curl -s localhost:8000/v1/systemone -H 'Content-Type: application/json' \
109
- -d '{"state": "Check out my channel and subscribe!", "questions": {"spam": {"type": "noul", "instructions": "Is this comment spam?"}}}'
110
- ```
111
-
112
122
  Errors are the standard's. System Zero reads text: `box` questions and images are refused. Set
113
123
  `SYSTEM_ZERO_API_KEYS` to require an API key on the `/v1/` paths.
114
124
 
@@ -17,7 +17,7 @@ their licence is under review. Check `DATA_SOURCES.md`, installed with the packa
17
17
  ## Install
18
18
 
19
19
  ```sh
20
- uvx sr-zero "Check out my channel and subscribe!" -q "Is this comment spam?" --yes-no
20
+ uvx sr-zero 'Check out my channel and subscribe' -q 'Is this comment spam?' --yes-no
21
21
  ```
22
22
 
23
23
  ```sh
@@ -25,9 +25,24 @@ uv tool install sr-zero # or: pip install sr-zero
25
25
  sr-zero serve --port 8000
26
26
  ```
27
27
 
28
+ Then, from another terminal, one question over HTTP:
29
+
30
+ ```sh
31
+ curl -s http://localhost:8000/v1/systemone \
32
+ -H 'Content-Type: application/json' \
33
+ -d '{"state": "Check out my channel and subscribe",
34
+ "questions": {"spam": {"type": "noul", "instructions": "Is this comment spam?"}}}'
35
+ ```
36
+
37
+ ```json
38
+ {"model":"system-zero","answers":{"spam":{"type":"noul","noul":0.9059390425448562}},"usage":{"input_tokens":10,"output_tokens":0}}
39
+ ```
40
+
28
41
  Python 3.9 or newer. The package installs the command `sr-zero`, also available as `system-zero`, and the Python
29
- package `system_zero`. Each process loads the rule tables once, which took 10 to 17 seconds and about 1.5 GB of
30
- memory in our tests, so for more than a few questions, run `sr-zero serve` or pass a file with `-j`.
42
+ package `system_zero`. Every process loads all the rule tables before its first answer: 8.5 to 21 seconds and 1.2 to
43
+ 1.4 GB of memory in our tests, depending on the Python version (the newer, the faster). `sr-zero serve` loads them
44
+ once and keeps them loaded, so for more than a few questions, run it or pass a file of requests with `-j`. A compact
45
+ rules format that loads lazily is planned for a later release.
31
46
 
32
47
  ## From the command line
33
48
 
@@ -73,11 +88,6 @@ extensions define it, so System One clients work unchanged.
73
88
  | `noul` | `instructions`; optionally `criteria.true` and `criteria.false` | `noul`: P(yes) |
74
89
  | `score` | `criteria`: 2 to 10 levels, lowest first | `score` (the expected level), `confidence`, `legend` and each level's `probabilities` |
75
90
 
76
- ```sh
77
- curl -s localhost:8000/v1/systemone -H 'Content-Type: application/json' \
78
- -d '{"state": "Check out my channel and subscribe!", "questions": {"spam": {"type": "noul", "instructions": "Is this comment spam?"}}}'
79
- ```
80
-
81
91
  Errors are the standard's. System Zero reads text: `box` questions and images are refused. Set
82
92
  `SYSTEM_ZERO_API_KEYS` to require an API key on the `/v1/` paths.
83
93
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "sr-zero"
7
- version = "0.9.0"
7
+ version = "0.9.1"
8
8
  description = "A decision model with no learned weights: readable rule tables learned from data, plus hand-written modules. Pure Python, no dependencies."
9
9
  readme = "README.pypi.md"
10
10
  requires-python = ">=3.9"
@@ -41,3 +41,9 @@ system-zero = "system_zero.console:main"
41
41
 
42
42
  [tool.setuptools.packages.find]
43
43
  include = ["system_zero*"]
44
+
45
+ # The full-build release whose rule tables this version ships, and the package files outside system_zero/rules/
46
+ # that may differ from that release. scripts/build_release.py checks both against git.
47
+ [tool.sr-zero.release]
48
+ rules = "v0.9.0"
49
+ code-may-change = ["system_zero/__init__.py", "system_zero/console.py"]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sr-zero
3
- Version: 0.9.0
3
+ Version: 0.9.1
4
4
  Summary: A decision model with no learned weights: readable rule tables learned from data, plus hand-written modules. Pure Python, no dependencies.
5
5
  Author: vLLM Semantic Router
6
6
  License-Expression: Apache-2.0 AND LicenseRef-System-Zero-Rule-Tables
@@ -48,7 +48,7 @@ their licence is under review. Check `DATA_SOURCES.md`, installed with the packa
48
48
  ## Install
49
49
 
50
50
  ```sh
51
- uvx sr-zero "Check out my channel and subscribe!" -q "Is this comment spam?" --yes-no
51
+ uvx sr-zero 'Check out my channel and subscribe' -q 'Is this comment spam?' --yes-no
52
52
  ```
53
53
 
54
54
  ```sh
@@ -56,9 +56,24 @@ uv tool install sr-zero # or: pip install sr-zero
56
56
  sr-zero serve --port 8000
57
57
  ```
58
58
 
59
+ Then, from another terminal, one question over HTTP:
60
+
61
+ ```sh
62
+ curl -s http://localhost:8000/v1/systemone \
63
+ -H 'Content-Type: application/json' \
64
+ -d '{"state": "Check out my channel and subscribe",
65
+ "questions": {"spam": {"type": "noul", "instructions": "Is this comment spam?"}}}'
66
+ ```
67
+
68
+ ```json
69
+ {"model":"system-zero","answers":{"spam":{"type":"noul","noul":0.9059390425448562}},"usage":{"input_tokens":10,"output_tokens":0}}
70
+ ```
71
+
59
72
  Python 3.9 or newer. The package installs the command `sr-zero`, also available as `system-zero`, and the Python
60
- package `system_zero`. Each process loads the rule tables once, which took 10 to 17 seconds and about 1.5 GB of
61
- memory in our tests, so for more than a few questions, run `sr-zero serve` or pass a file with `-j`.
73
+ package `system_zero`. Every process loads all the rule tables before its first answer: 8.5 to 21 seconds and 1.2 to
74
+ 1.4 GB of memory in our tests, depending on the Python version (the newer, the faster). `sr-zero serve` loads them
75
+ once and keeps them loaded, so for more than a few questions, run it or pass a file of requests with `-j`. A compact
76
+ rules format that loads lazily is planned for a later release.
62
77
 
63
78
  ## From the command line
64
79
 
@@ -104,11 +119,6 @@ extensions define it, so System One clients work unchanged.
104
119
  | `noul` | `instructions`; optionally `criteria.true` and `criteria.false` | `noul`: P(yes) |
105
120
  | `score` | `criteria`: 2 to 10 levels, lowest first | `score` (the expected level), `confidence`, `legend` and each level's `probabilities` |
106
121
 
107
- ```sh
108
- curl -s localhost:8000/v1/systemone -H 'Content-Type: application/json' \
109
- -d '{"state": "Check out my channel and subscribe!", "questions": {"spam": {"type": "noul", "instructions": "Is this comment spam?"}}}'
110
- ```
111
-
112
122
  Errors are the standard's. System Zero reads text: `box` questions and images are refused. Set
113
123
  `SYSTEM_ZERO_API_KEYS` to require an API key on the `/v1/` paths.
114
124
 
@@ -1,5 +1,5 @@
1
1
  """System Zero: a decision model with 0 parameters. Every decision is a rule you can read."""
2
- __version__ = "0.9.0"
2
+ __version__ = "0.9.1"
3
3
 
4
4
  from . import systemone # noqa: E402
5
5
  from .model import SystemZero, decide # noqa: E402
@@ -36,7 +36,7 @@ commands:
36
36
  -j FILE answer {{"state", "questions"}} requests from a JSON or JSON-lines FILE ('-': stdin)
37
37
 
38
38
  examples:
39
- system-zero "Check out my channel and subscribe!" -q "Is this comment spam?" --yes-no
39
+ system-zero 'Check out my channel and subscribe' -q 'Is this comment spam?' --yes-no
40
40
  system-zero "Oh great, my flight got cancelled again." -q "Is this text intended to be sarcastic?" -o yes no
41
41
  system-zero serve --port 8000
42
42
  """
@@ -63,6 +63,9 @@ def main(argv=None):
63
63
  if argv[:1] in (["-h"], ["--help"]):
64
64
  print(overview())
65
65
  return 0
66
+ if argv[:1] == ["--version"]:
67
+ print(f"{program()} {__version__}")
68
+ return 0
66
69
  if argv[:1] == ["ask"]:
67
70
  argv = argv[1:]
68
71
  check_paths(argv)
@@ -153,6 +156,13 @@ def describe(error):
153
156
  return error.strerror or str(error)
154
157
 
155
158
 
159
+ def program():
160
+ """The name the command was run by: sr-zero or system-zero; system-zero for python -m and the zipapp."""
161
+ name = os.path.basename(sys.argv[0] or "")
162
+ name = name[:-4] if name.lower().endswith(".exe") else name
163
+ return name if name in ("sr-zero", "system-zero") else "system-zero"
164
+
165
+
156
166
  def fail(message, status):
157
167
  print(f"system-zero: {message}", file=sys.stderr)
158
168
  return status
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes