PSI Plantscreen API implementation
Photon System Instruments (PSI) delivers equipment across the globe. Their climate cells are controlled with plantscreen software, which comes with an API. Experience taught us, this API is a bit tricky to implement. We believe it's a waste of time if everyone has to figure out how to implement this API and test it. Therefore, we created the swagger file and a simple python wrapper to integrate the endpoints of the plantscreen API. Additionally the model classes are enriched with properties and functions to access linked models to make usage easier.
Unfortunately, we were not able to test the 3D scanner and MSC endpoints as the facilities are not equipped with these systems.
Installation
Install from PyPI:
pip install psi-plantscreen
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:
HOST=http://<ip-address>:<port>
The environment files have one additional dependency: pip install python-dotenv
Examples:
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
Tested with python 3.10, 3.11, 3.12 and 3.13.
- 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:
generate_mustache_templates, can be triggered manually to generate a complete fresh set of templates. This comes in handy when making new templates or checking what was changed. The templates are temporarily stored as artifacts of the action.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 plantscreen, 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-plantscreen
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.
Not all endpoints use the default OpenAPI implementation. For example, file endpoints use a socket (data stream) to download the files. It's unclear how to implement streams in the swagger file. Those endpoints are also called without the return type prefix: '/json', which means they require a different URL. Luckily, OpenAPI supports the use of mustache template files to customize the generation process. They are used to add the following functionality:
- Custom classes and functionality:
file_api_method.mustache: file api endpoint used a bytestream instead of an HTTP call to stream the file content.partial_link_property.mustache: adds a lazy-loaded property for a direct 1:1 link. When you access it, it calls the related API once, stores the result on the model, and returns the linked object.partial_implicit_link.mustache: adds a similar lazy-loaded property, but for links defined at the model level through vendor extensions rather than on a single field. It fetches the related model automatically from the source value on the current object.partial_rel_function.mustache: adds a method for relationship lookups that may need extra parameters and may return one object or a list. Unlike the property-based links, this is an explicit function call for more flexible related-data queries.
__init__api.mustache: Allow single value arguments to be passed for parameters accepting a list of values.api_doc.mustache: Updated the links to other files.api.mustache: Contains the logic to parse a list of ints for the experiment_id, owner_id and profile_id calls and implements the file_api call.configuration.mustache: Switches the datetime format to the one passed in the generation command.model_doc.mustache: Updated to describe relations and links to other files. It is combined with:generate_docs.pywhich generates documentation for the 'not auto generated' code and lists all models and API endpoints.model_generic.mustache: adds the custom links and relations mentioned above. Removes the datetime parsing. Additionally a change was added to allow API calls to return 'None', with special logic for 'JsonMscCalibrationLightResult' and 'JsonMscCalibrationLightByIDResult' and the combination of 'JsonProbeResult' and 'JsonProbeByIDResult'.
More information about mustache templating can be found here: mustache templates
Additionally, a clean set of templates can be generated with the generate_mustache_templates.yml workflow. This is ideal to check what was edited or to add new changes.
After this some postprocessing scripts are executed to make it work:
- run
pip install .and then usegenerate_complete_api_client.pyto create a single file with all the api calls for convenience. - Copy
xml_decoder.pyto the plantscreen folder - Update the documentation
generate_docs.pyandupdate_docs.py - Run
update_init.pyto make the complete_api_client and xml classes available in the package.
Documentation
Build with mkdocs-material
Note, the docs pages will unfortunately not be available until this repo is made public.
Metadata
Release files for psi-plantscreen 0.2.5
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 |
|---|---|---|---|---|
| psi_plantscreen-0.2.5.tar.gz | 323.3 kB | With provenance | Details for psi_plantscreen-0.2.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| psi_plantscreen-0.2.5-py3-none-any.whl | Python 3 | none | any | Details for psi_plantscreen-0.2.5-py3-none-any.whl |
Total release size: 808.9 kB
Release files / psi_plantscreen-0.2.5.tar.gz
| Download URL | psi_plantscreen-0.2.5.tar.gz |
|---|---|
| Size | 323.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
97d42fc4138f9ca2a079175e4c689368b3ef7407ec381d2840999913b25b047a
|
|
BLAKE2b-256 checksum How to use checksums |
75abbf8b68cc590a2f1e79a10371b708653e91fba14620d7d3f25399515f4d33
|
| 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 May 27, 2026.
Transparency logRelease files / psi_plantscreen-0.2.5-py3-none-any.whl
| Download URL | psi_plantscreen-0.2.5-py3-none-any.whl |
|---|---|
| Size | 485.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
275139c644fb43748ad680cb44fd0c32d4f5baa7e32d9e92a9388544c811d246
|
|
BLAKE2b-256 checksum How to use checksums |
a766468975a3978b99c64ee71c5e056431ea5fa9d5b96a06df5c2ad9d29475e4
|
| 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 May 27, 2026.
Transparency logSecurity for psi-plantscreen 0.2.5
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 psi_plantscreen-0.2.5.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 May 27, 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.