Skip to main content

Lima2 Client

pypi badge pipeline badge coverage badge

This repo contains source code for the Lima2 Conductor, an orchestration module for the Lima2 acquisition system, and its python client library, the lima2.client package.

Install the lima2-client package:

pip install lima2-client

Quickstart

A minimal setup for running Lima2 requires:

NOTE: In a bliss environment, the tango server comes with bliss-demo-servers, so nosqltangodb is not required.

Install everything into a new conda environment:

conda create -n lima2 "python==3.10"
conda activate lima2
conda install -c esrf-bcu lima2
pip install lima2-client[conductor,shell] nosqltangodb

The first step is to start the tango server. For nosqltangodb, example config files can be found in the repo's tests/integration/tango_db/ directory. Fetch it into the current directory with:

wget -qO- https://gitlab.esrf.fr/limagroup/lima2-client/-/archive/main/lima2-client-main.tar.gz?path=tests/integration/tango_db | tar -xz --strip-components=1

Start the tango server:

NosqlTangoDB --port 10000 --db_access yaml:tests/integration/tango_db/ 2

Start the Lima2 devices (one control, two receivers):

export TANGO_HOST="localhost:10000"
mpiexec -n 1 lima2_tango simulator_ctl : \
        -n 1 lima2_tango simulator_rcv1 : \
        -n 1 lima2_tango simulator_rcv2

Start the Lima2 Conductor, which listens on port 58712 by default:

lima2-conductor start \
                localhost:10000 \
                round_robin \
                id00/limacontrol/simulator \
                id00/limareceiver/simulator1 \
                id00/limareceiver/simulator2

With all parts online, a client can now make requests to the conductor to interact with the acquisition system.

The quickest way to start is inside the interactive session (requires the lima2-client[shell] extra dependencies):

lima2-shell
In [1]: run_acquisition(nb_frames=120, expo_time=0.02)  # Should take 2.4 seconds
In [2]: pipeline.progress()
Out[2]: 120

In the shell, the entire API of the conductor is exposed via the following namespaces:

  • acquisition: direct commands (prepare, start, stop, reset), system state and progress
  • detector: detector information, commands, capabilities and real-time status
  • pipeline: data access (reduced data streams, frames) and detailed processing progress

For more details, the lima2-shell doc and the API reference should be useful.

Description

This repo is organized as follows:

lima2-client
├── conda          # Conda build configuration
├── docs           # Documentation sources
├── scripts        # Auxiliary scripts
├── src/lima2
│   ├── client     # Conductor client-side library
│   ├── conductor  # Conductor server code
│   └── common     # Shared definitions
└── tests
    ├── integration
    └── unit
        ├── client
        ├── conductor
        └── common

The project is composed of three main python packages.

lima2.client

The conductor's client-side library, meant to be imported from a control application or a data consumer. In this package, the conductor webapp's API endpoints are wrapped into python functions. The docs contain a complete API reference.

lima2.conductor

Implements the Lima2 Conductor, the orchestration process for distributed acquisitions.

Its central class is the AcquisitionSystem, which encapsulates the Lima2 acquisition, detector and processing systems.

This package also contains the lima2.conductor.webservice subpackage: the conductor web server, which provides HTTP endpoints to interact with the conductor remotely.

lima2.common

Contains type definitions and utilities meant to be imported from lima2.client, lima2.conductor, and directly from client apps.

Development environment

The dev optional dependencies contains tools necessary for development and testing.

uv

Install all dependencies into a local venv:

uv sync --extra dev

Commands can be run with uv run:

uv run lima2-conductor --help
uv run lima2-shell --help

NOTE: lima2-conductor has a dev command, which enables live code reloading on save.

conda

Create a new conda environment with python > 3.9:

conda create -n lima2-client "python==3.10"
conda activate lima2-client
pip install -e .[dev]

Execute commands directly:

lima2-conductor --help
lima2-shell --help

Tests

Unit and integration tests can be run locally. All dependencies for unit tests should be in the optional dev dependencies, and the pyproject.toml defines common pytest parameters.

After setting up your dev environment, run the unit tests (prepend uv run if using uv):

pytest tests/unit
# Compute coverage and output the coverage report to htmlcov/
pytest --cov lima2.client --cov lima2.conductor --cov-report html tests/unit/

Integration tests require the Lima2 server, available via conda (see install with conda):

conda activate lima2-client
conda install -c esrf-bcu lima2
pytest tests/integration

Documentation

The repo's pages contain user guides, an API reference and design docs. Source files used to build the documentation are located in the docs/ directory.

The docs are written in markdown and rendered by mkdocs.

Build the docs (uv)

uv sync --extra docs
uv run mkdocs serve  # Start the dev server at localhost:8000
uv run mkdocs build  # Render HTML pages to ./site/

Build the docs (conda/pip)

pip install .[docs]
mkdocs serve  # Start the dev server at localhost:8000
mkdocs build  # Render HTML pages to ./site/

Metadata

Release files for lima2-client 4.3.3

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

Source distribution (sdist)

Source distribution for lima2-client 4.3.3
File Size Uploaded Provenance Actions
lima2_client-4.3.3.tar.gz 639.3 kB Without provenance Details for lima2_client-4.3.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for lima2-client 4.3.3
File Interpreter ABI Platform Actions
lima2_client-4.3.3-py3-none-any.whl Python 3 none any Details for lima2_client-4.3.3-py3-none-any.whl

Total release size: 1.0 MB

Release files / lima2_client-4.3.3.tar.gz

Download URL lima2_client-4.3.3.tar.gz
Size 639.3 kB
Tags Source
SHA-256 checksum
How to use checksums
11b4b8c577615a7c34a4f4d9873cc96647e96301990b70a2a9cab805a1bc49ac
BLAKE2b-256 checksum
How to use checksums
e6a7a418a5dda0d62222819ca3465656783e0c4bea18ce127a11a34d309954b2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Release files / lima2_client-4.3.3-py3-none-any.whl

Download URL lima2_client-4.3.3-py3-none-any.whl
Size 408.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
35f9e753f50395903a64192758fbc6f732b93677a9b39a5dda3940519fb3652a
BLAKE2b-256 checksum
How to use checksums
8851a95e1a081ded8cf8fcd129c031f1a8fcfa1625fde33e60da16c47de3d1d4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Security for lima2-client 4.3.3

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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

4.3.3 This release

2 release files No 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