rocrate-action-recorder
Python package to record calls of Python CLI commands into a Research Object Crate (RO-Crate). Useful to track which commands were executed, which files were used as input or output, and which software was used to execute the command.
Supports RO-Crate 1.1 specification. Specifically the Process Run Crate profile.
Provides adapters for CLIs based on:
- argparse example usage docs homepage
- click example usage docs homepage
- cyclopts example usage docs homepage
Install
pip install rocrate-action-recorder
For Click support, install the optional extra:
pip install "rocrate-action-recorder[click]"
For Cyclopts support, install the optional extra:
pip install "rocrate-action-recorder[cyclopts]"
Usage
Example of recording a CLI command (example-cli input.txt output.txt) implemented with argparse.
import argparse
from pathlib import Path
import sys
from rocrate_action_recorder import recorded_argparse
parser = argparse.ArgumentParser(prog="example-cli", description="Example CLI")
parser.add_argument("--version", action="version", version="%(prog)s 1.2.3")
parser.add_argument("--no-record", action="store_false", help="Disable RO-Crate recording.")
parser.add_argument("input", type=Path, help="Input file")
parser.add_argument("output", type=Path, help="Output file")
@recorded_argparse(
parser=parser,
input_files=["input"],
output_files=["output"],
dataset_license="CC-BY-4.0",
enabled_argument="no_record",
)
def handler(args: argparse.Namespace):
# For demonstration, just upper case input to output, replace with real logic
args.output.write_text(args.input.read_text().upper())
# Prepare input
Path("input.txt").write_text("hello")
# Simulate command-line arguments
sys.argv.extend(["input.txt", "output.txt"])
args = parser.parse_args()
handler(args)
After execution, a ro-crate-metadata.json file (like this one) will be generated in the current working directory, describing the execution of the CLI command.
You can also call the low-level record function directly.
See documentation for more details.
Contributions
See AGENTS.md for commands and hints for contributions.
Citation
See CITATION.cff for citation information.
Metadata
Release files for rocrate-action-recorder 0.7.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 | |
|---|---|---|---|
| rocrate_action_recorder-0.7.1.tar.gz | 92.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| rocrate_action_recorder-0.7.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 122.7 kB
Release files / rocrate_action_recorder-0.7.1.tar.gz
| Download URL | rocrate_action_recorder-0.7.1.tar.gz |
|---|---|
| Size | 92.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0dedaa6a701e1e922da766a20bc7bc5997d3d808fe555afea332562733db551d
|
|
BLAKE2b-256 checksum How to use checksums |
32941dad373acd0d7858316b303e65df38fef17f15257a5aa3682bc1e02d4977
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
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 Aug 4, 2026.
Transparency logRelease files / rocrate_action_recorder-0.7.1-py3-none-any.whl
| Download URL | rocrate_action_recorder-0.7.1-py3-none-any.whl |
|---|---|
| Size | 30.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
674c10e4cca5bce9162b8afc3f9dd2c3082d7db5a12c765504161a71e2af3a10
|
|
BLAKE2b-256 checksum How to use checksums |
13c3850b8d34cf5448b4a3a17af71b8b73cbc04eeb29ab8024af86057fd497d0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
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 Aug 4, 2026.
Transparency log