sf.configuration¶
This module contains functionality for configuring Strawberry Fields.
Configuration files¶
When connecting to the Xanadu cloud platform, Strawberry Fields will attempt to load
the configuration file config.toml
, by
scanning the following three directories in order of preference:
The current directory
The path stored in the environment variable
SF_CONF
(if specified)The default user configuration directory:
On Linux:
~/.config/strawberryfields
On Windows:
C:\Users\USERNAME\AppData\Local\Xanadu\strawberryfields
On MacOS:
~/Library/Application\ Support/strawberryfields
The configuration file config.toml
uses the TOML standard,
and has the following format:
[api]
# Options for the Strawberry Fields cloud API
authentication_token = "AUTHENTICATION_TOKEN"
hostname = "platform.strawberryfields.ai"
use_ssl = true
port = 443
Configuration options¶
[api]
¶
Settings for the Xanadu cloud platform.
- authentication_token (str) (required)
API token for authentication to the Xanadu cloud platform. This is required for submitting remote jobs using
RemoteEngine
.Corresponding environment variable:
SF_API_AUTHENTICATION_TOKEN
- hostname (str) (optional)
The hostname of the server to connect to. Defaults to
platform.strawberryfields.ai
. Must be one of the allowed hosts.Corresponding environment variable:
SF_API_HOSTNAME
- use_ssl (bool) (optional)
Whether to use SSL or not when connecting to the API.
true
orfalse
. Defaults totrue
.Corresponding environment variable:
SF_API_USE_SSL
- port (int) (optional)
The port to be used when connecting to the remote service. Defaults to 443.
Corresponding environment variable:
SF_API_PORT
Functions¶
Warning
Unless you are a Strawberry Fields developer, you likely do not need to use the functions in this module directly.
This module contains functions used to load, store, save, and modify configuration options for Strawberry Fields.
Functions¶
|
Create a configuration object that stores configuration related data organized into sections. |
|
Delete a configuration file. |
Returns the list of directories that should be checked for a configuration file. |
|
|
Get the filepath of the first configuration file found from the defined configuration directories (if any). |
|
Gets the API section from the loaded configuration. |
|
Get the paths for the configuration files available in Strawberry Fields. |
|
Filters the valid options in a section of a configuration dictionary. |
|
Load configuration from keyword arguments, configuration file or environment variables. |
|
Load a configuration object from a TOML formatted file. |
|
Parse a value stored in an environment variable. |
|
Saves a configuration to a TOML file. |
Updates the current configuration object from data stored in environment variables. |
Classes¶
Exception used for configuration errors |
Contents
[api]
Downloads