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.mdtracks 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_apicommand 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
/syncCollectionsAPI, so there is no meaningful overlap. Connecting to an older instance raisesUnsupportedServerVersionattest_connection(), before any credentials are sent. For an ELN 3.1.x server, use the312.xrelease 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
Rules for code that talks to the ELN are in CONTRIBUTING.md.
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).
It also ships in the installed package, matching its version, at
chemotion_api/skills/chemotion-api/ (find it with
python -c "import chemotion_api, pathlib; print(pathlib.Path(chemotion_api.__file__).parent / 'skills')").
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.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| chemotion_api-401.1.1.tar.gz | 1.2 MB | With provenance | Details for chemotion_api-401.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| chemotion_api-401.1.1-py3-none-any.whl | Python 3 | none | any | Details for chemotion_api-401.1.1-py3-none-any.whl |
Total release size: 1.5 MB
Release files / chemotion_api-401.1.1.tar.gz
| Download URL | chemotion_api-401.1.1.tar.gz |
|---|---|
| Size | 1.2 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2f97f4b007dfbee3727e5de9d04e34b9d70bb1f2e9f4b39d5aac4dc1ae1916a7
|
|
BLAKE2b-256 checksum How to use checksums |
cb592893b835c8f1ea999cdd00754398e74c7a7aed2bece0afe5bf1612cc9c0f
|
| 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 17, 2026.
Transparency logRelease files / chemotion_api-401.1.1-py3-none-any.whl
| Download URL | chemotion_api-401.1.1-py3-none-any.whl |
|---|---|
| Size | 356.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c1d524f59448473b31ee2ddc72252f252e734e9f29fe1e6e2c16cbe488f91eb5
|
|
BLAKE2b-256 checksum How to use checksums |
2d8a2245f498ee97581e80b76c4ac3ffc1c2051cf64f983b265521a0ac6e71b7
|
| 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 17, 2026.
Transparency logSecurity for chemotion-api 401.1.1
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.
Attestation for chemotion_api-401.1.1.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 17, 2026.
Transparency logA 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.