Skip to content
This repository has been archived by the owner on Oct 3, 2023. It is now read-only.

elabftw/elabapy

Repository files navigation

elabapy

release condarelease wheel license

This Python 3 library provides easy access to eLabFTW's API to list or update experiments or items.

API Versions

This library works with eLabFTW's API v1. It is recommended to use API v2. A python package is available for API v2, see this repository:

WARNING: DEPRECATED LIBRARY

Because this package is for APIv1 and APIv1 is deprecated from eLab, this library is therefore also deprecated and should not be used.

Install

You can install elabapy using pip:

pip install --user elabapy

or via conda-forge:

conda install -c conda-forge elabapy

or from source:

git clone https://github.com/elabftw/elabapy
cd elabapy
python setup.py install

Update

pip install -U elabapy

Use

Example script

import elabapy
import json
from requests.exceptions import HTTPError
# initialize the manager with an endpoint and your token
manager = elabapy.Manager(endpoint="https://elab.example.org/api/v1/", token="3ca8...e14b")
# get experiment with id 42
try:
    exp = manager.get_experiment(42)
    print(json.dumps(exp, indent=4, sort_keys=True))
# if something goes wrong, the corresponding HTTPError will be raised
except HTTPError as e:
    print(e)

Use verify=False in the Manager initialization to disable TLS certificate verification.

Dev stuff

Install dependencies

pipenv sync -d

Run mypy

pipenv run python -m mypy elabapy

Create new release

  • Update version in setup.py and elabapy/__init__.py
  • Update changelog
  • Commit
  • Tag
  • Create release on GitHub

A GitHub Action will take care of publishing it to Pypi.org.

Update requirements.txt

pipenv requirements > requirements.txt