ISPyB API
This package provides a way to write acquisition and processing results into an ISPyB database. Currently, the only supported method is through stored procedures, but the package is designed to allow for other methods as well, such as webservices.
Documentation
Please see https://ispyb.readthedocs.io.
Requirements
- Python 3.10 (minimum), 3.11, 3.12, 3.13 (recommended)
- The MySQL Connector/Python package.
- MariaDB 10.0+ or MySQL 5.6+, but we recommend MariaDB 10.2 or later.
- An ISPyB database installed on the above. See the ispyb-database repository for details.
Installation
From PyPI:
pip install --user ispyb
The --user option installs the package for your own user only.
You can leave it out if you want to install the package system-wide.
To install the source code in editable mode for development:
git clone git@github.com:DiamondLightSource/ispyb-api.git
pip install --user -e ispyb-api
Examples
import ispyb
from datetime import datetime
# Get a connection and data area objects
with ispyb.open("config.cfg") as conn:
core = conn.core
mx_acquisition = conn.mx_acquisition
# Find the id for a given visit
sessionid = core.retrieve_visit_id("cm14451-2")
# Create a new data collection group entry:
params = mx_acquisition.get_data_collection_group_params()
params["parentid"] = sessionid
params["experimenttype"] = "OSC"
params["starttime"] = datetime.strptime("2017-09-21 13:00:00", "%Y-%m-%d %H:%M:%S")
params["endtime"] = datetime.strptime("2017-09-21 13:00:10", "%Y-%m-%d %H:%M:%S")
params["comments"] = "This is a test of data collection group."
dcg_id = mx_acquisition.insert_data_collection_group(list(params.values()))
print("dcg_id: %i" % dcg_id)
See docs/pipeline2ispyb.py for a more detailed example of how to use the package.
Tests
Unit tests (pytests) are run automatically by Azure against a real MariaDB ISPyB database schema. You can also run the tests in your Development environment if you have an ISPyB database.
Release files for ispyb 12.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 | |
|---|---|---|---|
| ispyb-12.1.1.tar.gz | 93.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ispyb-12.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 182.4 kB
Release files / ispyb-12.1.1.tar.gz
| Download URL | ispyb-12.1.1.tar.gz |
|---|---|
| Size | 93.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e15d3111a504e19722c071470c346b53cef03c373a61ed8d8d5ce16d825b7ad8
|
|
BLAKE2b-256 checksum How to use checksums |
4d040f89a5db4d8e03283097416abbba86f0446b91db175785859ffe33163178
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Jul 13, 2026.
Transparency logRelease files / ispyb-12.1.1-py3-none-any.whl
| Download URL | ispyb-12.1.1-py3-none-any.whl |
|---|---|
| Size | 89.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8f4016ac19473250d94ed47a4626ef6fc352aabd984672e9db5151f4c7e930ba
|
|
BLAKE2b-256 checksum How to use checksums |
cc496adba26c826fe517f32be07c3144fb2f1cf70720dda7e5e4f26da21dfd3c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Jul 13, 2026.
Transparency log