smolpy 1.8.1__tar.gz → 1.8.2.dev6__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.
- smolpy-1.8.2.dev6/.github/workflows/dev-build.yml +30 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/.github/workflows/github-release.yml +4 -1
- smolpy-1.8.2.dev6/.github/workflows/publish.yml +247 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/.github/workflows/release.yml +2 -1
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/PKG-INFO +24 -3
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/README.md +23 -2
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/docs/adr/0008-rust-des-engine-mvp.md +5 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/docs/dsl-reference.md +2 -2
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/docs/roadmap.md +6 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/pyproject.toml +5 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/rust/smol-engine/src/frames.rs +20 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/rust/smol-engine/src/scenario.rs +69 -16
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/rust/smol-engine/src/sim.rs +186 -16
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/rust/smolpy-engine-rs/README.md +2 -1
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/tests/equivalence/scenarios.py +34 -0
- smolpy-1.8.1/.github/workflows/publish.yml +0 -155
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/.github/workflows/ci.yml +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/.github/workflows/docs.yml +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/.github/workflows/rust-wheels.yml +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/.gitignore +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/LICENSE +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/benchmarks/__init__.py +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/benchmarks/__main__.py +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/benchmarks/results/2026-11-13-0921-simpy-jaws-zbook-baseline.json +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/benchmarks/results/2026-11-13-1527-simpy-jaws-zbook-optimised.json +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/benchmarks/results/2026-11-13-2116-simpy-jaws-zbook-research-batch.json +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/benchmarks/results/2026-11-13-2119-simpy-jaws-zbook-research-b4.json +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/benchmarks/results/2026-11-15-1255-rust-jaws-zbook-stop-criterion.json +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/benchmarks/results/2026-11-15-1333-rust-jaws-zbook-research-b4.json +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/benchmarks/results/2026-11-15-1346-rust-jaws-zbook-research-batch.json +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/benchmarks/runner.py +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/benchmarks/scenarios.py +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/benchmarks/worker.py +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/docs/adr/0001-protocol-package-structure.md +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/docs/adr/0002-modbus-tcp-implementation.md +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/docs/adr/0003-smol-external-dsl.md +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/docs/adr/0004-execution-backends.md +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/docs/adr/0005-profinet-rt.md +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/docs/adr/0006-profiling-and-baseline-benchmark.md +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/docs/adr/0007-execution-independent-scenario-model.md +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/docs/adr/0009-batch-execution-and-cross-backend-validation.md +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/docs/adr/0010-ethernet-frames-on-the-wire.md +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/docs/benchmarks.md +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/docs/dashboard.md +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/docs/examples.md +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/docs/index.md +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/docs/language-reference.md +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/docs/modbus.md +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/docs/model-semantics.md +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/docs/mqtt.md +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/docs/profinet.md +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/docs/scenario-model.md +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/docs/simulation-engine.md +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/examples/README.md +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/examples/example.py +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/examples/example.smol +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/examples/example_10_clients.py +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/examples/example_12_clients.py +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/examples/example_20_clients.py +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/examples/example_file_transfer.py +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/examples/example_modbus.py +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/examples/example_mqtt.py +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/examples/example_profinet.py +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/examples/example_profinet.smol +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/examples/example_staggered_transfer.py +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/examples/example_two_tier.py +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/mkdocs.yml +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/rust/Cargo.lock +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/rust/Cargo.toml +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/rust/smol-engine/Cargo.toml +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/rust/smol-engine/src/lib.rs +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/rust/smol-engine/src/rng.rs +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/rust/smol-engine/src/timebase.rs +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/rust/smolpy-engine-rs/Cargo.toml +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/rust/smolpy-engine-rs/pyproject.toml +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/rust/smolpy-engine-rs/smoke_test.py +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/rust/smolpy-engine-rs/src/lib.rs +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/src/smolpy/__init__.py +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/src/smolpy/_worker.py +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/src/smolpy/backends.py +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/src/smolpy/batch.py +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/src/smolpy/cli.py +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/src/smolpy/core/__init__.py +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/src/smolpy/core/adapter.py +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/src/smolpy/core/batch.py +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/src/smolpy/core/link.py +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/src/smolpy/core/network.py +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/src/smolpy/core/node.py +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/src/smolpy/core/observation.py +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/src/smolpy/ethernet/__init__.py +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/src/smolpy/ethernet/switch.py +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/src/smolpy/lang/__init__.py +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/src/smolpy/lang/ast.py +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/src/smolpy/lang/errors.py +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/src/smolpy/lang/grammar.lark +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/src/smolpy/lang/interpreter.py +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/src/smolpy/lang/transformer.py +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/src/smolpy/modbus/__init__.py +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/src/smolpy/modbus/slave.py +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/src/smolpy/model/__init__.py +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/src/smolpy/model/frames.py +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/src/smolpy/model/scenario.py +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/src/smolpy/model/streams.py +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/src/smolpy/model/timebase.py +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/src/smolpy/model/validate.py +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/src/smolpy/mqtt/__init__.py +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/src/smolpy/mqtt/broker.py +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/src/smolpy/profinet/__init__.py +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/src/smolpy/profinet/device.py +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/src/smolpy/sim/__init__.py +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/src/smolpy/sim/engine.py +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/src/smolpy/stats.py +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/src/smolpy/viz/__init__.py +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/src/smolpy/viz/dashboard.py +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/src/smolpy/viz/text_dashboard.py +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/tests/__init__.py +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/tests/equivalence/__init__.py +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/tests/equivalence/harness.py +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/tests/equivalence/test_equivalence.py +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/tests/equivalence/test_rust_timebase.py +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/tests/test_backends.py +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/tests/test_batch.py +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/tests/test_benchmarks.py +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/tests/test_cli.py +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/tests/test_dsl.py +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/tests/test_engine_ir.py +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/tests/test_lang.py +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/tests/test_model.py +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/tests/test_profinet.py +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/tests/test_semantics.py +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/tests/test_simulation.py +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/tests/test_stats.py +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/tests/test_sweep.py +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/tests/test_timebase.py +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/tests/test_validate.py +0 -0
- {smolpy-1.8.1 → smolpy-1.8.2.dev6}/uv.lock +0 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
name: Development build
|
|
2
|
+
|
|
3
|
+
# After every merge to main that changes the package, publish a development
|
|
4
|
+
# build: smolpy and smolpy-engine-rs X.Y.(Z+1).devN on PyPI (pre-releases,
|
|
5
|
+
# installed only with pip --pre) and the GitHub pre-release "Development
|
|
6
|
+
# build". Releases proper stay manual (release.yml).
|
|
7
|
+
|
|
8
|
+
on:
|
|
9
|
+
push:
|
|
10
|
+
branches:
|
|
11
|
+
- main
|
|
12
|
+
paths:
|
|
13
|
+
- "src/**"
|
|
14
|
+
- "rust/**"
|
|
15
|
+
- "pyproject.toml"
|
|
16
|
+
|
|
17
|
+
# one at a time; a newer merge waiting replaces an older one that waits
|
|
18
|
+
concurrency:
|
|
19
|
+
group: dev-build
|
|
20
|
+
cancel-in-progress: false
|
|
21
|
+
|
|
22
|
+
jobs:
|
|
23
|
+
publish:
|
|
24
|
+
name: Publish
|
|
25
|
+
uses: ./.github/workflows/publish.yml
|
|
26
|
+
with:
|
|
27
|
+
dev: true
|
|
28
|
+
permissions:
|
|
29
|
+
id-token: write # PyPI trusted publishing
|
|
30
|
+
contents: write # the GitHub pre-release
|
|
@@ -63,5 +63,8 @@ jobs:
|
|
|
63
63
|
if gh release view "$TAG" > /dev/null 2>&1; then
|
|
64
64
|
gh release upload "$TAG" dist/* --clobber
|
|
65
65
|
else
|
|
66
|
-
|
|
66
|
+
# notes since the previous release tag, never since the moving "dev" tag
|
|
67
|
+
PREVIOUS=$(git describe --tags --abbrev=0 --match 'v[0-9]*' "${TAG}^" 2>/dev/null || true)
|
|
68
|
+
gh release create "$TAG" dist/* --title "$TAG" --generate-notes --verify-tag \
|
|
69
|
+
${PREVIOUS:+--notes-start-tag "$PREVIOUS"} --latest
|
|
67
70
|
fi
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
# Three modes:
|
|
4
|
+
#
|
|
5
|
+
# - Release (a pushed tag v*, or release.yml passing its tag): publishes
|
|
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.
|
|
8
|
+
# - Development build (dev-build.yml, dev: true, after a merge to main):
|
|
9
|
+
# publishes both to PyPI as X.Y.(Z+1).devN, N commits after the latest tag,
|
|
10
|
+
# a pre-release that pip installs only with --pre, and replaces the GitHub
|
|
11
|
+
# pre-release "Development build" (tag "dev").
|
|
12
|
+
# - Test (run by hand, target: testpypi): publishes only the engine to
|
|
13
|
+
# TestPyPI, as a dev version numbered by the run.
|
|
14
|
+
#
|
|
15
|
+
# smolpy does not wait for the engine: if publishing the engine fails, smolpy
|
|
16
|
+
# is still published, and the GitHub release lacks only the engine's files.
|
|
17
|
+
|
|
18
|
+
on:
|
|
19
|
+
push:
|
|
20
|
+
tags:
|
|
21
|
+
- "v*"
|
|
22
|
+
workflow_call:
|
|
23
|
+
inputs:
|
|
24
|
+
tag:
|
|
25
|
+
description: The tag being released (release.yml passes it; a tag push has it as its ref)
|
|
26
|
+
required: false
|
|
27
|
+
type: string
|
|
28
|
+
dev:
|
|
29
|
+
description: A development build of the calling commit (dev-build.yml)
|
|
30
|
+
required: false
|
|
31
|
+
type: boolean
|
|
32
|
+
default: false
|
|
33
|
+
workflow_dispatch:
|
|
34
|
+
inputs:
|
|
35
|
+
target:
|
|
36
|
+
description: Test publication of the smolpy-engine-rs wheels (releases go through Release)
|
|
37
|
+
required: true
|
|
38
|
+
type: choice
|
|
39
|
+
options:
|
|
40
|
+
- testpypi
|
|
41
|
+
default: testpypi
|
|
42
|
+
|
|
43
|
+
jobs:
|
|
44
|
+
version:
|
|
45
|
+
name: Version
|
|
46
|
+
runs-on: ubuntu-latest
|
|
47
|
+
outputs:
|
|
48
|
+
mode: ${{ steps.v.outputs.mode }} # release, dev or test
|
|
49
|
+
release: ${{ steps.v.outputs.release }} # "true" for release and dev: smolpy goes to PyPI
|
|
50
|
+
tag: ${{ steps.v.outputs.tag }}
|
|
51
|
+
version: ${{ steps.v.outputs.version }}
|
|
52
|
+
|
|
53
|
+
steps:
|
|
54
|
+
- uses: actions/checkout@v4
|
|
55
|
+
with:
|
|
56
|
+
fetch-depth: 0 # to find the latest tag
|
|
57
|
+
|
|
58
|
+
# In a called workflow github.event_name is the caller's, so the test
|
|
59
|
+
# mode is recognised by its input, not by the event.
|
|
60
|
+
- name: Work out the version
|
|
61
|
+
id: v
|
|
62
|
+
env:
|
|
63
|
+
TEST: ${{ inputs.target == 'testpypi' }}
|
|
64
|
+
DEV: ${{ inputs.dev }}
|
|
65
|
+
TAG: ${{ inputs.tag || github.ref_name }}
|
|
66
|
+
RUN: ${{ github.run_number }}
|
|
67
|
+
run: |
|
|
68
|
+
# only release tags: the moving "dev" tag does not count
|
|
69
|
+
LATEST=$(git describe --tags --abbrev=0 --match 'v[0-9]*' 2>/dev/null || echo v0.0.0)
|
|
70
|
+
IFS=. read -r MAJOR MINOR PATCH <<< "${LATEST#v}"
|
|
71
|
+
NEXT="${MAJOR}.${MINOR}.$((PATCH + 1))"
|
|
72
|
+
if [ "$TEST" = "true" ]; then
|
|
73
|
+
MODE=test
|
|
74
|
+
VERSION="${NEXT}.dev${RUN}"
|
|
75
|
+
echo "release=false" >> "$GITHUB_OUTPUT"
|
|
76
|
+
elif [ "$DEV" = "true" ]; then
|
|
77
|
+
# as hatch-vcs numbers smolpy: N commits after the latest tag
|
|
78
|
+
N=$(git rev-list --count "${LATEST}..HEAD")
|
|
79
|
+
if [ "$N" = "0" ]; then
|
|
80
|
+
echo "::error::HEAD is release ${LATEST} itself: there is no development build to make"
|
|
81
|
+
exit 1
|
|
82
|
+
fi
|
|
83
|
+
MODE=dev
|
|
84
|
+
VERSION="${NEXT}.dev${N}"
|
|
85
|
+
echo "release=true" >> "$GITHUB_OUTPUT"
|
|
86
|
+
else
|
|
87
|
+
MODE=release
|
|
88
|
+
VERSION="${TAG#v}"
|
|
89
|
+
echo "release=true" >> "$GITHUB_OUTPUT"
|
|
90
|
+
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
|
|
91
|
+
fi
|
|
92
|
+
echo "mode=$MODE" >> "$GITHUB_OUTPUT"
|
|
93
|
+
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
|
|
94
|
+
echo "Mode: $MODE, version: $VERSION (latest release ${LATEST})"
|
|
95
|
+
|
|
96
|
+
build:
|
|
97
|
+
name: Build smolpy
|
|
98
|
+
needs: version
|
|
99
|
+
if: ${{ needs.version.outputs.release == 'true' }}
|
|
100
|
+
runs-on: ubuntu-latest
|
|
101
|
+
|
|
102
|
+
steps:
|
|
103
|
+
- uses: actions/checkout@v4
|
|
104
|
+
with:
|
|
105
|
+
ref: ${{ needs.version.outputs.tag }}
|
|
106
|
+
fetch-depth: 0 # needed for hatch-vcs to read git tags
|
|
107
|
+
|
|
108
|
+
- name: Install uv
|
|
109
|
+
uses: astral-sh/setup-uv@v4
|
|
110
|
+
with:
|
|
111
|
+
version: "latest"
|
|
112
|
+
|
|
113
|
+
- name: Build package
|
|
114
|
+
run: uv build
|
|
115
|
+
|
|
116
|
+
# hatch-vcs numbers smolpy from git, the engine is numbered above: they must agree
|
|
117
|
+
- name: Check the version
|
|
118
|
+
env:
|
|
119
|
+
VERSION: ${{ needs.version.outputs.version }}
|
|
120
|
+
run: |
|
|
121
|
+
ls dist/
|
|
122
|
+
test -f "dist/smolpy-${VERSION}.tar.gz" || {
|
|
123
|
+
echo "::error::smolpy was built as $(ls dist/*.tar.gz), expected version ${VERSION}"
|
|
124
|
+
exit 1
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
- name: Upload dist
|
|
128
|
+
uses: actions/upload-artifact@v4
|
|
129
|
+
with:
|
|
130
|
+
name: dist
|
|
131
|
+
path: dist/
|
|
132
|
+
|
|
133
|
+
publish:
|
|
134
|
+
name: Publish smolpy to PyPI
|
|
135
|
+
needs: build
|
|
136
|
+
runs-on: ubuntu-latest
|
|
137
|
+
environment: pypi
|
|
138
|
+
permissions:
|
|
139
|
+
id-token: write # required for OIDC trusted publishing
|
|
140
|
+
|
|
141
|
+
steps:
|
|
142
|
+
- name: Download dist
|
|
143
|
+
uses: actions/download-artifact@v4
|
|
144
|
+
with:
|
|
145
|
+
name: dist
|
|
146
|
+
path: dist/
|
|
147
|
+
|
|
148
|
+
- name: Publish to PyPI
|
|
149
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
150
|
+
with:
|
|
151
|
+
attestations: false
|
|
152
|
+
|
|
153
|
+
engine-wheels:
|
|
154
|
+
name: Build smolpy-engine-rs
|
|
155
|
+
needs: version
|
|
156
|
+
uses: ./.github/workflows/rust-wheels.yml
|
|
157
|
+
with:
|
|
158
|
+
version: ${{ needs.version.outputs.version }}
|
|
159
|
+
ref: ${{ needs.version.outputs.tag }}
|
|
160
|
+
|
|
161
|
+
publish-engine:
|
|
162
|
+
name: Publish smolpy-engine-rs to ${{ needs.version.outputs.release == 'true' && 'PyPI' || 'TestPyPI' }}
|
|
163
|
+
needs: [version, engine-wheels]
|
|
164
|
+
runs-on: ubuntu-latest
|
|
165
|
+
environment: ${{ needs.version.outputs.release == 'true' && 'pypi' || 'testpypi' }}
|
|
166
|
+
permissions:
|
|
167
|
+
id-token: write # required for OIDC trusted publishing
|
|
168
|
+
|
|
169
|
+
steps:
|
|
170
|
+
- name: Download the wheels and sdist
|
|
171
|
+
uses: actions/download-artifact@v4
|
|
172
|
+
with:
|
|
173
|
+
pattern: engine-*
|
|
174
|
+
merge-multiple: true
|
|
175
|
+
path: dist/
|
|
176
|
+
|
|
177
|
+
- name: Publish
|
|
178
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
179
|
+
with:
|
|
180
|
+
repository-url: ${{ needs.version.outputs.release == 'true' && 'https://upload.pypi.org/legacy/' || 'https://test.pypi.org/legacy/' }}
|
|
181
|
+
attestations: false
|
|
182
|
+
|
|
183
|
+
github-release:
|
|
184
|
+
name: GitHub Release
|
|
185
|
+
needs: [version, publish, publish-engine]
|
|
186
|
+
# only once smolpy is on PyPI; with the engine's files if it is there too
|
|
187
|
+
if: ${{ always() && needs.version.outputs.mode == 'release' && needs.publish.result == 'success' }}
|
|
188
|
+
permissions:
|
|
189
|
+
contents: write
|
|
190
|
+
uses: ./.github/workflows/github-release.yml
|
|
191
|
+
with:
|
|
192
|
+
tag: ${{ needs.version.outputs.tag }}
|
|
193
|
+
engine: ${{ needs.publish-engine.result == 'success' }}
|
|
194
|
+
|
|
195
|
+
dev-release:
|
|
196
|
+
name: GitHub pre-release "Development build"
|
|
197
|
+
needs: [version, publish, publish-engine]
|
|
198
|
+
if: ${{ always() && needs.version.outputs.mode == 'dev' && needs.publish.result == 'success' }}
|
|
199
|
+
runs-on: ubuntu-latest
|
|
200
|
+
permissions:
|
|
201
|
+
contents: write
|
|
202
|
+
|
|
203
|
+
steps:
|
|
204
|
+
- name: Download smolpy
|
|
205
|
+
uses: actions/download-artifact@v4
|
|
206
|
+
with:
|
|
207
|
+
name: dist
|
|
208
|
+
path: dist/
|
|
209
|
+
|
|
210
|
+
- name: Download smolpy-engine-rs
|
|
211
|
+
if: ${{ needs.publish-engine.result == 'success' }}
|
|
212
|
+
uses: actions/download-artifact@v4
|
|
213
|
+
with:
|
|
214
|
+
pattern: engine-*
|
|
215
|
+
merge-multiple: true
|
|
216
|
+
path: dist/
|
|
217
|
+
|
|
218
|
+
# One pre-release, replaced by every development build, so the list of
|
|
219
|
+
# releases keeps only real releases and the latest development build.
|
|
220
|
+
- name: Replace the pre-release
|
|
221
|
+
env:
|
|
222
|
+
GH_TOKEN: ${{ github.token }}
|
|
223
|
+
GH_REPO: ${{ github.repository }}
|
|
224
|
+
VERSION: ${{ needs.version.outputs.version }}
|
|
225
|
+
ENGINE: ${{ needs.publish-engine.result == 'success' }}
|
|
226
|
+
SHA: ${{ github.sha }}
|
|
227
|
+
run: |
|
|
228
|
+
SHORT=${SHA:0:7}
|
|
229
|
+
ENGINE_LINE="smolpy-engine-rs ${VERSION}"
|
|
230
|
+
[ "$ENGINE" = "true" ] || ENGINE_LINE="smolpy-engine-rs: not published in this build"
|
|
231
|
+
cat > notes.md <<NOTES
|
|
232
|
+
The latest development build of \`main\`, from commit [\`${SHORT}\`](https://github.com/${GH_REPO}/commit/${SHA}). It is replaced by every merge that changes the package.
|
|
233
|
+
|
|
234
|
+
- smolpy ${VERSION}
|
|
235
|
+
- ${ENGINE_LINE}
|
|
236
|
+
|
|
237
|
+
Development builds are pre-releases on PyPI: pip installs them only when asked.
|
|
238
|
+
|
|
239
|
+
\`\`\`bash
|
|
240
|
+
pip install --pre "smolpy[rust]==${VERSION}"
|
|
241
|
+
\`\`\`
|
|
242
|
+
|
|
243
|
+
For a stable version, use the latest release instead.
|
|
244
|
+
NOTES
|
|
245
|
+
gh release delete dev --cleanup-tag --yes || true
|
|
246
|
+
gh release create dev dist/* --prerelease --target "$SHA" \
|
|
247
|
+
--title "Development build ${VERSION}" --notes-file notes.md
|
|
@@ -32,7 +32,8 @@ jobs:
|
|
|
32
32
|
- name: Compute next version
|
|
33
33
|
id: version
|
|
34
34
|
run: |
|
|
35
|
-
|
|
35
|
+
# only release tags: the moving "dev" tag of development builds does not count
|
|
36
|
+
LATEST=$(git describe --tags --abbrev=0 --match 'v[0-9]*' 2>/dev/null || echo "v0.0.0")
|
|
36
37
|
echo "Latest tag: $LATEST"
|
|
37
38
|
VERSION=${LATEST#v}
|
|
38
39
|
MAJOR=$(echo "$VERSION" | cut -d. -f1)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: smolpy
|
|
3
|
-
Version: 1.8.
|
|
3
|
+
Version: 1.8.2.dev6
|
|
4
4
|
Summary: Network simulation DSL and discrete-event simulator
|
|
5
5
|
License: MIT
|
|
6
6
|
License-File: LICENSE
|
|
@@ -30,6 +30,7 @@ Description-Content-Type: text/markdown
|
|
|
30
30
|
|
|
31
31
|
[](https://github.com/jwszolek/SMOLPy/actions/workflows/ci.yml)
|
|
32
32
|
[](https://pypi.org/project/smolpy/)
|
|
33
|
+
[](https://github.com/jwszolek/SMOLPy/releases/tag/dev)
|
|
33
34
|
[](https://pypi.org/project/smolpy/)
|
|
34
35
|
[](LICENSE)
|
|
35
36
|
[](https://jwszolek.github.io/SMOLPy/)
|
|
@@ -47,7 +48,7 @@ SMOLPy lets you describe a network topology in pure Python, define traffic flows
|
|
|
47
48
|
> result = net.simulate(duration=60_000, backend="rust")
|
|
48
49
|
> ```
|
|
49
50
|
>
|
|
50
|
-
> The Rust engine covers Ethernet for now: adapters, switches, links and
|
|
51
|
+
> The Rust engine covers Ethernet and Modbus TCP for now: adapters, switches, links, flows and Modbus polling. MQTT and PROFINET follow. See [Simulation engine](#simulation-engine) and [ADR-0008](https://jwszolek.github.io/SMOLPy/adr/0008-rust-des-engine-mvp/).
|
|
51
52
|
|
|
52
53
|
📖 **Full documentation:** [jwszolek.github.io/SMOLPy](https://jwszolek.github.io/SMOLPy/)
|
|
53
54
|
|
|
@@ -70,6 +71,26 @@ Infrastructure: MAC-learning **switches** with 802.1Q strict-priority egress que
|
|
|
70
71
|
|
|
71
72
|
## Install
|
|
72
73
|
|
|
74
|
+
```bash
|
|
75
|
+
pip install smolpy # SimPy engine, dashboards, CLI
|
|
76
|
+
pip install "smolpy[rust]" # plus the native Rust engine, about 40x faster
|
|
77
|
+
pip install --pre "smolpy[rust]" # the latest development build of main
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
**Release channels.** The versions below are read live from PyPI and GitHub, so this table is always current:
|
|
81
|
+
|
|
82
|
+
| Channel | smolpy | smolpy-engine-rs | Install |
|
|
83
|
+
|---|---|---|---|
|
|
84
|
+
| **Stable**, released by hand | [](https://pypi.org/project/smolpy/) | [](https://pypi.org/project/smolpy-engine-rs/) | `pip install "smolpy[rust]"` |
|
|
85
|
+
| **Development**, every merge to `main` | [](https://github.com/jwszolek/SMOLPy/releases/tag/dev) | same version | `pip install --pre "smolpy[rust]"` |
|
|
86
|
+
|
|
87
|
+
- **What a development build is.** Every merge to `main` that changes the package publishes one, as `X.Y.(Z+1).devN`, N commits after the latest release.
|
|
88
|
+
- **How to get it.** It is a pre-release on PyPI, so `pip` installs it only with `--pre`.
|
|
89
|
+
- **Where it is on GitHub.** The [Development build](https://github.com/jwszolek/SMOLPy/releases/tag/dev) pre-release points to its commit.
|
|
90
|
+
- **Releases proper** are made by hand.
|
|
91
|
+
|
|
92
|
+
From a clone, for development:
|
|
93
|
+
|
|
73
94
|
```bash
|
|
74
95
|
uv sync # installs all runtime + dev dependencies
|
|
75
96
|
```
|
|
@@ -450,7 +471,7 @@ Every simulation goes through the same path. The Python API and `.smol` files bu
|
|
|
450
471
|
| Backend | Language | What it runs | Speed | Install |
|
|
451
472
|
|---|---|---|---|---|
|
|
452
473
|
| `simpy` (default) | Python, SimPy | the whole model, the live and text dashboards | reference | included |
|
|
453
|
-
| `rust` | Rust, through PyO3 | Ethernet: adapters, switches, links, flows (constant, Poisson, bursty, batch, IMIX)
|
|
474
|
+
| `rust` | Rust, through PyO3 | Ethernet: adapters, switches, links, flows (constant, Poisson, bursty, batch, IMIX); Modbus TCP polling; seven metrics | about **40× faster**: B1 at 10 M frames in 4.9 s, not 200.8 s | `pip install smolpy[rust]` (since v1.8.0) |
|
|
454
475
|
|
|
455
476
|
```python
|
|
456
477
|
result = net.simulate(duration=60_000, backend="rust") # one run
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://github.com/jwszolek/SMOLPy/actions/workflows/ci.yml)
|
|
4
4
|
[](https://pypi.org/project/smolpy/)
|
|
5
|
+
[](https://github.com/jwszolek/SMOLPy/releases/tag/dev)
|
|
5
6
|
[](https://pypi.org/project/smolpy/)
|
|
6
7
|
[](LICENSE)
|
|
7
8
|
[](https://jwszolek.github.io/SMOLPy/)
|
|
@@ -19,7 +20,7 @@ SMOLPy lets you describe a network topology in pure Python, define traffic flows
|
|
|
19
20
|
> result = net.simulate(duration=60_000, backend="rust")
|
|
20
21
|
> ```
|
|
21
22
|
>
|
|
22
|
-
> The Rust engine covers Ethernet for now: adapters, switches, links and
|
|
23
|
+
> The Rust engine covers Ethernet and Modbus TCP for now: adapters, switches, links, flows and Modbus polling. MQTT and PROFINET follow. See [Simulation engine](#simulation-engine) and [ADR-0008](https://jwszolek.github.io/SMOLPy/adr/0008-rust-des-engine-mvp/).
|
|
23
24
|
|
|
24
25
|
📖 **Full documentation:** [jwszolek.github.io/SMOLPy](https://jwszolek.github.io/SMOLPy/)
|
|
25
26
|
|
|
@@ -42,6 +43,26 @@ Infrastructure: MAC-learning **switches** with 802.1Q strict-priority egress que
|
|
|
42
43
|
|
|
43
44
|
## Install
|
|
44
45
|
|
|
46
|
+
```bash
|
|
47
|
+
pip install smolpy # SimPy engine, dashboards, CLI
|
|
48
|
+
pip install "smolpy[rust]" # plus the native Rust engine, about 40x faster
|
|
49
|
+
pip install --pre "smolpy[rust]" # the latest development build of main
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
**Release channels.** The versions below are read live from PyPI and GitHub, so this table is always current:
|
|
53
|
+
|
|
54
|
+
| Channel | smolpy | smolpy-engine-rs | Install |
|
|
55
|
+
|---|---|---|---|
|
|
56
|
+
| **Stable**, released by hand | [](https://pypi.org/project/smolpy/) | [](https://pypi.org/project/smolpy-engine-rs/) | `pip install "smolpy[rust]"` |
|
|
57
|
+
| **Development**, every merge to `main` | [](https://github.com/jwszolek/SMOLPy/releases/tag/dev) | same version | `pip install --pre "smolpy[rust]"` |
|
|
58
|
+
|
|
59
|
+
- **What a development build is.** Every merge to `main` that changes the package publishes one, as `X.Y.(Z+1).devN`, N commits after the latest release.
|
|
60
|
+
- **How to get it.** It is a pre-release on PyPI, so `pip` installs it only with `--pre`.
|
|
61
|
+
- **Where it is on GitHub.** The [Development build](https://github.com/jwszolek/SMOLPy/releases/tag/dev) pre-release points to its commit.
|
|
62
|
+
- **Releases proper** are made by hand.
|
|
63
|
+
|
|
64
|
+
From a clone, for development:
|
|
65
|
+
|
|
45
66
|
```bash
|
|
46
67
|
uv sync # installs all runtime + dev dependencies
|
|
47
68
|
```
|
|
@@ -422,7 +443,7 @@ Every simulation goes through the same path. The Python API and `.smol` files bu
|
|
|
422
443
|
| Backend | Language | What it runs | Speed | Install |
|
|
423
444
|
|---|---|---|---|---|
|
|
424
445
|
| `simpy` (default) | Python, SimPy | the whole model, the live and text dashboards | reference | included |
|
|
425
|
-
| `rust` | Rust, through PyO3 | Ethernet: adapters, switches, links, flows (constant, Poisson, bursty, batch, IMIX)
|
|
446
|
+
| `rust` | Rust, through PyO3 | Ethernet: adapters, switches, links, flows (constant, Poisson, bursty, batch, IMIX); Modbus TCP polling; seven metrics | about **40× faster**: B1 at 10 M frames in 4.9 s, not 200.8 s | `pip install smolpy[rust]` (since v1.8.0) |
|
|
426
447
|
|
|
427
448
|
```python
|
|
428
449
|
result = net.simulate(duration=60_000, backend="rust") # one run
|
|
@@ -191,6 +191,11 @@ Raw results: `benchmarks/results/2026-11-15-1255-rust-jaws-zbook-stop-criterion.
|
|
|
191
191
|
- The workflow publishes `smolpy-engine-rs` to PyPI. Its version is kept in lock-step with `smolpy`: the same tag triggers both releases.
|
|
192
192
|
- The existing `ci.yml`, `release.yml` and `publish.yml` of the main package stay unchanged, apart from an extra CI job that runs the equivalence tests with the Rust backend.
|
|
193
193
|
- The Rust toolchain is needed only by contributors who work on the engine.
|
|
194
|
+
- *Added 2026-11-15:* **development builds.**
|
|
195
|
+
- **What.** After every merge to `main` that changes `src/`, `rust/` or `pyproject.toml`, `dev-build.yml` publishes `smolpy` and `smolpy-engine-rs` to PyPI as `X.Y.(Z+1).devN`, where N is the number of commits after the latest release tag. This is hatch-vcs's own numbering, and the workflow checks that the two agree.
|
|
196
|
+
- **For whom.** They are PEP 440 pre-releases, so `pip install smolpy` ignores them and `pip install --pre` gets them. A git hash cannot be part of a version on PyPI, so it goes into the GitHub pre-release instead.
|
|
197
|
+
- **On GitHub.** One pre-release, "Development build" on the moving tag `dev`, is replaced each time and names the commit. Every place that looks for the latest release matches `v*` tags only, so `dev` never counts as one.
|
|
198
|
+
- **Releases** (patch, minor or major) stay manual, through `release.yml`. Release `X.Y.(Z+1)` sorts above all its development builds.
|
|
194
199
|
|
|
195
200
|
---
|
|
196
201
|
|
|
@@ -170,9 +170,9 @@ result.export("out.csv", format="csv") # explicit format override
|
|
|
170
170
|
- **A missing backend is an error.** When a backend is not installed, selecting it raises `BackendUnavailable` with the install command.
|
|
171
171
|
- **`smolpy.backends.installed()`** lists the backends that can run here.
|
|
172
172
|
|
|
173
|
-
**The Rust backend so far** runs adapters, switches (`strict` and `fifo` QoS, `learning` and `topology` MAC tables), links and flows with every pattern (`constant`, `poisson`, `bursty`, `batch`) and with fixed or IMIX sizes. It covers the metrics `throughput`, `latency`, `bytes_sent`, `bytes_received`, `queue_depth` and `
|
|
173
|
+
**The Rust backend so far** runs adapters, switches (`strict` and `fifo` QoS, `learning` and `topology` MAC tables), links and flows with every pattern (`constant`, `poisson`, `bursty`, `batch`) and with fixed or IMIX sizes. It also runs Modbus TCP: slaves, `polls()` and `modbus_latency`. It covers the metrics `throughput`, `latency`, `bytes_sent`, `bytes_received`, `queue_depth`, `utilization` and `modbus_latency`.
|
|
174
174
|
- **Same results as SimPy.** Deterministic scenarios give SimPy's results bit for bit. Random traffic uses the same streams and distributions with the engine's own generator, so there the results agree statistically.
|
|
175
|
-
- **Not in it yet.** MQTT
|
|
175
|
+
- **Not in it yet.** MQTT and PROFINET come in Phase 5 of the [roadmap](roadmap.md).
|
|
176
176
|
- **Install** it with `pip install smolpy[rust]`, or `pip install smolpy-engine-rs` next to an installed `smolpy`. It is released together with `smolpy`, with the same version, since v1.8.0. Wheels exist for Linux x86_64 and aarch64, macOS arm64 and x86_64, and Windows x86_64. To build it from the repository instead, with a Rust toolchain:
|
|
177
177
|
|
|
178
178
|
```bash
|
|
@@ -153,6 +153,12 @@ Modbus TCP, MQTT and PROFINET RT in the Rust engine. These need no new architect
|
|
|
153
153
|
|
|
154
154
|
**Exit criteria:** the Rust backend's capabilities equal SimPy's, apart from the live dashboard.
|
|
155
155
|
|
|
156
|
+
**Status:** one of three protocols done.
|
|
157
|
+
- **Modbus TCP: done.**
|
|
158
|
+
- The Rust engine runs slaves, `polls()` and `modbus_latency`. It reproduces SimPy's poll generator and slave process, including requests flooded to other slaves and dropped there.
|
|
159
|
+
- The new `polling` scenario is bit-exact with SimPy, down to the event count.
|
|
160
|
+
- **MQTT and PROFINET RT** are next. PROFINET's watchdog waits on "a frame or a timeout", a SimPy condition whose event ordering the engine has to reproduce.
|
|
161
|
+
|
|
156
162
|
## Phase 6: ns-3 high-fidelity backend ([ADR-0004](adr/0004-execution-backends.md), revised)
|
|
157
163
|
|
|
158
164
|
A code-generated ns-3 scenario from the Scenario IR. Gives a realistic TCP/IP stack for Modbus and MQTT.
|
|
@@ -39,6 +39,11 @@ build-backend = "hatchling.build"
|
|
|
39
39
|
source = "vcs"
|
|
40
40
|
fallback-version = "0.1.0"
|
|
41
41
|
|
|
42
|
+
# A commit N commits after tag vX.Y.Z is X.Y.(Z+1).devN, with no "+g<hash>"
|
|
43
|
+
# local part: PyPI rejects local versions, and development builds go there.
|
|
44
|
+
[tool.hatch.version.raw-options]
|
|
45
|
+
local_scheme = "no-local-version"
|
|
46
|
+
|
|
42
47
|
[tool.hatch.build.targets.wheel]
|
|
43
48
|
packages = ["src/smolpy"]
|
|
44
49
|
|
|
@@ -10,6 +10,22 @@ pub const PREAMBLE_SFD_BYTES: u64 = 8;
|
|
|
10
10
|
pub const IFG_BYTES: u64 = 12;
|
|
11
11
|
pub const WIRE_OVERHEAD_BYTES: u64 = PREAMBLE_SFD_BYTES + IFG_BYTES;
|
|
12
12
|
|
|
13
|
+
pub const MIN_FRAME_BYTES: u64 = 64;
|
|
14
|
+
/// Ethernet header (14), IPv4 (20), TCP (20) and FCS (4).
|
|
15
|
+
pub const ETHERNET_IP_TCP_BYTES: u64 = 14 + 20 + 20 + 4;
|
|
16
|
+
/// Modbus TCP Read Holding Registers request: MBAP (6), FC, address, quantity.
|
|
17
|
+
pub const MODBUS_REQUEST_BYTES: u64 = ETHERNET_IP_TCP_BYTES + 6 + 1 + 2 + 2;
|
|
18
|
+
|
|
19
|
+
/// A frame padded to the 64 B Ethernet minimum.
|
|
20
|
+
pub fn padded(bytes: u64) -> u64 {
|
|
21
|
+
bytes.max(MIN_FRAME_BYTES)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/// Read Holding Registers response: MBAP (6), FC (1), byte count (1), 2 B per register.
|
|
25
|
+
pub fn modbus_response_frame_size(count: u16) -> u64 {
|
|
26
|
+
padded(ETHERNET_IP_TCP_BYTES + 6 + 1 + 1 + 2 * count as u64)
|
|
27
|
+
}
|
|
28
|
+
|
|
13
29
|
/// A flow frame of `size` bytes (untagged, FCS included), with the tag a
|
|
14
30
|
/// priority above 0 needs.
|
|
15
31
|
pub fn flow_frame_size(size: u64, priority: u8) -> u64 {
|
|
@@ -25,5 +41,9 @@ mod tests {
|
|
|
25
41
|
assert_eq!(flow_frame_size(100, 0), 100);
|
|
26
42
|
assert_eq!(flow_frame_size(100, 3), 104);
|
|
27
43
|
assert_eq!(WIRE_OVERHEAD_BYTES, 20);
|
|
44
|
+
// the values of tests/test_semantics.py::test_frame_sizes
|
|
45
|
+
assert_eq!(MODBUS_REQUEST_BYTES, 69);
|
|
46
|
+
assert_eq!(modbus_response_frame_size(10), 86);
|
|
47
|
+
assert_eq!(modbus_response_frame_size(1), 68);
|
|
28
48
|
}
|
|
29
49
|
}
|