This release is a pre-release and may not be stable for production use.
meshbench
Drive a MeshBench workbench from Python: real MeshCore firmware over a sample-accurate LoRa channel, scripted.
from datetime import timedelta
from meshbench import Workbench
with Workbench.headless(fixture="fife-strict", seed=9001) as wb:
wb.sim.run(timedelta(minutes=5))
print(wb.provenance())
print(wb.events.total(), "events")
headless needs no display, no GPU and no toolkit. Workbench.attach()
connects to a workbench somebody is already looking at and never closes it.
Where more than one is running, meshbench.sessions() says which: the address
to connect on, the process, when it started, and what it has open. Pass a row
straight to attach(). A session that was killed rather than closed is not
listed, because the check is a dial of the address and not a look at a socket
file or a pid.
Installing
pip install meshbench
You also need the meshbench binary on PATH — the package drives it, it
does not contain it.
What it looks like
wb.project.new(place="Fife")
wb.nodes.place_many(
[
{"name": "R1", "kind": Kind.SIMPLE_REPEATER, "lat": 56.20, "lon": -3.20},
{"name": "C1", "kind": Kind.COMPANION, "lat": 56.19, "lon": -3.17},
]
)
wb.sim.start()
wb.firmware.wait_started() # a sensible default, or pass a timedelta
node = wb.nodes["C1"]
node.firmware = wb.firmware.find("companion-v1.17.0")
print(node.console.ask("get region"))
wb.call(verb, params) is the whole API underneath, and stays public: anything
this package has not shaped is one line away rather than a blocker.
Testing firmware with it
The package registers a pytest plugin, so there is no conftest.py to copy:
def test_the_flood_reaches_glenrothes(meshbench):
meshbench.project.open("fixtures/fixture-fife-strict.json")
meshbench.sim.run(timedelta(minutes=5))
assert meshbench.events.total() > 0
One workbench for the whole run — starting firmware on a real mesh is minutes,
not milliseconds — with the scenario cleared between tests so reuse does not
leak. --meshbench-socket attaches to one you are already running instead.
A failing test prints the provenance, whether or not it asked. Somebody reading a failed assertion about a mesh is deciding whether their firmware change broke something, and they need to know what the run assumed first.
Two things that will bite otherwise
Simulated time is not your time. Every duration here is a
datetime.timedelta - Python already has a duration type, so this package does
not invent one - but two different clocks are measured in them:
- the mesh's, for
sim.run(...),schedule.add(at=, every=)andsim.wait_until(at=) - yours, for every
timeoutand forsim.run(wait=)
sim.run(timedelta(minutes=5), wait=timedelta(minutes=60)) is five minutes of
the mesh's clock, and up to an hour of yours waiting for it. On 155 emulated
nodes that gap is the normal case, which is why they are separate arguments.
Every wait has a defensible default, so wait_started() on its own is fine.
A node answers on its next loop. Its loop only runs when the engine steps,
so reading a console straight after writing to it reads the moment before the
command was sent. Use console.ask(), which gives the mesh its own time first.
Honesty
Every result comes out of a simulator that is kinder than the air: no
multipath, no body loss, no oscillator error. The measured biases are nearly
all in one direction, which is what makes a result usable — treat it as a best
case. wb.provenance() says what a given run assumed, and it is meant to be
printed above any number you publish.
Licence
GPL-3.0-or-later, with the rest of MeshBench.
Metadata
Release files for meshbench 0.0.11.dev2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| meshbench-0.0.11.dev2.tar.gz | 70.3 kB | With provenance | Details for meshbench-0.0.11.dev2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| meshbench-0.0.11.dev2-py3-none-any.whl | Python 3 | none | any | Details for meshbench-0.0.11.dev2-py3-none-any.whl |
Total release size: 131.5 kB
Release files / meshbench-0.0.11.dev2.tar.gz
| Download URL | meshbench-0.0.11.dev2.tar.gz |
|---|---|
| Size | 70.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a7ad523db4746d507839fe5d5fb2f47d2d5ad2c5326e1d2da60769374216cf2a
|
|
BLAKE2b-256 checksum How to use checksums |
ccc9bb99f701727808657feb689fe4606a1c61c0e72ea2846b61bb2bc37baeef
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 8, 2026.
Transparency logRelease files / meshbench-0.0.11.dev2-py3-none-any.whl
| Download URL | meshbench-0.0.11.dev2-py3-none-any.whl |
|---|---|
| Size | 61.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
82b076be8cc6ecd6e4442e7273e63559695d6c7fa56ff7dbf7defb8f0b572149
|
|
BLAKE2b-256 checksum How to use checksums |
7965038001a881fc3ef57eb14d6eb23a58387b64f93636fb6e984f94fad868b6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 8, 2026.
Transparency logSecurity for meshbench 0.0.11.dev2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for meshbench-0.0.11.dev2.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 8, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.