semantic-benchmark
semantic-benchmark turns a JSON-LD benchmark description into configurations for a simulation runner and combines completed runs into a validated main RO-Crate. It also provides commands for exchanging benchmark crates with RoHub. The package supplies building blocks; each simulation project runs its own solver and workflow.
Install
Requires Python 3.10 or newer.
python -m pip install semantic-benchmark
For main RO-Crate creation, install the validator as well:
python -m pip install "semantic-benchmark[rocrate]"
To work from this repository, use python -m pip install -e ".[rocrate,test]".
Load a benchmark and prepare runs
BenchmarkLoader reads and validates the JSON-LD description. runner.prepare_benchmark loads it and writes one parameters_<configuration>.json file per configuration into an existing working directory. It replaces any existing parameters_*.json files there.
from pathlib import Path
from semantic_benchmark import runner
work_dir = Path("work")
work_dir.mkdir(exist_ok=True)
benchmark = runner.prepare_benchmark(
Path("benchmark.jsonld"),
work_dir,
{"METRE": "m", "PASCAL": "Pa"},
main_profile=Path("main-crate.yml"),
)
for parameter_file in sorted(work_dir.glob("parameters_*.json")):
configuration, result_dir = runner.prepare_configuration(parameter_file, work_dir)
# Run your solver with result_dir / "parameters.json" and save its results there.
The unit mapping adds suffixes such as [m] to parameter keys when a unit resolves. Unmapped units leave the parameter name unchanged. prepare_benchmark can also unpack an archive, copy resources, and create shared directories; see runner.py.
Parameter values can be arrays in JSON-LD. The loader expands each parameter set into the Cartesian product of its values, so a two-choice parameter and a three-choice parameter produce six configurations. See examples/array-configurations.json. To inspect a description and generate parameter files directly:
python examples/test_semantics.py examples/array-configurations.json --output-dir generated_parameters
Create the main RO-Crate
Each completed run needs a reporter RO-Crate ZIP and a result directory containing the metric files described in the benchmark. Pass the exact ZIP paths and a YAML workflow file to the runner:
runner.create_main_rocrate(
work_dir / "results",
benchmark,
Path("main-rocrate.zip"),
subcrate_paths=[Path("work/results/run-1/workflow-run.zip")],
workflow_path=Path("workflow.yml"),
)
The loaded main_profile supplies the software and crate metadata. For example:
software-name: "Example solver"
software-version: "1.0"
software-url: "https://example.org/solver"
crate-license: "https://opensource.org/licenses/MIT"
crate-name: "Example benchmark results"
crate-description: "Simulation results and provenance"
authors:
- name: "Example Author"
orcid: "https://orcid.org/0000-0000-0000-0000"
creator:
name: "Example Creator"
orcid: "https://orcid.org/0000-0000-0000-0001"
authors must contain at least one person. The generated crate links configurations, metric values, workflows, software, and run crates, then validates against workflow-run-crate-0.5. A runner may attach tool-specific software inputs with semantic_benchmark.rocrate.create.add_tool_parameter(benchmark, name, additional_type, default_value, description=None) before creating the crate.
The same operation is available as create-semantic-benchmark-rocrate; run it with --help for its required paths.
RoHub commands
download-semantic-benchmark exports a research object's RO-Crate into a directory. Add --semantic-resource-filename to download its Annotation Collection resource separately.
download-semantic-benchmark \
--identifier <research-object-uuid> \
--username <user> --password <password> \
--path benchmark
upload-semantic-benchmark uploads a completed provenance ZIP and links it to its benchmark research object:
upload-semantic-benchmark \
--provenance_folderpath main-rocrate.zip \
--benchmark-name "Example benchmark" \
--benchmark-rohub-identifier <benchmark-ro-uuid> \
--username <user> --password <password>
Both commands use the development RoHub instance by default; add --use-production-rohub for production. See each command's --help for further options.
Development
python -m pip install -e ".[rocrate,test]"
python -m pytest
Metadata
Release files for semantic-benchmark 0.6.1
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 |
|---|---|---|---|---|
| semantic_benchmark-0.6.1.tar.gz | 43.7 kB | Without provenance | Details for semantic_benchmark-0.6.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| semantic_benchmark-0.6.1-py3-none-any.whl | Python 3 | none | any | Details for semantic_benchmark-0.6.1-py3-none-any.whl |
Total release size: 85.0 kB
Release files / semantic_benchmark-0.6.1.tar.gz
| Download URL | semantic_benchmark-0.6.1.tar.gz |
|---|---|
| Size | 43.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
65e3ca4660fd64f2f1dba9fbfb9c2aac36f21f6c33a54435365a6e253447b8e0
|
|
BLAKE2b-256 checksum How to use checksums |
d1e5477eac591d7a052ce81bad874d6e08e4b17aa99ce7a429400b1b7af32b2a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / semantic_benchmark-0.6.1-py3-none-any.whl
| Download URL | semantic_benchmark-0.6.1-py3-none-any.whl |
|---|---|
| Size | 41.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
803941c61f89e997c339d114cc9ebafdac98ee586271b83386c629db9db40d6f
|
|
BLAKE2b-256 checksum How to use checksums |
8480614b39b287c9ecef5a44bf9f53004e9d76c7ec3789fc43c2f31977d509ec
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Security for semantic-benchmark 0.6.1
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A 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.