This module represents OctoPrint’s settings management. Within this module the default settings for the core application are defined and the instance of the Settings is held, which offers getter and setter methods for the raw configuration values as well as various convenience methods to access the paths to base folders of various types and the configuration file itself.

octoprint.settings.default_settings = dict(...)

The default settings of the core application.

octoprint.settings.valid_boolean_trues = [True, 'true', 'yes', 'y', '1']

Values that are considered to be equivalent to the boolean True value, used for type conversion in various places.

octoprint.settings.settings(init=False, basedir=None, configfile=None)

Factory method for initially constructing and consecutively retrieving the Settings singleton.

  • init (boolean) – A flag indicating whether this is the initial call to construct the singleton (True) or not (False, default). If this is set to True and the plugin manager has already been initialized, a ValueError will be raised. The same will happen if the plugin manager has not yet been initialized and this is set to False.
  • basedir (str) – Path of the base directory for all of OctoPrint’s settings, log files, uploads etc. If not set the default will be used: ~/.octoprint on Linux, %APPDATA%/OctoPrint on Windows and ~/Library/Application Support/OctoPrint on MacOS.
  • configfile (str) – Path of the configuration file (config.yaml) to work on. If not set the default will be used: <basedir>/config.yaml for basedir as defined above.

The fully initialized Settings instance.

Return type:



ValueErrorinit is True but settings are already initialized or vice versa.

class octoprint.settings.Settings(configfile=None, basedir=None)

The Settings class allows managing all of OctoPrint’s settings. It takes care of initializing the settings directory, loading the configuration from config.yaml, persisting changes to disk etc and provides access methods for getting and setting specific values from the overall settings structure via paths.

A general word on the concept of paths, since they play an important role in OctoPrint’s settings management. A path is basically a list or tuple consisting of keys to follow down into the settings (which are basically like a dict) in order to set or retrieve a specific value (or more than one). For example, for a settings structure like the following:

    port: "/dev/ttyACM0"
    baudrate: 250000
        communication: 20.0
        temperature: 5.0
        sdStatus: 1.0
        connection: 10.0
    host: ""
    port: 5000

the following paths could be used:

Path Value
["serial", "port"]
["serial", "timeout"]
communication: 20.0
temperature: 5.0
sdStatus: 1.0
connection: 10.0
["serial", "timeout", "temperature"]
["server", "port"]

However, these would be invalid paths: ["key"], ["serial", "port", "value"], ["server", "host", 3].

add_overlay(overlay, at_end=False)
backup(suffix, path=None)
get(path, **kwargs)
getBaseFolder(type, create=True)
getBoolean(path, **kwargs)
getFloat(path, **kwargs)
getInt(path, **kwargs)
has(path, **kwargs)
Returns:The last modification time of the configuration file.
Return type:int
loadScript(script_type, name, context=None, source=False)
load_overlay(overlay, migrate=True)
remove(path, config=None, error_on_path=False)
saveScript(script_type, name, script)
set(path, value, force=False, defaults=None, config=None, preprocessors=None, error_on_path=False)
setBaseFolder(type, path, force=False)
setBoolean(path, value, **kwargs)
setFloat(path, value, **kwargs)
setInt(path, value, **kwargs)