bitexoft-verify 0.2.1__tar.gz → 0.3.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 (60) hide show
  1. {bitexoft_verify-0.2.1 → bitexoft_verify-0.3.1}/.gitignore +3 -0
  2. {bitexoft_verify-0.2.1 → bitexoft_verify-0.3.1}/PKG-INFO +16 -3
  3. {bitexoft_verify-0.2.1 → bitexoft_verify-0.3.1}/README.md +15 -2
  4. bitexoft_verify-0.3.1/frozen.json +32 -0
  5. {bitexoft_verify-0.2.1 → bitexoft_verify-0.3.1}/pyproject.toml +3 -0
  6. {bitexoft_verify-0.2.1 → bitexoft_verify-0.3.1}/src/bitexoft_verify/__init__.py +1 -1
  7. {bitexoft_verify-0.2.1 → bitexoft_verify-0.3.1}/src/bitexoft_verify/checks/a1.py +11 -0
  8. bitexoft_verify-0.3.1/src/bitexoft_verify/checks/a2.py +602 -0
  9. bitexoft_verify-0.3.1/src/bitexoft_verify/checks/a2_design.py +157 -0
  10. bitexoft_verify-0.3.1/src/bitexoft_verify/checks/a3.py +701 -0
  11. {bitexoft_verify-0.2.1 → bitexoft_verify-0.3.1}/src/bitexoft_verify/checks/common.py +67 -9
  12. bitexoft_verify-0.3.1/src/bitexoft_verify/checks/earlier.py +44 -0
  13. {bitexoft_verify-0.2.1 → bitexoft_verify-0.3.1}/src/bitexoft_verify/checks/execution.py +10 -6
  14. bitexoft_verify-0.3.1/src/bitexoft_verify/checks/layers.py +233 -0
  15. bitexoft_verify-0.3.1/src/bitexoft_verify/checks/sources.py +248 -0
  16. {bitexoft_verify-0.2.1 → bitexoft_verify-0.3.1}/src/bitexoft_verify/cli.py +13 -4
  17. {bitexoft_verify-0.2.1 → bitexoft_verify-0.3.1}/src/bitexoft_verify/codes.py +37 -0
  18. {bitexoft_verify-0.2.1 → bitexoft_verify-0.3.1}/src/bitexoft_verify/data/README.md +3 -0
  19. bitexoft_verify-0.3.1/src/bitexoft_verify/data/issue-codes.json +198 -0
  20. {bitexoft_verify-0.2.1 → bitexoft_verify-0.3.1}/src/bitexoft_verify/runner.py +13 -3
  21. bitexoft_verify-0.3.1/tests/a3_reference.py +281 -0
  22. {bitexoft_verify-0.2.1 → bitexoft_verify-0.3.1}/tests/conftest.py +37 -1
  23. bitexoft_verify-0.3.1/tests/golden/a2_checks.json +6204 -0
  24. bitexoft_verify-0.3.1/tests/golden_guard.py +40 -0
  25. bitexoft_verify-0.3.1/tests/test_a2.py +521 -0
  26. bitexoft_verify-0.3.1/tests/test_a3.py +665 -0
  27. bitexoft_verify-0.3.1/tests/test_check_errors.py +70 -0
  28. bitexoft_verify-0.3.1/tests/test_earlier.py +107 -0
  29. {bitexoft_verify-0.2.1 → bitexoft_verify-0.3.1}/tests/test_equivalence.py +5 -2
  30. bitexoft_verify-0.3.1/tests/test_equivalence_a2.py +421 -0
  31. {bitexoft_verify-0.2.1 → bitexoft_verify-0.3.1}/tests/test_execution.py +41 -0
  32. bitexoft_verify-0.3.1/tests/test_frozen.py +163 -0
  33. bitexoft_verify-0.3.1/tests/test_golden_guard.py +43 -0
  34. {bitexoft_verify-0.2.1 → bitexoft_verify-0.3.1}/tests/test_issues.py +3 -0
  35. bitexoft_verify-0.3.1/tests/test_layers.py +169 -0
  36. {bitexoft_verify-0.2.1 → bitexoft_verify-0.3.1}/tests/test_parity.py +6 -0
  37. {bitexoft_verify-0.2.1 → bitexoft_verify-0.3.1}/tests/test_projects.py +1 -1
  38. bitexoft_verify-0.3.1/tests/test_sample_files.py +61 -0
  39. bitexoft_verify-0.3.1/tests/test_sources.py +166 -0
  40. bitexoft_verify-0.3.1/tools/check_frozen.py +210 -0
  41. {bitexoft_verify-0.2.1 → bitexoft_verify-0.3.1}/tools/make_fixtures.py +2 -0
  42. bitexoft_verify-0.2.1/src/bitexoft_verify/data/issue-codes.json +0 -76
  43. {bitexoft_verify-0.2.1 → bitexoft_verify-0.3.1}/src/bitexoft_verify/__main__.py +0 -0
  44. {bitexoft_verify-0.2.1 → bitexoft_verify-0.3.1}/src/bitexoft_verify/checks/__init__.py +0 -0
  45. {bitexoft_verify-0.2.1 → bitexoft_verify-0.3.1}/src/bitexoft_verify/checks/assertions.py +0 -0
  46. {bitexoft_verify-0.2.1 → bitexoft_verify-0.3.1}/src/bitexoft_verify/checks/isolated.py +0 -0
  47. {bitexoft_verify-0.2.1 → bitexoft_verify-0.3.1}/src/bitexoft_verify/data/a1_impossible_sample.csv +0 -0
  48. {bitexoft_verify-0.2.1 → bitexoft_verify-0.3.1}/src/bitexoft_verify/data/a1_match_sample.csv +0 -0
  49. {bitexoft_verify-0.2.1 → bitexoft_verify-0.3.1}/src/bitexoft_verify/data/a2_isolated_sample.csv +0 -0
  50. {bitexoft_verify-0.2.1 → bitexoft_verify-0.3.1}/src/bitexoft_verify/manifest.py +0 -0
  51. {bitexoft_verify-0.2.1 → bitexoft_verify-0.3.1}/src/bitexoft_verify/report.py +0 -0
  52. {bitexoft_verify-0.2.1 → bitexoft_verify-0.3.1}/src/bitexoft_verify/seeds.py +0 -0
  53. {bitexoft_verify-0.2.1 → bitexoft_verify-0.3.1}/tests/golden/a1_checks.json +0 -0
  54. {bitexoft_verify-0.2.1 → bitexoft_verify-0.3.1}/tests/test_a1.py +0 -0
  55. {bitexoft_verify-0.2.1 → bitexoft_verify-0.3.1}/tests/test_a1_benign.py +0 -0
  56. {bitexoft_verify-0.2.1 → bitexoft_verify-0.3.1}/tests/test_assertions.py +0 -0
  57. {bitexoft_verify-0.2.1 → bitexoft_verify-0.3.1}/tests/test_isolated.py +0 -0
  58. {bitexoft_verify-0.2.1 → bitexoft_verify-0.3.1}/tests/test_report_v4.py +0 -0
  59. {bitexoft_verify-0.2.1 → bitexoft_verify-0.3.1}/tests/test_seeds.py +0 -0
  60. {bitexoft_verify-0.2.1 → bitexoft_verify-0.3.1}/tests/test_version.py +0 -0
@@ -18,6 +18,7 @@ app/src/content/catalog.json
18
18
  app/src/content/briefs.json
19
19
  app/src/content/glossary-detail.json
20
20
  app/src/content/check-feedback.json
21
+ app/public/media/
21
22
  verify-report.json
22
23
  coverage/
23
24
  htmlcov/
@@ -54,3 +55,5 @@ id_ed25519*
54
55
  .DS_Store
55
56
  Thumbs.db
56
57
  Desktop.ini
58
+
59
+ .wrangler/
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: bitexoft-verify
3
- Version: 0.2.1
3
+ Version: 0.3.1
4
4
  Summary: Verifica las entregas de los proyectos de Bitexoft: la misma herramienta en tu máquina y en CI.
5
5
  Author: Bitexoft
6
6
  License: Proprietary
@@ -105,13 +105,20 @@ user. They are synthetic: no third-party data is distributed here.
105
105
 
106
106
  ## Development
107
107
 
108
+ Use **a virtual environment per checkout**. An editable install records the folder it was made from, so a Python that
109
+ has `bitexoft-verify` installed from another checkout (or from PyPI) imports *that* code when you run the tests here, and
110
+ a green run says nothing about the files you are editing. The test suite refuses to run in that case.
111
+
108
112
  ```bash
113
+ python -m venv .venv && . .venv/bin/activate # Windows: .venv\Scripts\activate
109
114
  pip install -e '.[dev,api]'
110
115
  pytest # builds a fake learner repository and verifies it
111
116
  ruff check .
112
117
  python tools/make_fixtures.py # regenerate the sample files
113
118
  ```
114
119
 
120
+ Without a virtual environment, `PYTHONPATH=src pytest` makes the tests import this checkout.
121
+
115
122
  Before changing what a check says when it fails, or the layout of the output, read
116
123
  [`docs/foundations/03-feedback-self-explanation-calibration.md`](../docs/foundations/03-feedback-self-explanation-calibration.md)
117
124
  (the verifier's messages are the feedback a learner reads) and ADR 0002. The check ids and the report
@@ -128,12 +135,18 @@ First release, by hand on pypi.org:
128
135
  repository `sports-lab-v1`, workflow `release-verify.yml`, environment `pypi`.
129
136
  2. In the repository settings, create the environment `pypi`.
130
137
 
131
- Each release:
138
+ Each release (`<version>` is `__version__`; 0.3.0 is the first that knows A2 and 0.3.1 the first that knows A3 and runs the learner's program as UTF-8; the workflow pin `0.3.*` takes the newest):
132
139
 
133
140
  ```bash
134
- git tag verify-v0.2.0 && git push origin verify-v0.2.0
141
+ git tag verify-v<version> && git push origin verify-v<version>
135
142
  ```
136
143
 
137
144
  The workflow runs `pytest` on 3.10 and 3.12, refuses a tag that differs from `__version__`, builds
138
145
  with `python -m build` and publishes with trusted publishing (no tokens). Check it in a clean
139
146
  environment: `pipx run --spec bitexoft-verify bitexoft-verify deliveries`.
147
+
148
+ After the release, in this order (the workflow pins `==0.3.*`, so publishing it before the version exists on PyPI breaks every learner's CI):
149
+
150
+ 1. Check PyPI from a clean environment: `pipx run --spec "bitexoft-verify==<version>" bitexoft-verify deliveries` lists the deliveries the version can verify.
151
+ 2. Publish the reusable workflow and move its `v1` tag: `scripts/publish-verify-workflow.sh` (it asks before moving the tag).
152
+ 3. Run the whole path once as a learner: a repository made from the template, `delivery: A2` in its workflow, CI green on a correct solution.
@@ -82,13 +82,20 @@ user. They are synthetic: no third-party data is distributed here.
82
82
 
83
83
  ## Development
84
84
 
85
+ Use **a virtual environment per checkout**. An editable install records the folder it was made from, so a Python that
86
+ has `bitexoft-verify` installed from another checkout (or from PyPI) imports *that* code when you run the tests here, and
87
+ a green run says nothing about the files you are editing. The test suite refuses to run in that case.
88
+
85
89
  ```bash
90
+ python -m venv .venv && . .venv/bin/activate # Windows: .venv\Scripts\activate
86
91
  pip install -e '.[dev,api]'
87
92
  pytest # builds a fake learner repository and verifies it
88
93
  ruff check .
89
94
  python tools/make_fixtures.py # regenerate the sample files
90
95
  ```
91
96
 
97
+ Without a virtual environment, `PYTHONPATH=src pytest` makes the tests import this checkout.
98
+
92
99
  Before changing what a check says when it fails, or the layout of the output, read
93
100
  [`docs/foundations/03-feedback-self-explanation-calibration.md`](../docs/foundations/03-feedback-self-explanation-calibration.md)
94
101
  (the verifier's messages are the feedback a learner reads) and ADR 0002. The check ids and the report
@@ -105,12 +112,18 @@ First release, by hand on pypi.org:
105
112
  repository `sports-lab-v1`, workflow `release-verify.yml`, environment `pypi`.
106
113
  2. In the repository settings, create the environment `pypi`.
107
114
 
108
- Each release:
115
+ Each release (`<version>` is `__version__`; 0.3.0 is the first that knows A2 and 0.3.1 the first that knows A3 and runs the learner's program as UTF-8; the workflow pin `0.3.*` takes the newest):
109
116
 
110
117
  ```bash
111
- git tag verify-v0.2.0 && git push origin verify-v0.2.0
118
+ git tag verify-v<version> && git push origin verify-v<version>
112
119
  ```
113
120
 
114
121
  The workflow runs `pytest` on 3.10 and 3.12, refuses a tag that differs from `__version__`, builds
115
122
  with `python -m build` and publishes with trusted publishing (no tokens). Check it in a clean
116
123
  environment: `pipx run --spec bitexoft-verify bitexoft-verify deliveries`.
124
+
125
+ After the release, in this order (the workflow pins `==0.3.*`, so publishing it before the version exists on PyPI breaks every learner's CI):
126
+
127
+ 1. Check PyPI from a clean environment: `pipx run --spec "bitexoft-verify==<version>" bitexoft-verify deliveries` lists the deliveries the version can verify.
128
+ 2. Publish the reusable workflow and move its `v1` tag: `scripts/publish-verify-workflow.sh` (it asks before moving the tag).
129
+ 3. Run the whole path once as a learner: a repository made from the template, `delivery: A2` in its workflow, CI green on a correct solution.
@@ -0,0 +1,32 @@
1
+ {
2
+ "_about": "Hashes of what freezes A1 and A2. Checked by verify/tools/check_frozen.py and verify/tests/test_frozen.py. Changing or removing an entry needs `Frozen-by: ADR NNNN` in the commit message.",
3
+ "files": {
4
+ "verify/src/bitexoft_verify/checks/a1.py": "81a27653a5821717e50f620a5de68e4ce6319c6a47b4eb34d7e5d6667da8160a",
5
+ "verify/src/bitexoft_verify/checks/a2.py": "d3921cbc5557d2040e0a213362e8e6c3f293379b734d96e1af6b3ab10cabdcff",
6
+ "verify/src/bitexoft_verify/checks/a2_design.py": "1339b51bc0e85b18236e3454300fcf97c208a370751e2556e513d639da19bb8a",
7
+ "verify/src/bitexoft_verify/data/a1_impossible_sample.csv": "92f9d3628127b7cd9917031498677550eafaa8c32c27cb111c71f8d02a43be4e",
8
+ "verify/src/bitexoft_verify/data/a1_match_sample.csv": "f0d10aa3682f63f675dbe43528174a9d2a5157648f5ce384e7c55f01c7151fbe",
9
+ "verify/src/bitexoft_verify/data/a2_isolated_sample.csv": "3b9886970952d6d966ca6d5ac53ecf46dbaef90116bc9cd677606d6c416fa6cd",
10
+ "verify/tests/golden/a1_checks.json": "792c239236145020da63776b15c0735294e8825f3542d9248102f759e384c8c5",
11
+ "verify/tests/golden/a2_checks.json": "650aa29da28938818e5b8a98d873f57276a34d3f445966014ef2f9ea8370906a",
12
+ "verify/tests/golden_guard.py": "dbefb359963eb9d4114b7bf11a31e707d073cc5f4b4e74e3e521ce605d80df8a",
13
+ "verify/tests/test_equivalence.py": "84ce9eb6b8c708eb9d79e60b45014c5597b98b25c04b3891aa68c55a67ce8608",
14
+ "verify/tests/test_equivalence_a2.py": "6805b4e9045e2cb21f0d0976117db5a63f5faf54645ca43b44bde9c2ceccfc7c"
15
+ },
16
+ "json": {
17
+ "content/projects/chaos-sports-lab/deliveries/A1.json": {
18
+ "keys": [
19
+ "contract",
20
+ "evidence_prompts"
21
+ ],
22
+ "sha256": "fff5e9f884fba6645cee59ee55a0669132476136b2ec7c89fe4d04e2d939f439"
23
+ },
24
+ "content/projects/chaos-sports-lab/deliveries/A2.json": {
25
+ "keys": [
26
+ "contract",
27
+ "evidence_prompts"
28
+ ],
29
+ "sha256": "5ec143849c656e2d42f3f196d8c5860541714cf9720381e6d259201d4b21efb8"
30
+ }
31
+ }
32
+ }
@@ -53,6 +53,9 @@ ignore = ["UP017"]
53
53
  # Los tests construyen el código del repositorio falso con replace() sobre literales:
54
54
  # partir esas líneas los hace ilegibles.
55
55
  "tests/*" = ["E501"]
56
+ # Los checks de A3 llevan scripts del proceso hijo y mensajes en cadenas largas: partirlas los hace ilegibles.
57
+ "src/bitexoft_verify/checks/a3.py" = ["E501"]
58
+ "src/bitexoft_verify/checks/sources.py" = ["E501"]
56
59
 
57
60
  [tool.pytest.ini_options]
58
61
  testpaths = ["tests"]
@@ -1,3 +1,3 @@
1
1
  """bitexoft-verify: the platform's only definition of "correct"."""
2
2
 
3
- __version__ = "0.2.1"
3
+ __version__ = "0.3.1"
@@ -24,6 +24,7 @@ from .common import (
24
24
  check_symbol,
25
25
  check_tests_cover_invariants,
26
26
  check_tests_pass,
27
+ guarded,
27
28
  import_symbol,
28
29
  )
29
30
 
@@ -51,6 +52,7 @@ def _domain_error(ctx: Context):
51
52
  return _domain(ctx, "<layers.domain>.errors:DomainError")
52
53
 
53
54
 
55
+ @guarded("position_invariants", "Position refuses coordinates off the pitch")
54
56
  def check_position_rejects_impossible(ctx: Context) -> Check:
55
57
  title = "Position refuses coordinates off the pitch"
56
58
  try:
@@ -94,6 +96,7 @@ def check_position_rejects_impossible(ctx: Context) -> Check:
94
96
  return Check("position_invariants", title, "pass")
95
97
 
96
98
 
99
+ @guarded("frame_invariants", "Frame refuses impossible instants")
97
100
  def check_frame_rejects_impossible(ctx: Context) -> Check:
98
101
  title = "Frame refuses impossible instants"
99
102
  try:
@@ -125,6 +128,7 @@ def check_frame_rejects_impossible(ctx: Context) -> Check:
125
128
  return Check("frame_invariants", title, "pass")
126
129
 
127
130
 
131
+ @guarded("value_semantics", "Compared by value, hashable and immutable")
128
132
  def check_value_semantics(ctx: Context) -> Check:
129
133
  title = "Compared by value, hashable and immutable"
130
134
  try:
@@ -195,6 +199,7 @@ def _line_frame(ctx: Context, step: float):
195
199
  return Frame(t=0.0, players=players, ball=Position(x=cx, y=cy))
196
200
 
197
201
 
202
+ @guarded("geometry", "The centroid and the spread are right")
198
203
  def check_geometry(ctx: Context) -> Check:
199
204
  title = "The centroid and the spread are right"
200
205
  try:
@@ -207,6 +212,8 @@ def check_geometry(ctx: Context) -> Check:
207
212
  centre = getattr(square, "centroid", None)
208
213
  if centre is None:
209
214
  problems.append("Frame has no centroid")
215
+ elif callable(centre):
216
+ problems.append("Frame.centroid is a method; the contract asks for a property (add @property)")
210
217
  elif abs(centre.x - PITCH_LENGTH_M / 2) > 1e-6 or abs(centre.y - PITCH_WIDTH_M / 2) > 1e-6:
211
218
  problems.append(f"the centroid of a centred square is not the centre ({centre.x}, {centre.y})")
212
219
 
@@ -229,6 +236,7 @@ def check_geometry(ctx: Context) -> Check:
229
236
  return Check("geometry", title, "pass")
230
237
 
231
238
 
239
+ @guarded("classification", "Classification is monotonic and reaches all three states")
232
240
  def check_classification(ctx: Context) -> Check:
233
241
  title = "Classification is monotonic and reaches all three states"
234
242
  try:
@@ -265,6 +273,7 @@ def check_classification(ctx: Context) -> Check:
265
273
  return Check("classification", title, "pass")
266
274
 
267
275
 
276
+ @guarded("thresholds", "BlockCompactness refuses thresholds that make no sense")
268
277
  def check_thresholds_are_validated(ctx: Context) -> Check:
269
278
  title = "BlockCompactness refuses thresholds that make no sense"
270
279
  try:
@@ -283,6 +292,7 @@ def check_thresholds_are_validated(ctx: Context) -> Check:
283
292
  )
284
293
 
285
294
 
295
+ @guarded("cli_analyze", "The program analyses the sample file")
286
296
  def check_cli_analyses_fixture(ctx: Context) -> Check:
287
297
  title = "The program analyses the sample file"
288
298
  try:
@@ -303,6 +313,7 @@ def check_cli_analyses_fixture(ctx: Context) -> Check:
303
313
  return Check("cli_analyze", title, "pass")
304
314
 
305
315
 
316
+ @guarded("cli_bad_input", "With impossible data it fails cleanly, without a traceback")
306
317
  def check_cli_fails_cleanly(ctx: Context) -> Check:
307
318
  title = "With impossible data it fails cleanly, without a traceback"
308
319
  try: