RO-Crate InvenioRDM Deposit
Command line tool to deposit an RO-Crate to an InvenioRDM repository.
Originally developed (up to v1.0.2) as ro-crates-deposit by Philipp Beer and Milan Szente.
Requirements
Python 3.9or higher
Setup
Install the package
Install from PyPI using pip or your preferred package manager:
pip install rocrate-inveniordm
Create an InvenioRDM API token
- Register for an account on your chosen InvenioRDM instance. Zenodo Sandbox can be used for testing.
- Go to your profile and select Applications.
- You should see a section called "Personal access tokens." Click the "New token" button.
- Give the token a name that reminds you of what you're using it for (e.g. RO-Crate upload token)
- Select the scopes deposit:write and deposit:actions.
- Click "Create."
- Copy the access token and continue with the next stage.
Set up the environmental variables
The package requires two environment variables to be set:
INVENIORDM_BASE_URL– the URL of your preferred InvenioRDM instance, e.g."https://sandbox.zenodo.org/"INVENIORDM_API_KEY– the API token you created in the section above.
Run the following lines to set the environment variables:
export INVENIORDM_BASE_URL="your_preferred_instance_url"
export INVENIORDM_API_KEY="your_api_key"
You can also add the lines to your ~/.bashrc file so that they are set whenever you start a shell, if you plan to use the package regularly.
If you want to change your target InvenioRDM instance, you can set the environment variables again using the same code.
Usage
General usage
Run rocrate_inveniordm <ro-crate-dir> with <ro-crate-dir> being the path to the RO-Crate directory. This will upload the record (including files and metadata) as a draft to your chosen InvenioRDM instance, and save the generated DataCite metadata as datacite-out.json in the current directory.
By default, the record is not published after upload. You can publish the record through the web interface of your chosen instance, or you can instead run the same command with the -p option to re-upload the crate into a new record and publish it immediately.
Uploading as a zip file
Some repositories use a "flat" structure for records, where all the files are stored in the root of the archive and there is no directory structure. To preserve a directory structure, which can be important for the RO-Crate metadata file to be accurate, you can upload the crate as a single zip file instead – this can be achieved with the -z option (you do not need to pre-zip your crate). For example,
rocrate_inveniordm -z test-ro-crate
will result in an uploaded file called test-ro-crate.zip.
Manually verifying DataCite conversion before upload
This tool is a best-effort approach. After converting the metadata file, the resulting DataCite file is stored as datacite-out.json in the root directory. You can adjust the generated DataCite file as needed, and can run the program in two stages to facilitate this:
First, run the program with the --no-upload option, to create the DataCite file in the current directory without uploading anything to InvenioRDM:
rocrate_inveniordm --no-upload <ro-crate-dir>.
After verifying and adjusting the DataCite file, use the -d option to tell the program to use this file for upload and skip the process of conversion:
rocrate_inveniordm -d <datacite-file> <ro-crate-dir>.
Other options
Additional options can be found by running rocrate_inveniordm --help.
Mapping
The project aims at decoupling the definition of the mapping between RO-Crates and DataCite from code. This means, that users can quickly change/add/remove mapping rules without code changes.
To find out how each piece of RO-Crate metadata is converted to DataCite, see How RO-Crate metadata is mapped to DataCite.
For technical details on the implementation, see Mapping.
Results
Minimal RO-Crate
The result of uploading the minimal RO-Crate as shown on https://www.researchobject.org/ro-crate/1.1/root-data-entity.html#minimal-example-of-ro-crate (/test/minimal-ro-crate) leads to the following result:
Optimal RO-Crate
The result of uploading the /test/test-ro-crate directory looks like this in TUW's InvenioRDM repository:
Real World RO-Crate
We tested the tool on a real-world RO-Crate (https://reliance.rohub.org/b927e3d8-5bfd-4332-b14c-ab3a07d36dc6?activetab=overview). The result is shown below:
For Developers
See the developer guide for information on project structure and how to contribute. Pull requests and issues from new contributors are welcome!
Metadata
Release files for rocrate-inveniordm 2.1.0
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 |
|---|---|---|---|---|
| rocrate_inveniordm-2.1.0.tar.gz | 20.4 kB | Without provenance | Details for rocrate_inveniordm-2.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| rocrate_inveniordm-2.1.0-py3-none-any.whl | Python 3 | none | any | Details for rocrate_inveniordm-2.1.0-py3-none-any.whl |
Total release size: 42.4 kB
Release files / rocrate_inveniordm-2.1.0.tar.gz
| Download URL | rocrate_inveniordm-2.1.0.tar.gz |
|---|---|
| Size | 20.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ae5764f70572f990f10f658891e34118c25679262868f7e693e38b7eadf03cda
|
|
BLAKE2b-256 checksum How to use checksums |
65cd4a85d93f1e4f9b997ef67d1f552c798a8eb4b8c43b59d3bfe1af0c09e291
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.3 CPython/3.12.3 Linux/6.6.87.2-microsoft-standard-WSL2
|
Release files / rocrate_inveniordm-2.1.0-py3-none-any.whl
| Download URL | rocrate_inveniordm-2.1.0-py3-none-any.whl |
|---|---|
| Size | 22.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
99f6412f68d62c5bd9a32797a3f04c08d4e23f9ac8717b9cd6077a10c2282f53
|
|
BLAKE2b-256 checksum How to use checksums |
b4990de9db8ee6551ab324f99bcd55c59d2ee4e35f07918a83c71a07d24270f9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.3 CPython/3.12.3 Linux/6.6.87.2-microsoft-standard-WSL2
|
Security for rocrate-inveniordm 2.1.0
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.