Skip to main content

Dar Invenio Command Line Interface

Project description

DAR-INVENIO-CLI

DAR-INVENIO-CLI is a command-line tool for creating drafts and uploading files in the Invenio webpage.

Installation

From PyPI (Recommended)

This installation may vary for different operating systems.

Link to Pypi package

Steps with venv activation:

sudo apt install python3-full 
python3 -m venv venv
source venv/bin/activate
pip install <your-package>

From source (cloned repository)

  1. Install Python and venv:

    sudo apt update
    sudo apt install python3 python3-pip python3-venv git
    
  2. Clone the repository:

    git clone git@gitlab.ics.muni.cz:dataraptors/elter/dar-invenio-cli.git
    cd dar-invenio-cli
    
  3. Create and activate a virtual environment:

    python3 -m venv .venv
    source .venv/bin/activate
    
  4. Install the package:

    pip install .
    

Configuration

Before using the features, you need to set up the configuration. The configuration initialization with api_token is required.

dar-invenio-cli config init --api-token <your-api-token>

This init configuration is also possible with optional parameters: --base-api-url, --model and --community e.g.:

dar-invenio-cli config init --api-token <your-api-token> --base-api-url <your-base-api-url> --model <your-model> --community <your-community>

You can also update the values for base-api-url and model or api_token later:

dar-invenio-cli config update 

with optional options:

  • --base-api-url <your-base-api-url>
  • --model <your-model>
  • --api-token <your-api-token>

The init script sets default values for the cli and you can see the actual configuration by running:

dar-invenio-cli config show

Usage

If you do not have configuration set up, the commands will prompt you to run the configuration initialization first.

Create a single draft

From a JSON file - you need to provide valid json with its metadata structure, otherwise the creation may fail:

dar-invenio-cli create draft --from-file /path/to/your/file.json

From a name - creates a draft with empty metadata except for the title:

dar-invenio-cli create draft --from-title "My Draft Name"

Create multiple drafts

From multiple JSON files:

dar-invenio-cli create drafts --from-files "/path/to/file1.json" --from-files "/path/to/file2.json"

From a folder containing JSON files:

dar-invenio-cli create drafts --from-folder "/path/to/your/folder"

Upload files to a draft

dar-invenio-cli upload files <draft_id> "/path/to/file1" "/path/to/file2"

Upload files from a folder to a draft

It uploads all files from the specified folder to the given draft - if you want to have it in one file, create and upload ZIP.

dar-invenio-cli upload folder <draft_id> "/path/to/your/folder"

For Developers

The core logic is located in dar_invenio_cli/core.py. You can import and use the functions from this module in your own Python projects.

Deployment to PyPI

The easiest way, how to deploy a new version is to bump the version in the setup.cfg and run the deploy pipline on GitLab.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dar_invenio_cli-0.2.6.tar.gz (11.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dar_invenio_cli-0.2.6-py3-none-any.whl (14.8 kB view details)

Uploaded Python 3

File details

Details for the file dar_invenio_cli-0.2.6.tar.gz.

File metadata

  • Download URL: dar_invenio_cli-0.2.6.tar.gz
  • Upload date:
  • Size: 11.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for dar_invenio_cli-0.2.6.tar.gz
Algorithm Hash digest
SHA256 c2b582705eb7fd3fc325d41741ead27c0e8ed828a0172a7abc9e624958dd7ce0
MD5 3bacd0b3968b13eb42af8f611f79a1ac
BLAKE2b-256 d2e01ef3661da5ee61af1ca92b2b7972cf90c150a83c9bd8613d836d54e0d3a6

See more details on using hashes here.

File details

Details for the file dar_invenio_cli-0.2.6-py3-none-any.whl.

File metadata

File hashes

Hashes for dar_invenio_cli-0.2.6-py3-none-any.whl
Algorithm Hash digest
SHA256 3f58b4c1f52773172c135a41f58579e62a2d39c35ba45f1886ac8979b405463e
MD5 4e4996bdb9edb23d3d3e64b3fb015f47
BLAKE2b-256 c71efc1c7b2c89743328ca0d070dd136e709c2c0be5120b21b87ec1124166c56

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page