Skip to main content

CLI wrapper for interacting with eLabFTW API at University of Duisburg-Essen

Project description

elabftw_ude_cli

elabftw_ude_cli is a Python-based CLI and importable API for interacting with the eLabFTW electronic lab notebook system, tailored for use at the University of Duisburg-Essen.

It provides:

  • A command-line interface to create, modify, search, and read experiments.
  • A Python API for programmatic integration with pipelines and notebooks.
  • Tab-autocomplete support for fast CLI access.
  • Optional integration with Python-based workflows like Snakemake.

🛠 Installation

pip install elabftw_ude_cli

🔑 Step 0: Add your API key and base URL

After installation, locate and edit your config.py:

python -c "import elabftw_ude_cli.config as c; print(c.get_config_file_path())"

Open this file and configure your servers dictionary and server_to_use key.


⚡ CLI Usage

After installation, use elabftw-cli from the command line.

♻️ Enable tab-completion (recommended)

activate-global-python-argcomplete --user

Or for bash/zsh:

eval "$(register-python-argcomplete elabftw-cli)"

📋 CLI Commands

elabftw-cli create_experiment --name "Exp Title" --body path/to/body.md --steps path/to/steps.json
elabftw-cli modify_experiment --exp_id 123 --body new_body.md --steps new_steps.json
elabftw-cli search_experiments --name-like "test"
elabftw-cli read_experiment --exp_id 123

Common CLI Options

  • --json: Provide a JSON file with experiment metadata.
  • --body: Text or HTML/Markdown file to use as body content.
  • --steps: JSON file with step definitions.
  • --first / --all: Control read behavior when multiple matches are found.
  • --outfile: Save experiment(s) to a custom file.
  • -f: Force title changes in modification.

🧑‍💻 Python API Usage

import elabftw_ude_cli.api as elf

# Create an experiment
exp_id = elf.create_experiment(
    name="My Experiment",
    body="<h1>Intro</h1><p>This is HTML</p>",
    content_type=2
)

# Modify with body append and steps
elf.modify_experiment(
    exp_id=exp_id,
    body_append="Done.\nAll checked.",
    steps=[{"body": "step_3: summary"}]
)

# Complete step
elf.complete_step(exp_id, pattern="step_3", change="first", done_by="Alice")

# Search and read
ids, names = elf.search_experiments("test")
data = elf.read_experiment(exp_id=ids[0])

🧬 Snakemake Integration

Because Snakemake supports native Python and shell calls, you can use this library in rules:

# In a rule or script:
import elabftw_ude_cli.api as elf

def report_to_elab(title, body, steps):
    return elf.create_experiment(name=title, body=body, steps=steps)

Or from the shell using elabftw-cli.

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

elabftw_ude_cli-0.1.0.tar.gz (10.9 kB view details)

Uploaded Source

Built Distribution

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

elabftw_ude_cli-0.1.0-py3-none-any.whl (12.0 kB view details)

Uploaded Python 3

File details

Details for the file elabftw_ude_cli-0.1.0.tar.gz.

File metadata

  • Download URL: elabftw_ude_cli-0.1.0.tar.gz
  • Upload date:
  • Size: 10.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for elabftw_ude_cli-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1847de91e175812898e96ef990e895f0a523325e5195fd895437d60a8412ffe9
MD5 2264a6a43230be441bd51b6a92ea3b0b
BLAKE2b-256 d70c89673722b9f05b00732aa1424f2f851ce6281912335f03ed4c81de067000

See more details on using hashes here.

File details

Details for the file elabftw_ude_cli-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for elabftw_ude_cli-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ab15d5818fb52a7b6c9827bffbccf6a15d6d9b1608b5504349003bd645b5e629
MD5 f6f51d77295c9a8f1885a8da4e9f30c7
BLAKE2b-256 8639e6ab0d614a0e44d99bb930bf9d211c39a51336a7dff8ce22de64759813d6

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