pyworkflow.config module

class pyworkflow.config.Config[source]

Bases: object

Main Config for pyworkflow. It contains the main Scipion configuration variables providing default values or, if present, taking them from the environment. Necessary value is SCIPION_HOME and has to be present in the environment

CONDA_ACTIVATION_CMD = ''

Command to activate/initialize conda itself. Do not confuse it with ‘conda activate’. It should be defined at installation time. It looks like this: eval “$(/extra/miniconda3/bin/conda shell.bash hook)”

Type

str

NO_COLOR = ''

Comply with https://no-color.org/ initiative. Set it to something different than ‘’ to deactivate colors in the output.

Type

str

class Root(root)[source]

Bases: object

Simple helper to return path from a root.

join(*path)[source]
SCIPION_BG_COLOR = 'white'

Main background color of the GUI. Default is white, chose a light one. Probably any name here will work: https://matplotlib.org/stable/gallery/color/named_colors.html

Type

str

SCIPION_CANCEL_FASTCOPY = False

Cancel fast copy done by shutil (copying files) when it fails. Has happened in GPFS environments. Defaults to False. None is also False otherwise fastcopy is cancelled.

SCIPION_CONFIG = 'scipion.conf'

Path to the scipion configuration file where all this variables could be defined.

SCIPION_CWD = '/tmp/tmp52b0_c4h/e4b95f5eaf0cfcbafd3a326b1eeca29444e2806c'

Directory when scipion was launched

SCIPION_DEFAULT_EXECUTION_ACTION = 1

Ask if you want to launch a single protocol or a sub-workflow. The default value is 1 1: Scipion always ask 2: Run a single protocol 3: Run a sub-workflow

SCIPION_DOMAIN = None
SCIPION_FONT_NAME = 'Helvetica'

Name of the font to use in Scipion GUI. Defaults to Helvetica.

SCIPION_FONT_SIZE = 10

Size of the ‘normal’ font to be used in Scipion GUI. Defaults to 10.

SCIPION_GUI_CANCEL_AUTO_REFRESH = False

Set it to True to cancel automatic refresh of the runs.

SCIPION_GUI_REFRESH_INITIAL_WAIT = 5

Seconds to wait after a manual refresh

SCIPION_GUI_REFRESH_IN_THREAD = False

True to refresh the runs graph with a thread. Unstable.

SCIPION_HOME = '/home/buildbot/devel/scipion'

Path where Scipion is installed. Other paths are based on this like SCIPION_SOFTWARE, SCIPION_TESTS,… unless specified

SCIPION_HOME_DEFINED = '/home/buildbot/devel/scipion'

False if SCIPION_HOME is not found in the environment

SCIPION_HOSTS = 'hosts.conf'

Path to the host.cof file to allow scipion to use queue engines and run in HPC environments.

SCIPION_ICON_ZOOM = 50

Define it to anything else except False to show the label of the icons. It will take more space.

SCIPION_LOCAL_CONFIG = '/home/buildbot/.config/scipion/scipion_devel.conf'

Path to an optional/extra/user configuration file meant to overwrite default variables.

SCIPION_LOG = '/home/buildbot/ScipionUserData/logs/scipion.log'

Path to the file where scipion will write GUI logging messages. Defaults to SCIPION_LOGS/scipion.log

SCIPION_LOGS = '/home/buildbot/ScipionUserData/logs'

Path for Scipion logs folder used by the GUI. Defaults to SCIPION_USER_DATA/logs.

SCIPION_LOG_CONFIG = None

Optional. Path to a python logging configuration file fine tune the logging.

SCIPION_LOG_FORMAT = '%(message)s'

Format for all the log lines, defaults to %(message)s. To compose the format see https://docs.python.org/3/library/logging.html#logrecord-attributes

Type

str

SCIPION_LOG_LEVEL = 'INFO'

Default logging level. String among CRITICAL, ERROR, WARNING, INFO, DEBUG, NOTSET. Default value is INFO.

SCIPION_MAIN_COLOR = 'Firebrick'

Main color of the GUI. Background will be white, so for better contrast choose a dark color. Probably any name here will work: https://matplotlib.org/stable/gallery/color/named_colors.html

Type

str

SCIPION_NOTES_ARGS = None
SCIPION_NOTES_FILE = 'notes.txt'

Name of the file where to write per project notes.

SCIPION_NOTES_PROGRAM = None

Command or program to use to open the notes file. Otherwise system will extension association will take place.

SCIPION_NOTIFY = True

If set to False, Scipion developers will know almost nothing about Scipion usage and will have less information to improve it.

SCIPION_PLUGIN_JSON = 'plugins.json'

Optional. Path to get the json file with all the plugins available for Scipion.

SCIPION_PLUGIN_REPO_URL = 'http://scipion.i2pc.es/getplugins/'

Url from where to get the list of plugins.

SCIPION_PRIORITY_PACKAGE_LIST = ''
SCIPION_PROTOCOLS = 'protocols.conf'
SCIPION_SCRATCH = None

Optional. Path to a location mounted in a scratch drive (SSD,…)

SCIPION_SHOW_TEXT_IN_TOOLBAR = True

Define it to anything else except False to show the label of the icons. It will take more space.

SCIPION_SOFTWARE = '/home/buildbot/devel/scipion/software'

Path where Scipion will install the software. Defaults to SCIPION_HOME/software.

SCIPION_SPRITES_FILE = '/home/buildbot/devel/scipion/scipion-pyworkflow/pyworkflow/resources/sprites.png'

File (png) with the icons in a collage. Default is found at pyworkflow/resources/sprites.png. And a GIMP file could be found at the same folder in the github repo.

SCIPION_STEPS_CHECK_SEC = 5

Number of seconds to wait before checking if new input is available in streamified protocols.

SCIPION_SUPPORT_EMAIL = 'scipion@cnb.csic.es'
SCIPION_TESTS = '/home/buildbot/devel/scipion/data/tests'

Path where to find/download test data. Defaults to SCIPION_HOME/data/tests.

SCIPION_TESTS_CMD = '/home/buildbot/devel/scipion/scipion-pyworkflow/pyworkflow/apps/pw_run_tests.py'
SCIPION_TESTS_OUTPUT = '/home/buildbot/ScipionUserData/Tests'

Path to a folder Where the output of the tests will be written. Defaults to SCIPION_USER_DATA/Tests.

SCIPION_TEST_NOSYNC = False

Set it to 1, True, Yes or y to cancel test dataset synchronization. Needed when updating files in a dataset.

SCIPION_TMP = '/home/buildbot/ScipionUserData/tmp'

General purpose scipion tmp folder. Defaults to SCIPION_USER_DATA/tmp

SCIPION_UPDATE_SET_ATTEMPTS = 3

Number of attempts to modify the protocol output before failing. The default value is 3

SCIPION_UPDATE_SET_ATTEMPT_WAIT = 2

Time in seconds to wait until the next attempt when checking new outputs. The default value is 2 seconds

SCIPION_URL = 'http://scipion.cnb.csic.es/downloads/scipion'
SCIPION_URL_SOFTWARE = 'http://scipion.cnb.csic.es/downloads/scipion/software'
SCIPION_URL_TESTDATA = 'http://scipion.cnb.csic.es/downloads/scipion/data/tests'
SCIPION_USER_DATA = '/home/buildbot/ScipionUserData'

Path where Scipion projects are or will be created. Defaults to ~/ScipionUserData

SCIPION_USE_QUEUE = False

Default value for using the queue. By default is False. ANY value will be True except and empty value. “False” or “0” will be True too.

VIEWERS = {}
WIZARD_MASK_COLOR = '[0.125, 0.909, 0.972]'

Color to use in some wizards.

classmethod colorsInTerminal()[source]

Returns true if colors are allowed. Based on NO_COLOR variable. Undefined or ‘’ colors are enabled

static debugOn()[source]

Returns a True if debug mode (SCIPION_DEBUG variable) is active

static debugSQLOn()[source]
classmethod getActiveColor()[source]

Returns a color lighter than the SCIPION_MAIN_COLOR

classmethod getBindingsFolder()[source]

Folder where bindings must be placed. This folder is added to sys.path at launching time. If the binding depends on a dynamic libraries, those must be placed at cls.getLibFolder() :return: The bindings folder

classmethod getDomain()[source]

Import domain module from path or name defined in SCIPION_DOMAIN.

classmethod getExternalJsonTemplates()[source]
classmethod getLibFolder()[source]
Returns

Folder where libraries must be placed in case a binding needs them

classmethod getLogsFolder()[source]

Folder where scipion logs must be placed. The folder is created

classmethod getPriorityPackageList()[source]
static getPythonLibFolder()[source]
classmethod getStepsCheckSeconds()[source]
classmethod getUpdateSetAttempts()[source]
classmethod getUpdateSetAttemptsWait()[source]
classmethod getVars()[source]

Return a dictionary with all variables defined in this Config.

classmethod getWizardMaskColor()[source]
classmethod isScipionRunning()[source]

Returns true if this execution is understood to be running Scipion. In some case, documentation inspection by sphynx or when packaging a plugin using setup.py this code could be reached but is not an actual execution. This is useful for cancelling some actions like registering FileHandlers or other stuff not needed when just importing modules.

classmethod printVars()[source]

Print the variables’ dict, mostly for debugging.

classmethod refreshInThreads()[source]
classmethod setDomain(moduleOrNameOrPath)[source]
static toggleDebug()[source]
static toggleDebugSQL()[source]
class pyworkflow.config.VarTypes(value)[source]

Bases: Enum

An enumeration.

BOOLEAN = 3
INTEGER = 2
PATH = 4
STRING = 1
class pyworkflow.config.Variable(value, varType: VarTypes = VarTypes.STRING)[source]

Bases: object

Class for variables of the Config class.

Parameters
  • value – Value of the variable

  • type – Type of the variable

pyworkflow.config.findResource(filename)[source]
pyworkflow.config.genNotesHeading()[source]
pyworkflow.config.getAppsPath(*paths)[source]
pyworkflow.config.getModuleFolder(moduleName)[source]

Returns the path of a module without importing it

pyworkflow.config.getPyworkflowPath()[source]

Returns the path where pyworkflow is

pyworkflow.config.getResourcesPath(file=None)[source]
pyworkflow.config.getScheduleScript()[source]
pyworkflow.config.getSyncDataScript()[source]
pyworkflow.config.getTestsScript()[source]
pyworkflow.config.getViewerScript()[source]
pyworkflow.config.join(*paths)[source]

join paths from HOME .