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())"

Then open the file and update:

  • server_name_to_use to clarify which server to use
  • You can configure multiple servers and teams with different teams and/or test serversfor each server in the servers dictionary give it a name, and define its:
  • url pointing to your institution's instance
  • api_key with your generated key (see below)

🎯 How to get your API key:

  1. Log in to eLabFTW.
  2. Click your initials in the top-right.
  3. Go to Settings → API Keys.
  4. Enter a name, set permission to read/write, and click Generate API Key.
  5. Copy and store the key safely – it will only be shown once.

⚡ 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 body.md --steps 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

📁 File Actions via CLI

elabftw-cli file-actions --name-like "My Experiment" --upload results.csv --replace
elabftw-cli file-actions --name-like "My Experiment" --search
elabftw-cli file-actions --name-like "My Experiment" --delete log.txt error.log
elabftw-cli file-actions --name-like "My Experiment" --download report.txt

File Options

  • --replace: Replace file if it already exists
  • --delete: Delete files by name match (can be partial)
  • --download: Download files to temp/ directory
  • --search: List uploaded files

🧑‍💻 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 a 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 Example

See Snakemake Integration for examples of using this inside workflows.

📋 CLI auto_update and automations:

See Auto Update Guide for scheduling and automation.


📦 License

MIT License. See LICENSE file.

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.2.tar.gz (15.0 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.2-py3-none-any.whl (17.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: elabftw_ude_cli-0.1.2.tar.gz
  • Upload date:
  • Size: 15.0 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.2.tar.gz
Algorithm Hash digest
SHA256 c0cf55084b3c43a7c42ac5b470898ddc5c05f71adc29c5065c5958fc072f4b7f
MD5 2dc6d1157e49182ce4a3d867a5a103ab
BLAKE2b-256 8e84cb66b9f6cb8ff272c1d85c4edcc5a5e8fe06c49abfbe3c5e10abbe7d3238

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for elabftw_ude_cli-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b17a83acdb62af0a7da37a74e1c9dc81f7de35279bb641920aff62c29eccff2f
MD5 5c4d7cd36b7786ebc3c9a2727fff275d
BLAKE2b-256 918f9e592af60160a10b53f99d45de34cc0ceb1bbc97012e25127dbffa7d178c

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