smolpy 1.9.1.dev10__tar.gz → 1.9.1.dev13__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 (147) hide show
  1. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/.github/workflows/docker-image.yml +92 -8
  2. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/.github/workflows/publish.yml +2 -2
  3. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/PKG-INFO +11 -2
  4. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/README.md +10 -1
  5. smolpy-1.9.1.dev13/docker/Dockerfile.ns3 +46 -0
  6. smolpy-1.9.1.dev13/docker/Dockerfile.ns3.dockerignore +3 -0
  7. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/docker/smoke.smol +2 -1
  8. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/docs/adr/0004-execution-backends.md +9 -2
  9. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/docs/dsl-reference.md +1 -1
  10. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/docs/roadmap.md +5 -2
  11. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/src/smolpy/backends.py +4 -1
  12. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/src/smolpy/ns3/__init__.py +8 -1
  13. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/tests/test_ns3.py +13 -0
  14. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/.github/workflows/ci.yml +0 -0
  15. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/.github/workflows/dev-build.yml +0 -0
  16. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/.github/workflows/docs.yml +0 -0
  17. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/.github/workflows/github-release.yml +0 -0
  18. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/.github/workflows/ns3-base.yml +0 -0
  19. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/.github/workflows/release.yml +0 -0
  20. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/.github/workflows/rust-wheels.yml +0 -0
  21. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/.gitignore +0 -0
  22. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/LICENSE +0 -0
  23. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/benchmarks/__init__.py +0 -0
  24. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/benchmarks/__main__.py +0 -0
  25. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/benchmarks/results/2026-11-13-0921-simpy-jaws-zbook-baseline.json +0 -0
  26. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/benchmarks/results/2026-11-13-1527-simpy-jaws-zbook-optimised.json +0 -0
  27. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/benchmarks/results/2026-11-13-2116-simpy-jaws-zbook-research-batch.json +0 -0
  28. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/benchmarks/results/2026-11-13-2119-simpy-jaws-zbook-research-b4.json +0 -0
  29. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/benchmarks/results/2026-11-15-1255-rust-jaws-zbook-stop-criterion.json +0 -0
  30. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/benchmarks/results/2026-11-15-1333-rust-jaws-zbook-research-b4.json +0 -0
  31. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/benchmarks/results/2026-11-15-1346-rust-jaws-zbook-research-batch.json +0 -0
  32. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/benchmarks/runner.py +0 -0
  33. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/benchmarks/scenarios.py +0 -0
  34. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/benchmarks/worker.py +0 -0
  35. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/docker/Dockerfile +0 -0
  36. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/docker/Dockerfile.dockerignore +0 -0
  37. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/docker/ns3-base/Dockerfile +0 -0
  38. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/docker/ns3-base/smoke.cc +0 -0
  39. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/docs/adr/0001-protocol-package-structure.md +0 -0
  40. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/docs/adr/0002-modbus-tcp-implementation.md +0 -0
  41. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/docs/adr/0003-smol-external-dsl.md +0 -0
  42. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/docs/adr/0005-profinet-rt.md +0 -0
  43. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/docs/adr/0006-profiling-and-baseline-benchmark.md +0 -0
  44. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/docs/adr/0007-execution-independent-scenario-model.md +0 -0
  45. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/docs/adr/0008-rust-des-engine-mvp.md +0 -0
  46. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/docs/adr/0009-batch-execution-and-cross-backend-validation.md +0 -0
  47. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/docs/adr/0010-ethernet-frames-on-the-wire.md +0 -0
  48. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/docs/benchmarks.md +0 -0
  49. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/docs/dashboard.md +0 -0
  50. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/docs/examples.md +0 -0
  51. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/docs/index.md +0 -0
  52. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/docs/language-reference.md +0 -0
  53. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/docs/modbus.md +0 -0
  54. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/docs/model-semantics.md +0 -0
  55. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/docs/mqtt.md +0 -0
  56. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/docs/profinet.md +0 -0
  57. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/docs/scenario-model.md +0 -0
  58. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/docs/simulation-engine.md +0 -0
  59. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/examples/README.md +0 -0
  60. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/examples/example.py +0 -0
  61. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/examples/example.smol +0 -0
  62. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/examples/example_10_clients.py +0 -0
  63. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/examples/example_12_clients.py +0 -0
  64. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/examples/example_20_clients.py +0 -0
  65. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/examples/example_file_transfer.py +0 -0
  66. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/examples/example_modbus.py +0 -0
  67. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/examples/example_mqtt.py +0 -0
  68. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/examples/example_profinet.py +0 -0
  69. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/examples/example_profinet.smol +0 -0
  70. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/examples/example_staggered_transfer.py +0 -0
  71. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/examples/example_two_tier.py +0 -0
  72. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/mkdocs.yml +0 -0
  73. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/pyproject.toml +0 -0
  74. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/rust/Cargo.lock +0 -0
  75. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/rust/Cargo.toml +0 -0
  76. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/rust/smol-engine/Cargo.toml +0 -0
  77. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/rust/smol-engine/src/frames.rs +0 -0
  78. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/rust/smol-engine/src/lib.rs +0 -0
  79. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/rust/smol-engine/src/rng.rs +0 -0
  80. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/rust/smol-engine/src/scenario.rs +0 -0
  81. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/rust/smol-engine/src/sim.rs +0 -0
  82. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/rust/smol-engine/src/timebase.rs +0 -0
  83. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/rust/smolpy-engine-rs/Cargo.toml +0 -0
  84. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/rust/smolpy-engine-rs/README.md +0 -0
  85. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/rust/smolpy-engine-rs/pyproject.toml +0 -0
  86. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/rust/smolpy-engine-rs/smoke_test.py +0 -0
  87. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/rust/smolpy-engine-rs/src/lib.rs +0 -0
  88. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/src/smolpy/__init__.py +0 -0
  89. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/src/smolpy/_worker.py +0 -0
  90. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/src/smolpy/batch.py +0 -0
  91. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/src/smolpy/cli.py +0 -0
  92. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/src/smolpy/core/__init__.py +0 -0
  93. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/src/smolpy/core/adapter.py +0 -0
  94. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/src/smolpy/core/batch.py +0 -0
  95. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/src/smolpy/core/link.py +0 -0
  96. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/src/smolpy/core/network.py +0 -0
  97. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/src/smolpy/core/node.py +0 -0
  98. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/src/smolpy/core/observation.py +0 -0
  99. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/src/smolpy/ethernet/__init__.py +0 -0
  100. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/src/smolpy/ethernet/switch.py +0 -0
  101. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/src/smolpy/lang/__init__.py +0 -0
  102. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/src/smolpy/lang/ast.py +0 -0
  103. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/src/smolpy/lang/errors.py +0 -0
  104. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/src/smolpy/lang/grammar.lark +0 -0
  105. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/src/smolpy/lang/interpreter.py +0 -0
  106. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/src/smolpy/lang/transformer.py +0 -0
  107. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/src/smolpy/modbus/__init__.py +0 -0
  108. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/src/smolpy/modbus/slave.py +0 -0
  109. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/src/smolpy/model/__init__.py +0 -0
  110. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/src/smolpy/model/frames.py +0 -0
  111. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/src/smolpy/model/scenario.py +0 -0
  112. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/src/smolpy/model/streams.py +0 -0
  113. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/src/smolpy/model/timebase.py +0 -0
  114. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/src/smolpy/model/validate.py +0 -0
  115. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/src/smolpy/mqtt/__init__.py +0 -0
  116. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/src/smolpy/mqtt/broker.py +0 -0
  117. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/src/smolpy/ns3/cpp/smol-ns3.cc +0 -0
  118. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/src/smolpy/profinet/__init__.py +0 -0
  119. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/src/smolpy/profinet/device.py +0 -0
  120. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/src/smolpy/sim/__init__.py +0 -0
  121. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/src/smolpy/sim/engine.py +0 -0
  122. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/src/smolpy/stats.py +0 -0
  123. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/src/smolpy/viz/__init__.py +0 -0
  124. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/src/smolpy/viz/dashboard.py +0 -0
  125. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/src/smolpy/viz/text_dashboard.py +0 -0
  126. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/tests/__init__.py +0 -0
  127. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/tests/equivalence/__init__.py +0 -0
  128. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/tests/equivalence/harness.py +0 -0
  129. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/tests/equivalence/scenarios.py +0 -0
  130. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/tests/equivalence/test_equivalence.py +0 -0
  131. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/tests/equivalence/test_rust_timebase.py +0 -0
  132. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/tests/test_backends.py +0 -0
  133. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/tests/test_batch.py +0 -0
  134. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/tests/test_benchmarks.py +0 -0
  135. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/tests/test_cli.py +0 -0
  136. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/tests/test_dsl.py +0 -0
  137. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/tests/test_engine_ir.py +0 -0
  138. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/tests/test_lang.py +0 -0
  139. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/tests/test_model.py +0 -0
  140. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/tests/test_profinet.py +0 -0
  141. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/tests/test_semantics.py +0 -0
  142. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/tests/test_simulation.py +0 -0
  143. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/tests/test_stats.py +0 -0
  144. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/tests/test_sweep.py +0 -0
  145. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/tests/test_timebase.py +0 -0
  146. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/tests/test_validate.py +0 -0
  147. {smolpy-1.9.1.dev10 → smolpy-1.9.1.dev13}/uv.lock +0 -0
@@ -1,15 +1,18 @@
1
1
  name: Docker image
2
2
 
3
- # The image without ns-3, ghcr.io/jwszolek/smolpy (ADR-0004, Container
4
- # images): Python, smolpy and smolpy-engine-rs for linux/amd64 and
5
- # linux/arm64, installed from the wheels of one version. Every image is tested
6
- # before anything is pushed: the wheel smoke test (bit-exact with SimPy) and a
7
- # .smol run through the CLI.
3
+ # The images of ghcr.io/jwszolek/smolpy (ADR-0004, Container images), from
4
+ # the wheels of one version of smolpy and smolpy-engine-rs:
5
+ # - <version>, latest: without ns-3, for linux/amd64 and linux/arm64;
6
+ # - <version>-ns3, latest-ns3: on the ns-3 base image, with smol-ns3 built
7
+ # in, for linux/amd64 (the base image's only platform so far).
8
+ # Every image is tested before anything is pushed: a .smol run through the
9
+ # CLI; the wheel smoke test (bit-exact with SimPy) without ns-3, and the ns-3
10
+ # suite with it.
8
11
  #
9
12
  # - Called by publish.yml at a release, once both packages are on PyPI: uses
10
- # the files of the same run and pushes <version> and latest.
11
- # - On a pull request that touches the image: builds the wheels here, for
12
- # linux/amd64 only, tests that image and pushes nothing.
13
+ # the files of the same run and pushes both images.
14
+ # - On a pull request that touches the images: builds the wheels here, for
15
+ # linux/amd64 only, tests both images and pushes nothing.
13
16
 
14
17
  on:
15
18
  pull_request:
@@ -40,6 +43,9 @@ jobs:
40
43
  IMAGE: ghcr.io/${{ github.repository_owner }}/smolpy
41
44
  RELEASE: ${{ inputs.version && 'true' || 'false' }} # no inputs on a pull request
42
45
 
46
+ outputs:
47
+ version: ${{ steps.v.outputs.version }}
48
+
43
49
  steps:
44
50
  - uses: actions/checkout@v4
45
51
  with:
@@ -104,6 +110,14 @@ jobs:
104
110
  echo "version=$VERSION" >> "$GITHUB_OUTPUT"
105
111
  ls dist/
106
112
 
113
+ # the same wheels, for the ns-3 image
114
+ - name: Keep the wheels
115
+ uses: actions/upload-artifact@v4
116
+ with:
117
+ name: image-wheels
118
+ path: dist/*.whl
119
+ retention-days: 1
120
+
107
121
  - name: Set up QEMU, for linux/arm64
108
122
  if: ${{ env.RELEASE == 'true' }}
109
123
  uses: docker/setup-qemu-action@v3
@@ -151,3 +165,73 @@ jobs:
151
165
  --build-arg VERSION="$VERSION" -f docker/Dockerfile \
152
166
  -t "$IMAGE:$VERSION" -t "$IMAGE:latest" .
153
167
  echo "Pushed $IMAGE:$VERSION and $IMAGE:latest" >> "$GITHUB_STEP_SUMMARY"
168
+
169
+ image-ns3:
170
+ name: ${{ inputs.version && format('Image {0}-ns3', inputs.version) || 'Image with ns-3 (test build)' }}
171
+ needs: image
172
+ runs-on: ubuntu-latest
173
+ permissions:
174
+ contents: read
175
+ packages: write # push to ghcr.io
176
+
177
+ env:
178
+ IMAGE: ghcr.io/${{ github.repository_owner }}/smolpy
179
+ RELEASE: ${{ inputs.version && 'true' || 'false' }}
180
+ VERSION: ${{ needs.image.outputs.version }}
181
+
182
+ steps:
183
+ - uses: actions/checkout@v4
184
+ with:
185
+ ref: ${{ inputs.ref }}
186
+
187
+ - name: Download the wheels
188
+ uses: actions/download-artifact@v4
189
+ with:
190
+ name: image-wheels
191
+ path: dist/
192
+
193
+ - uses: docker/setup-buildx-action@v3
194
+
195
+ # smol-ns3 is built into the image; its cache is read-only, so a run
196
+ # below that needed another build would fail
197
+ - name: Build
198
+ run: |
199
+ docker buildx build --platform linux/amd64 --load \
200
+ --build-arg VERSION="$VERSION" -f docker/Dockerfile.ns3 -t smolpy:test-ns3 .
201
+ docker image ls smolpy:test-ns3
202
+
203
+ - name: Test the CLI on ns-3
204
+ run: |
205
+ docker run --rm smolpy:test-ns3 --help
206
+ mkdir -p out && chmod 777 out
207
+ cp docker/smoke.smol out/
208
+ docker run --rm -v "$PWD/out:/work" \
209
+ smolpy:test-ns3 run smoke.smol --backend ns3 -o results.csv
210
+ grep -q "pn_latency:plc" out/results.csv
211
+ grep -q "modbus_latency:plc" out/results.csv
212
+ rm -rf out
213
+
214
+ # the tests of this version, against the smolpy installed in the image
215
+ - name: Run the ns-3 suite in the image
216
+ run: |
217
+ docker run --rm --user 0 -e PYTHONDONTWRITEBYTECODE=1 \
218
+ -v "$PWD/tests:/src/tests:ro" -w /src --entrypoint sh smolpy:test-ns3 -c \
219
+ "pip install --quiet --root-user-action=ignore pytest \
220
+ && python -m pytest -p no:cacheprovider tests/equivalence tests/test_ns3.py -k ns3 -q"
221
+
222
+ - name: Log in to ghcr.io
223
+ if: ${{ env.RELEASE == 'true' }}
224
+ uses: docker/login-action@v3
225
+ with:
226
+ registry: ghcr.io
227
+ username: ${{ github.actor }}
228
+ password: ${{ secrets.GITHUB_TOKEN }}
229
+
230
+ - name: Push
231
+ if: ${{ env.RELEASE == 'true' }}
232
+ run: |
233
+ for tag in "$VERSION-ns3" latest-ns3; do
234
+ docker tag smolpy:test-ns3 "$IMAGE:$tag"
235
+ docker push "$IMAGE:$tag"
236
+ done
237
+ echo "Pushed $IMAGE:$VERSION-ns3 and $IMAGE:latest-ns3" >> "$GITHUB_STEP_SUMMARY"
@@ -4,8 +4,8 @@ name: Publish to PyPI
4
4
  #
5
5
  # - Release (a pushed tag v*, or release.yml passing its tag): publishes
6
6
  # smolpy and the smolpy-engine-rs wheels and sdist to PyPI with the tag's
7
- # version, then the GitHub Release with every file and the Docker image
8
- # ghcr.io/jwszolek/smolpy:<version> (docker-image.yml).
7
+ # version, then the GitHub Release with every file and the Docker images
8
+ # ghcr.io/jwszolek/smolpy:<version> and <version>-ns3 (docker-image.yml).
9
9
  # - Development build (dev-build.yml, dev: true, after a merge to main):
10
10
  # publishes both to PyPI as X.Y.(Z+1).devN, N commits after the latest tag,
11
11
  # a pre-release that pip installs only with --pre, and replaces the GitHub
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: smolpy
3
- Version: 1.9.1.dev10
3
+ Version: 1.9.1.dev13
4
4
  Summary: Network simulation DSL and discrete-event simulator
5
5
  License: MIT
6
6
  License-File: LICENSE
@@ -99,6 +99,15 @@ docker run --rm -v "$PWD:/work" ghcr.io/jwszolek/smolpy run plant.smol --backend
99
99
  - It runs as uid 1000. To own the files it writes as yourself, add `--user "$(id -u):$(id -g)"`.
100
100
  - A version is pinned as `ghcr.io/jwszolek/smolpy:<version>`; `latest` is the latest release.
101
101
 
102
+ **With ns-3,** from the image `<version>-ns3` or `latest-ns3`, for `linux/amd64`, published from 1.10.0 on. It adds the pinned ns-3 build and the ns-3 backend, ready to run:
103
+
104
+ ```bash
105
+ docker run --rm -v "$PWD:/work" ghcr.io/jwszolek/smolpy:latest-ns3 run plant.smol --backend ns3 -o results.csv
106
+ ```
107
+
108
+ - It is about 1.3 GB (300 MB to download), because it holds ns-3's build and a C++ toolchain.
109
+ - It contains ns-3, so it is distributed under GPLv2's terms. SMOLPy itself stays MIT.
110
+
102
111
  From a clone, for development:
103
112
 
104
113
  ```bash
@@ -482,7 +491,7 @@ Every simulation goes through the same path. The Python API and `.smol` files bu
482
491
  |---|---|---|---|---|
483
492
  | `simpy` (default) | Python, SimPy | the whole model, the live and text dashboards | reference | included |
484
493
  | `rust` | Rust, through PyO3 | the whole model, headless: Ethernet, Modbus TCP, MQTT and PROFINET RT, every metric | about **40× faster**: B1 at 10 M frames in 4.9 s, not 200.8 s | `pip install smolpy[rust]` (since v1.8.0) |
485
- | `ns3` | ns-3's IPv4 stack, from C++ | the whole model, headless. Ethernet over UDP and PROFINET RT on layer 2, bit-exact with SimPy. Modbus TCP and MQTT over ns-3's TCP, which adds connection setup and acknowledgements | slower: each run is an ns-3 process | an ns-3 3.49 build in `NS3_HOME`, e.g. the image `ghcr.io/jwszolek/smolpy-ns3-base:3.49` |
494
+ | `ns3` | ns-3's IPv4 stack, from C++ | the whole model, headless. Ethernet over UDP and PROFINET RT on layer 2, bit-exact with SimPy. Modbus TCP and MQTT over ns-3's TCP, which adds connection setup and acknowledgements | slower: each run is an ns-3 process | the image `ghcr.io/jwszolek/smolpy:latest-ns3`, or an ns-3 3.49 build in `NS3_HOME` |
486
495
 
487
496
  ```python
488
497
  result = net.simulate(duration=60_000, backend="rust") # one run
@@ -71,6 +71,15 @@ docker run --rm -v "$PWD:/work" ghcr.io/jwszolek/smolpy run plant.smol --backend
71
71
  - It runs as uid 1000. To own the files it writes as yourself, add `--user "$(id -u):$(id -g)"`.
72
72
  - A version is pinned as `ghcr.io/jwszolek/smolpy:<version>`; `latest` is the latest release.
73
73
 
74
+ **With ns-3,** from the image `<version>-ns3` or `latest-ns3`, for `linux/amd64`, published from 1.10.0 on. It adds the pinned ns-3 build and the ns-3 backend, ready to run:
75
+
76
+ ```bash
77
+ docker run --rm -v "$PWD:/work" ghcr.io/jwszolek/smolpy:latest-ns3 run plant.smol --backend ns3 -o results.csv
78
+ ```
79
+
80
+ - It is about 1.3 GB (300 MB to download), because it holds ns-3's build and a C++ toolchain.
81
+ - It contains ns-3, so it is distributed under GPLv2's terms. SMOLPy itself stays MIT.
82
+
74
83
  From a clone, for development:
75
84
 
76
85
  ```bash
@@ -454,7 +463,7 @@ Every simulation goes through the same path. The Python API and `.smol` files bu
454
463
  |---|---|---|---|---|
455
464
  | `simpy` (default) | Python, SimPy | the whole model, the live and text dashboards | reference | included |
456
465
  | `rust` | Rust, through PyO3 | the whole model, headless: Ethernet, Modbus TCP, MQTT and PROFINET RT, every metric | about **40× faster**: B1 at 10 M frames in 4.9 s, not 200.8 s | `pip install smolpy[rust]` (since v1.8.0) |
457
- | `ns3` | ns-3's IPv4 stack, from C++ | the whole model, headless. Ethernet over UDP and PROFINET RT on layer 2, bit-exact with SimPy. Modbus TCP and MQTT over ns-3's TCP, which adds connection setup and acknowledgements | slower: each run is an ns-3 process | an ns-3 3.49 build in `NS3_HOME`, e.g. the image `ghcr.io/jwszolek/smolpy-ns3-base:3.49` |
466
+ | `ns3` | ns-3's IPv4 stack, from C++ | the whole model, headless. Ethernet over UDP and PROFINET RT on layer 2, bit-exact with SimPy. Modbus TCP and MQTT over ns-3's TCP, which adds connection setup and acknowledgements | slower: each run is an ns-3 process | the image `ghcr.io/jwszolek/smolpy:latest-ns3`, or an ns-3 3.49 build in `NS3_HOME` |
458
467
 
459
468
  ```python
460
469
  result = net.simulate(duration=60_000, backend="rust") # one run
@@ -0,0 +1,46 @@
1
+ # SMOLPy with ns-3: ghcr.io/jwszolek/smolpy:<version>-ns3 (ADR-0004,
2
+ # Container images). Built by .github/workflows/docker-image.yml.
3
+ #
4
+ # The ns-3 base image, with the pinned ns-3 build and its toolchain, plus
5
+ # smolpy and smolpy-engine-rs from the wheels of one version, as in the image
6
+ # without ns-3. smol-ns3, the program that runs scenarios on ns-3, is built
7
+ # here once, so that no run compiles it.
8
+ #
9
+ # docker run --rm -v "$PWD:/work" ghcr.io/jwszolek/smolpy:latest-ns3 run plant.smol --backend ns3
10
+ #
11
+ # The image contains ns-3, licensed under GPLv2, and smol-ns3 linked against
12
+ # it, so the image as a whole is distributed under GPLv2's terms. SMOLPy's own
13
+ # code is MIT. The sources: ns-3 at the commit the base image records, and
14
+ # smol-ns3 in smolpy/ns3/cpp.
15
+
16
+ ARG NS3_BASE=ghcr.io/jwszolek/smolpy-ns3-base:3.49
17
+ FROM ${NS3_BASE}
18
+
19
+ ARG VERSION
20
+
21
+ LABEL org.opencontainers.image.title="SMOLPy with ns-3" \
22
+ org.opencontainers.image.description="Network simulation DSL and discrete-event simulator, with the Rust engine and the ns-3 backend" \
23
+ org.opencontainers.image.source="https://github.com/jwszolek/SMOLPy" \
24
+ org.opencontainers.image.documentation="https://jwszolek.github.io/SMOLPy/" \
25
+ org.opencontainers.image.licenses="GPL-2.0-only AND MIT" \
26
+ org.opencontainers.image.version="${VERSION}"
27
+
28
+ RUN --mount=type=bind,source=dist,target=/dist \
29
+ test -n "${VERSION}" \
30
+ && pip install --no-cache-dir --find-links /dist \
31
+ "smolpy[rust]==${VERSION}" "smolpy-engine-rs==${VERSION}" \
32
+ && python -c "import smolpy_engine_rs; assert smolpy_engine_rs.__version__ == '${VERSION}'"
33
+
34
+ # smol-ns3, built for this ns-3 build into a cache every user reads. It is
35
+ # not writable: a run that would need another build (another CXX) fails,
36
+ # saying to set XDG_CACHE_HOME to a writable directory to build it there.
37
+ ENV XDG_CACHE_HOME=/opt/smolpy/cache
38
+ RUN python -c "from smolpy import ns3; print(ns3.program(ns3.locate()))" \
39
+ && chmod -R a+rX,go-w /opt/smolpy
40
+
41
+ RUN useradd --create-home --uid 1000 smolpy
42
+ USER 1000
43
+ WORKDIR /work
44
+
45
+ ENTRYPOINT ["smolpy"]
46
+ CMD ["--help"]
@@ -0,0 +1,3 @@
1
+ # The image is built from the repository root, but needs only the wheels.
2
+ *
3
+ !dist/
@@ -1,5 +1,6 @@
1
1
  # Run by CI in every image it builds: the CLI, a .smol file and the Rust
2
- # engine, with every protocol, writing its results to the mounted directory.
2
+ # engine, or ns-3 in the -ns3 image, with every protocol, writing its results
3
+ # to the mounted directory.
3
4
 
4
5
  network "image-smoke" {
5
6
 
@@ -183,12 +183,19 @@ ns-3 is the one backend that cannot be installed with `pip`. It is a C++ code ba
183
183
 
184
184
  *As built (2026-11-16):* the image without ns-3 is `docker/Dockerfile`, built by `.github/workflows/docker-image.yml`. Each release, `publish.yml` calls it once both packages are on PyPI. It tests the image of each platform with the wheel smoke test and a `.smol` run through the CLI before it pushes `<version>` and `latest`. A pull request that changes the image builds and tests it for `linux/amd64` and pushes nothing. The image runs as uid 1000, not as root.
185
185
 
186
+ *As built (2026-11-16):* the image with ns-3 is `docker/Dockerfile.ns3`, built by a second job of the same workflow, for `linux/amd64`:
187
+ - **Contents.** The base image `smolpy-ns3-base:3.49`, plus `smolpy` and `smolpy-engine-rs` from the same wheels as the image without ns-3.
188
+ - **`smol-ns3` built in.** It is built once, in the image, into a cache that every user reads (`XDG_CACHE_HOME=/opt/smolpy/cache`). No run compiles it. The cache is read-only, so a run that would need another build, for example with another `CXX`, fails instead of building one. Its message says to set `XDG_CACHE_HOME` to a writable directory, where the build then takes about 8 s.
189
+ - **Tests.** Before the image is pushed, CI runs `docker/smoke.smol`, with every protocol, on ns-3 through the CLI as uid 1000. It also runs the ns-3 suite of the same commit against the SMOLPy installed in the image.
190
+ - **Tags.** `<version>-ns3` and `latest-ns3`, first published with 1.10.0. `latest` remains the image without ns-3.
191
+ - **Size.** 1.26 GB unpacked, 303 MB compressed, for 1.9.1.dev9. ns-3's build and the C++ toolchain stay in the image.
192
+
186
193
  **Registry and images.** The images are published to the GitHub Container Registry, `ghcr.io/jwszolek/smolpy`, public, for `linux/amd64` and `linux/arm64`:
187
194
 
188
195
  | Tag | Contents | Size | From |
189
196
  |---|---|---|---|
190
197
  | `<version>`, `latest` | Python, `smolpy` and `smolpy-engine-rs` from the release's own wheels | ~ 200 MB | the first release that publishes the Rust engine (ADR-0008 step 7) |
191
- | `<version>-ns3`, `latest-ns3` | the above, plus the pinned ns-3 release built with the SMOL C++ module, and `NS3_HOME` set | several GB | Phase 6, with the ns-3 backend |
198
+ | `<version>-ns3`, `latest-ns3` | the above, plus the pinned ns-3 release built with the SMOL C++ module, and `NS3_HOME` set | ~~several GB~~ *as built:* 1.3 GB, 300 MB compressed | Phase 6, with the ns-3 backend |
192
199
 
193
200
  The entry point is the CLI:
194
201
 
@@ -200,7 +207,7 @@ docker run --rm -v "$PWD:/work" -w /work ghcr.io/jwszolek/smolpy:latest-ns3 run
200
207
  - **Headless only.** The live dashboard needs a display, which a container does not have. Headless runs, text mode, `--runs` and `-o` all work.
201
208
  - **Built at release.** `publish.yml` builds and pushes the images at each release, after `smolpy` and `smolpy-engine-rs` are on PyPI, from the same files. The pushed images are listed under the repository's "Packages". The Dockerfiles live in `docker/`.
202
209
  - **ns-3 is built once per pinned release.** It is built in a separate base image, `ghcr.io/jwszolek/smolpy-ns3-base:<ns-3 version>`, which is rebuilt only when the pinned version changes. Each release then adds SMOLPy to it in a few minutes, instead of rebuilding ns-3.
203
- - **CI uses the image.** The ns-3 equivalence suite (ADR-0009) runs inside `<version>-ns3`, or inside the base image for pull requests. It never builds ns-3 itself.
210
+ - **CI uses the image.** The ns-3 equivalence suite (ADR-0009) runs inside `<version>-ns3`, or inside the base image for pull requests. It never builds ns-3 itself. *As built (2026-11-16):* pull requests run it in the base image, against the SMOLPy of the pull request. Each release runs it in the new `<version>-ns3` image before pushing it.
204
211
  - **Reproducible results.** An image tag fixes the SMOLPy, Rust engine and ns-3 versions together. Recording the image digest next to the scenario JSON, and the generated ns-3 scenario (`--keep-generated`), is enough to rerun a published experiment exactly.
205
212
  - **Licences.** ns-3 is licensed under GPLv2, and SMOLPy and its Rust engine under MIT.
206
213
  - The `-ns3` image distributes ns-3 binaries and the SMOL C++ module linked against them, so that image as a whole is distributed under GPLv2's terms.
@@ -165,7 +165,7 @@ result.export("out.csv", format="csv") # explicit format override
165
165
  |---|---|
166
166
  | `"simpy"` | The reference implementation. It is the default, always installed, and runs the whole model, including the live and text dashboards. |
167
167
  | `"rust"` | The native engine of [ADR-0008](adr/0008-rust-des-engine-mvp.md), from the optional package `smolpy-engine-rs` (`pip install smolpy[rust]`). It runs headless. |
168
- | `"ns3"` | ns-3 ([ADR-0004](adr/0004-execution-backends.md)), the whole model. Ethernet (flows with every pattern, IMIX and 802.1Q priorities) runs on ns-3's IPv4/UDP stack, with random traffic drawn from SimPy's streams. PROFINET RT runs on layer 2. Both give SimPy's results bit for bit. Modbus TCP and MQTT run on ns-3's TCP, whose connection setup and acknowledgements make those results differ from SimPy's. It needs `NS3_HOME`, naming a built ns-3 3.49 tree, and a C++ compiler; the image `ghcr.io/jwszolek/smolpy-ns3-base:3.49` has both. It runs headless. |
168
+ | `"ns3"` | ns-3 ([ADR-0004](adr/0004-execution-backends.md)), the whole model. Ethernet (flows with every pattern, IMIX and 802.1Q priorities) runs on ns-3's IPv4/UDP stack, with random traffic drawn from SimPy's streams. PROFINET RT runs on layer 2. Both give SimPy's results bit for bit. Modbus TCP and MQTT run on ns-3's TCP, whose connection setup and acknowledgements make those results differ from SimPy's. It runs in the image `ghcr.io/jwszolek/smolpy:<version>-ns3`. Elsewhere it needs `NS3_HOME`, naming a built ns-3 3.49 tree, and a C++ compiler. It runs headless. |
169
169
 
170
170
  - **What a backend can run is checked before the run.** Every backend declares what it supports: node kinds, traffic kinds, patterns and metrics. A scenario that uses anything else is rejected with a `ScenarioError` naming the element. A dashboard (`live=True` or `text=True`) on a headless backend is a `ValueError`.
171
171
  - **A missing backend is an error.** When a backend is not installed, selecting it raises `BackendUnavailable` with the install command.
@@ -172,7 +172,7 @@ A code-generated ns-3 scenario from the Scenario IR. Gives a realistic TCP/IP st
172
172
 
173
173
  ns-3 cannot be installed with `pip`, so the backend ships as a container image, `ghcr.io/jwszolek/smolpy:<version>-ns3`. It holds the pinned ns-3 release built once, and CI runs the ns-3 equivalence suite in it ([ADR-0004 — Container images](adr/0004-execution-backends.md#container-images)). A lighter image with SMOLPy and the Rust engine, without ns-3, can be published from the first release of `smolpy-engine-rs`.
174
174
 
175
- **Status:** steps 1 and 2 of 3 done. In step 3 the backend runs the whole model, and the `-ns3` image remains.
175
+ **Status:** all 3 steps done. What remains for the exit criteria is quantifying the differences under load.
176
176
  1. **The image without ns-3: done.** `ghcr.io/jwszolek/smolpy:<version>` holds SMOLPy and the Rust engine, for `linux/amd64` and `linux/arm64`. It is built, tested and pushed at each release.
177
177
  2. **The ns-3 base image: done.** `ghcr.io/jwszolek/smolpy-ns3-base:3.49` holds ns-3.49, built once, for `linux/amd64`. `arm64` follows on a native runner.
178
178
  3. **The ns-3 backend.**
@@ -188,7 +188,10 @@ ns-3 cannot be installed with `pip`, so the backend ships as a container image,
188
188
  - **PROFINET: done.** PROFINET RT runs on layer 2, on SMOL's Ethernet device, with the three PROFINET metrics.
189
189
  - Every PROFINET scenario of the suite is bit-exact with SimPy, watchdog expiries included.
190
190
  - A frame that arrives exactly at the watchdog's deadline is too late on both engines.
191
- - **Next:** the `<version>-ns3` image, with CI running the ns-3 suite in it.
191
+ - **The image: done.** `ghcr.io/jwszolek/smolpy:<version>-ns3` and `latest-ns3`, for `linux/amd64`, hold the base image, SMOLPy and the Rust engine, and `smol-ns3` built in.
192
+ - Each release builds it from the release's wheels.
193
+ - Before it is pushed, CI runs a `.smol` file on ns-3 through the CLI, and the ns-3 suite against the SMOLPy installed in it.
194
+ - **Next:** quantifying the differences under load, and `docs/backends.md`.
192
195
 
193
196
  **Exit criteria:**
194
197
 
@@ -215,7 +215,10 @@ class Ns3Backend:
215
215
  def run(self, scenario: Scenario) -> SimulationResult:
216
216
  from smolpy import ns3
217
217
 
218
- return ns3.run(scenario)
218
+ try:
219
+ return ns3.run(scenario)
220
+ except ns3.Ns3Unavailable as exc: # e.g. smol-ns3 cannot be built
221
+ raise BackendUnavailable(f"the ns3 backend is not available: {exc}") from exc
219
222
 
220
223
 
221
224
  REGISTRY: dict[str, Backend] = {b.name: b for b in (SimPyBackend(), RustBackend(), Ns3Backend())}
@@ -112,7 +112,14 @@ def program(ns3: Installation) -> Path:
112
112
  target = _cache_dir() / key.hexdigest()[:16] / PROGRAM
113
113
  if target.is_file():
114
114
  return target
115
- target.parent.mkdir(parents=True, exist_ok=True)
115
+ try:
116
+ target.parent.mkdir(parents=True, exist_ok=True)
117
+ except OSError as exc: # e.g. the read-only cache of the -ns3 image
118
+ raise Ns3Unavailable(
119
+ f"{PROGRAM} for this ns-3 build and compiler ({ns3.compiler}) is not built, and"
120
+ f" cannot be built in {target.parent.parent}: {exc.strerror}. Set XDG_CACHE_HOME"
121
+ " to a writable directory to build it there."
122
+ ) from exc
116
123
  with tempfile.TemporaryDirectory(dir=target.parent) as tmp:
117
124
  src = Path(tmp) / "smol-ns3.cc"
118
125
  src.write_bytes(_source())
@@ -48,6 +48,19 @@ def test_a_build_is_found(monkeypatch, tmp_path) -> None:
48
48
  assert found.compiler == "sh"
49
49
 
50
50
 
51
+ def test_a_cache_it_cannot_write_is_explained(monkeypatch, tmp_path) -> None:
52
+ """In the -ns3 image the cache is read-only, with smol-ns3 built in: a
53
+ run that would need another build says so, and what to do. Here the
54
+ cache is a file, which no user can create directories in, root
55
+ included (CI runs as root)."""
56
+ cache = tmp_path / "cache"
57
+ cache.write_text("")
58
+ monkeypatch.setenv("XDG_CACHE_HOME", str(cache))
59
+ found = ns3.Installation(tmp_path, tmp_path, tmp_path, ("ns3.49-core",), "c++")
60
+ with pytest.raises(ns3.Ns3Unavailable, match="not built, and cannot be built in .*XDG"):
61
+ ns3.program(found)
62
+
63
+
51
64
  def _network() -> Network:
52
65
  net = Network("small")
53
66
  sw = net.switch("sw", ports=3, mac_table="topology")
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes