Skip to content

Latest commit

 

History

History

client-api_python

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

PySirius

REST API that provides the full functionality of SIRIUS and its web services as background service. It is intended as entry-point for scripting languages and software integration SDKs.

Installation & Usage

conda install (preferred)

Install the py-sirius-ms package from conda-forge using

conda install -c conda-forge py-sirius-ms

or

conda install conda-forge::py-sirius-ms

This will automatically install all dependencies, including the sirius-ms package including SIRIUS itself and set an environment variable for SIRIUS when activating the respective conda environment. The conda-forge install is the preferred method due to quality-of-life features (see Getting Started).

pip install

Specific Version

Replace v0.0.0 with your api version

pip install git+https://github.com/sirius-ms/sirius-client-openAPI@v0.0.0#subdirectory=client-api_python/generated

Latest (unstable) Version

pip install git+https://github.com/sirius-ms/sirius-client-openAPI#subdirectory=client-api_python/generated

(you may need to run pip with root permission: sudo pip install git+https://github.com/sirius-ms/sirius-client-openAPI#subdirectory=client-api_python/generated)

Then import the package:

import PySirius 

Setuptools

Install via Setuptools.

python setup.py install --user

(or sudo python setup.py install to install the package for all users)

Then import the package:

import PySirius

Getting Started

Local Endpoint

Please follow the installation procedure and then run the following (while replacing the Strings for project_space and sirius_executable).

NOTE: the SIRIUS REST service automatically allocates a random available port on your machine. SiriusSDK will always try to get this information automatically, but you can set a port manually to make sure.

If you installed via conda-forge or have SIRIUS in your path, you should be able to activate your environment and simply use:

from PySirius import SiriusSDK
sdk = SiriusSDK()
# SIRIUS must be in the path or the SIRIUS_EXE environment variable must be specified.
# Is automatically configured when installing via conda or windows ms installer
api = sdk.attach_or_start_sirius()

print(api.jobs().get_default_job_config())
print(api.projects().get_project_spaces())

# Optional
sdk.shutdown_sirius()

If you installed from GitHub or a local folder manually and do not have SIRIUS in path, you can go the manual way:

from PySirius import SiriusSDK
sdk = SiriusSDK()
api = sdk.start_sirius(sirius_path="your/path/to/sirius", port=8080)

You can also attach to a running SIRIUS instance:

from PySirius import SiriusSDK
sdk = SiriusSDK()
api = sdk.attach_to_sirius(sirius_major_version=6, port=8080)

Remote Endpoint

Please follow the installation procedure and then run the following (while replacing address and port with the Remote address specifications):

from PySirius import SiriusSDK
sdk = SiriusSDK()
api = sdk.connect("http://localhost:8080")

SiriusSDK class

For more niche functionality and insights, find the SiriusSDK class here.

Example code

Our feedstocks for the conda-forge packages are running an automated minimal test. We included the scripts here. Feel free to take them as example usages of the packages.

Documentation for API Endpoints

Please click here

Documentation For Models

Please click here