sf.store_account

store_account(authentication_token, filename='config.toml', location='user_config', **kwargs)[source]

Configure Strawberry Fields for access to the Xanadu cloud platform by saving your account credentials.

The configuration file can be created in the following locations:

  • A global user configuration directory ("user_config")

  • The current working directory ("local")

This global user configuration directory differs depending on the operating system:

  • On Linux: ~/.config/strawberryfields

  • On Windows: C:\Users\USERNAME\AppData\Local\Xanadu\strawberryfields

  • On MacOS: ~/Library/Application Support/strawberryfields

By default, Strawberry Fields will load the configuration and account credentials from the global user configuration directory, no matter the working directory. However, if there exists a configuration file in the local working directory, this takes precedence. The "local" option is therefore useful for maintaining per-project configuration settings.

Examples:

In these examples "AUTHENTICATION_TOKEN" should be replaced with a valid authentication token.

Access to the Xanadu cloud can be configured as follows:

>>> sf.store_account("AUTHENTICATION_TOKEN")

This creates the following "config.toml" file:

[api]
authentication_token = "AUTHENTICATION_TOKEN"
hostname = "platform.strawberryfields.ai"
use_ssl = true
port = 443

You can also create the configuration file locally (in the current working directory) the following way:

>>> import strawberryfields as sf
>>> sf.store_account("AUTHENTICATION_TOKEN", location="local")

Each of the configuration options can be passed as further keyword arguments as well (see the sf.configuration page for a list of options):

>>> import strawberryfields as sf
>>> sf.store_account("AUTHENTICATION_TOKEN", location="local", hostname="MyHost", use_ssl=False, port=123)

This creates the following "config.toml" file in the current working directory:

[api]
authentication_token = "AUTHENTICATION_TOKEN"
hostname = "MyHost"
use_ssl = false
port = 123
Parameters

authentication_token (str) – API token for authentication to the Xanadu cloud platform. This is required for submitting remote jobs using RemoteEngine.

Keyword Arguments
  • location (str) – determines where the configuration file should be saved

  • filename (str) – the name of the configuration file to look for

Additional configuration options are detailed in sf.configuration and can be passed as keyword arguments.