Skip to main content

Chemotion API Python Client

A modernized Python client for the Chemotion ELN REST/Grape API, targeting ELN v4 and validating element properties with Pydantic v2.

The FAIR .eln (RO-Crate) export and the offline ingester are not in this release.

Key features

  • Full REST client for ELN v4 — collections and sharing; samples, reactions, wellplates, research plans, screens, cell lines, device descriptions, sequence-based macromolecule samples, vessels and LabIMotion generic elements/segments/datasets; analyses, attachments and image annotations; comments, private notes, versions, literature and user labels.
  • Workflows beyond single elements — structure and advanced search, deletion and splitting, collection export/import (ZIP), sample import (SDF/CSV/XLSX), reports and table exports, the inbox, chemical inventory and safety data sheets, measurements, spectra processing, text templates, ELN-to-ELN transfer.
  • Administration — users, groups, devices and data collectors, background jobs, feature switches, ontologies, LabIMotion templates and the LabIMotion Hub. MISSING_FEATURES.md tracks what the web UI offers and the client does not.
  • Pydantic v2 type safety — element properties are validated and normalized on read and write.
  • Instance management CLI — the chemotion_api command scaffolds and manages local dockerized Chemotion instances (start/stop, ports, backups).

Requirements & installation

  • Python >= 3.14 (managed automatically by uv)
  • A Chemotion ELN v4 server. ELN 3.x and older are not supported: v4 rewrote collections and sharing, renumbered share permission levels and removed the /syncCollections API, so there is no meaningful overlap. Connecting to an older instance raises UnsupportedServerVersion at test_connection(), before any credentials are sent. For an ELN 3.1.x server, use the 312.x release line instead. The version scheme tracks the server: 401.x.y ↔ ELN 4.0.1, 312.x.y ↔ ELN 3.1.2.
  • For development: uv and just (plus docker for the integration test stack).

Install from source (dependencies resolve from PyPI):

git clone <this repository> && cd chemotionapi

# for development (locked environment with all dependency groups)
uv sync --all-groups      # or: just sync

# as a plain library install
pip install .

Development tasks

Everything is automated through just — run just for the full list:

just sync               # create/refresh the locked virtualenv (uv)
just check              # lint + mypy + offline test suite (the local gate)
just test-integration   # integration suite against the self-contained docker ELN (local only; not run in CI)
just cov                # offline-suite coverage report (gated at 54%)
just docs               # build the Sphinx documentation
just schemas            # dump the LabIMotion JSON schemas from a live ELN
just stack-up           # start / stop / reset / watch the dockerized test ELN
just build              # build sdist + wheel

Quickstart

Log in with an API token. Create one in the ELN under Account & Profile → Account → Authentication Token; the ELN requires two-factor authentication for this. Logging in with a user name and password still works but is deprecated: it issues a FutureWarning.

Connect and create a validated sample and reaction:

from chemotion_api import Instance

with Instance("https://chemotion.dept.uni.de", token="chemtoken_...") as instance:
    project = instance.get_or_create_collection("My Synthesis Project")

    sample = project.new_sample_smiles("CCO")
    sample.name = "Ethanol Stock"
    sample.properties.purity = 0.998        # validated by Pydantic
    sample.save()

    reaction = project.new_reaction()
    reaction.name = "Oxidation of ethanol"
    reaction.starting_materials.append(sample)
    reaction.save()

Dumping the JSON validation schemas

The client validates LabIMotion generic structures (element/segment/dataset klasses, layers, fields, select options) against JSON Schemas that ship as Python modules under chemotion_api/labImotion/items/validation/schemas/. To export every registered schema as plain JSON — e.g. for external tooling, documentation, or diffing against a server release — use the generic manager:

from chemotion_api import Instance

with Instance("https://...", token="chemtoken_...") as instance:
    instance.generic_manager().write_all_validation_schemas()

Or, against the local test stack (credentials overridable via ELN_URL/ELN_USER/ELN_PASS):

just schemas

This writes one <kind>/draft-01.json per schema (element, segment, dataset, layer, field, properties, select_option, …) into a schemas/ directory under the current working directory. The dump is a generated artifact — regenerate it on demand rather than committing it (the repository gitignores schemas/). The copy under tests/schemas/ is rewritten automatically by the integration test suite.

Command-line interface

The package installs a chemotion_api command for managing local dockerized Chemotion instances (useful for development and testing):

chemotion_api --help    # scaffold, start/stop, configure ports, back up local instances

Documentation

Sphinx documentation (API reference + guides) lives in docs/. Read the Docs builds it from main and publishes it at https://chemotionapi.readthedocs.io/; to build it locally:

just docs    # → docs/_build/html/index.html

For AI coding assistants, skills/chemotion-api/ is a skill with the common workflows and a signature reference (references/api.md).

Testing

The default test run is offline and memory-safe; integration tests run against a self-contained seeded docker environment — see tests/README.md and tests/test_config/README.md:

# offline suite (no server; CI runs `just check` = mypy + this, on 3.14)
just test

# integration suite: boots + seeds the dockerized ELN automatically (docker required)
just test-integration

Project layout

Path Contents
chemotion_api/ The client package (elements, collections, LabIMotion, CLI).
tests/test_config/ Self-contained dockerized Chemotion + seeded database for integration tests.
docs/ Sphinx documentation.

References

License

GNU Affero General Public License v3 — see LICENSE.

Metadata

Release files for chemotion-api 401.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for chemotion-api 401.0.0
File Size Uploaded Provenance Actions
chemotion_api-401.0.0.tar.gz 1.2 MB With provenance Details for chemotion_api-401.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for chemotion-api 401.0.0
File Interpreter ABI Platform Actions
chemotion_api-401.0.0-py3-none-any.whl Python 3 none any Details for chemotion_api-401.0.0-py3-none-any.whl

Total release size: 1.5 MB

Release files / chemotion_api-401.0.0.tar.gz

Download URL chemotion_api-401.0.0.tar.gz
Size 1.2 MB
Tags Source
SHA-256 checksum
How to use checksums
6cd3224b4609586349acc7edc422a757d7f2310ced061158b3446b231666b0d0
BLAKE2b-256 checksum
How to use checksums
4ce2b37ad222ee92098c66a6cd06d73654d4488009a08c7f63418a5899a23cd4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.

Transparency log

Release files / chemotion_api-401.0.0-py3-none-any.whl

Download URL chemotion_api-401.0.0-py3-none-any.whl
Size 331.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ef6cb3b0d9251964515219b2c37d293ef27d1948099961441fd9657618d45fad
BLAKE2b-256 checksum
How to use checksums
597e15829022d20f9c1b8d21a51b3c35f8beb099620e3d8ac8460b007c16903e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.

Transparency log

Security for chemotion-api 401.0.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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for chemotion_api-401.0.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.

Transparency log

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.

Release history Release notifications | RSS feed

This release

401.0.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page