Skip to main content

Python API implementation of PSI fytotron API

Project description

PSI Fytotron API implementation

PyPI version


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+

  1. Create a virtual environment (venv):
    python -m venv .venv
    
  2. Activate the venv:
    • On Windows:
      .venv\Scripts\activate
      
    • On macOS/Linux:
      source .venv/bin/activate
      
  3. 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 client uses mkdocs to create the documentation pages.
  • Test fytotron client, triggered by the completion of build client or 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

psi_fytotron-0.2.tar.gz (42.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

psi_fytotron-0.2-py3-none-any.whl (39.3 kB view details)

Uploaded Python 3

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

Hashes for psi_fytotron-0.2.tar.gz
Algorithm Hash digest
SHA256 4fc80070b19cad2d30a17c9842762017afa2099cba3cc53e8463faef8a15e0f5
MD5 460421dde746101ebb32767ae29ae3b0
BLAKE2b-256 04946f51941a5628bae04c9ef08c02080ae6791512f06d3371f77219f8f8ea2f

See more details on using hashes here.

Provenance

The following attestation bundles were made for psi_fytotron-0.2.tar.gz:

Publisher: release.yml on NPEC-NL/PSI-Fytotron-API

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for psi_fytotron-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 65a06fb58f3319b7dd9b38aed68677d7abef137ca90918065a850c7797c42ce7
MD5 a3710992d3cd439fd540355573436976
BLAKE2b-256 9f14c0e424a196a76db0a459ea7495632efdc41c4636d97f1a78533c523d23df

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page