Python API implementation of PSI fytotron API
Project description
PSI Fytotron API implementation
Photon System Instruments (PSI) delivers equipment across the globe. Most of their cells are controlled by a fytotron PC, for which they also provide an optional API. To simplify the implementation and sharing of analysis workflows, we created an OpenAPI specification file and use the Openapi Generator to generate this package.
Installation & Usage
Install from PyPI:
pip install psi-fytotron
Build and tested with Python 3.9+
Cross-platform support for Linux, macOS and Windows
Example implementation
Uses a .env file with the following fields:
URL: http://<ip-address/path>:<port>/fyto/rest
TOKEN: <Fytotron API access token>
The environment files have one additional depency: pip install python-dotenv
Example code:
https://github.com/NPEC-NL/PSI-Fytotron-API/blob/main/example_implementation.py?plain=1#L2-L32
Contributing
We welcome contributions! If you encounter bugs, have feature requests, or want to suggest improvements, please create an issue and provide a clear description.
Setting up a Development Environment
Requires Python 3.9+
- Create a virtual environment (venv):
python -m venv .venv
- Activate the venv:
- On Windows:
.venv\Scripts\activate
- On macOS/Linux:
source .venv/bin/activate
- On Windows:
- Install the package with build and test dependencies:
pip install .[build, test]
For developers
This repository contains a few workflows, they work as follows:
- build client, is triggered by a commit and builds the python client from the specification file.
- Build docs, triggered by the completion of
build clientuses mkdocs to create the documentation pages. - Test fytotron client, triggered by the completion of
build clientor by a pull request, runs the unittests on the repository. - release, can be triggered manually to create a release on testpypi or through a release to push to pypi. To install the release from testpypi, the following command can be used:
python -m pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple psi-fytotron
Updating the OpenAPI specification file
The API is automatically generated from the OpenAPI specification file with the openapi generator cli. The workflows automatically build the client and copy the files to the right folders.
Documentation
Build with mkdocs-material
Documentation for API Endpoints
All URIs are relative to https://localhost:8000/fyto/rest
| Class | Method | HTTP request | Description |
|---|---|---|---|
| FytotronApi | getvar | GET /getvar | Returns the current value of the variable |
| FytotronApi | info | GET /info | Returns all setpoints and actual values in the database. |
| FytotronApi | monitor | GET /monitor | Returns the current status of the fytotron |
| FytotronApi | setvar | POST /setvar | Set the setpoint value |
Documentation For Models
Documentation For Authorization
Authentication schemes defined for the API:
ApiKeyAuth
- Type: API key
- API key parameter name: X-Auth-Token
- Location: HTTP header
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file psi_fytotron-0.2.tar.gz.
File metadata
- Download URL: psi_fytotron-0.2.tar.gz
- Upload date:
- Size: 42.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4fc80070b19cad2d30a17c9842762017afa2099cba3cc53e8463faef8a15e0f5
|
|
| MD5 |
460421dde746101ebb32767ae29ae3b0
|
|
| BLAKE2b-256 |
04946f51941a5628bae04c9ef08c02080ae6791512f06d3371f77219f8f8ea2f
|
Provenance
The following attestation bundles were made for psi_fytotron-0.2.tar.gz:
Publisher:
release.yml on NPEC-NL/PSI-Fytotron-API
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
psi_fytotron-0.2.tar.gz -
Subject digest:
4fc80070b19cad2d30a17c9842762017afa2099cba3cc53e8463faef8a15e0f5 - Sigstore transparency entry: 1643595179
- Sigstore integration time:
-
Permalink:
NPEC-NL/PSI-Fytotron-API@6ee9ccb3beaa48ae524b0051e056becafa571247 -
Branch / Tag:
refs/tags/0.2 - Owner: https://github.com/NPEC-NL
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@6ee9ccb3beaa48ae524b0051e056becafa571247 -
Trigger Event:
release
-
Statement type:
File details
Details for the file psi_fytotron-0.2-py3-none-any.whl.
File metadata
- Download URL: psi_fytotron-0.2-py3-none-any.whl
- Upload date:
- Size: 39.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
65a06fb58f3319b7dd9b38aed68677d7abef137ca90918065a850c7797c42ce7
|
|
| MD5 |
a3710992d3cd439fd540355573436976
|
|
| BLAKE2b-256 |
9f14c0e424a196a76db0a459ea7495632efdc41c4636d97f1a78533c523d23df
|
Provenance
The following attestation bundles were made for psi_fytotron-0.2-py3-none-any.whl:
Publisher:
release.yml on NPEC-NL/PSI-Fytotron-API
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
psi_fytotron-0.2-py3-none-any.whl -
Subject digest:
65a06fb58f3319b7dd9b38aed68677d7abef137ca90918065a850c7797c42ce7 - Sigstore transparency entry: 1643595235
- Sigstore integration time:
-
Permalink:
NPEC-NL/PSI-Fytotron-API@6ee9ccb3beaa48ae524b0051e056becafa571247 -
Branch / Tag:
refs/tags/0.2 - Owner: https://github.com/NPEC-NL
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@6ee9ccb3beaa48ae524b0051e056becafa571247 -
Trigger Event:
release
-
Statement type: