schrodinger.utils.featureflags.featureflags module

schrodinger.utils.featureflags.featureflags.get_features() Tuple[Set[str], Set[str], Dict[str, Dict[str, str]]]

Get the feature flags from site and user state files. If SCHRODINGER_FEATURE_FLAGS is set, its values are included with the user state.


sets of feature flag names from site and user state file, and combined_flags as a dict of of feature flag name and additional attributes as dict. The final state of the feature flag and source used to decide would be evaluated by the caller.

schrodinger.utils.featureflags.featureflags.set_features(features, desired_state)

Enable or Disable the given features.

This also report the given features which are not present in the default state file.


features (list or set) – List of features to enable or disable in the user state file.


tuple(int, features)


(number of features changed, list of unknown features)


ValueError – if json document cannot be parsed.


Convert the feature state from integer to a string.


state (int) – Feature state in integer format.




0 => Disabled, 1 => Enabled, -1 => None


If there are conflicting env var settings, return a string with the description. Otherwise, return None.

Rtype str or None


Return boolean whether SCHRODINGER_FEATURE_FLAGS is set or not

schrodinger.utils.featureflags.featureflags.site_state_is_hidden() bool

Return whether the environment points to hiding the site state file.


Show all available features based on accessibility from site state file or user state file + flags specified with SCHRODINGER_FEATURE_FLAGS when search string is not specified. If search string is given, feature matching the search string will be shown. Otherwise feature whose description match the search string is shown only when state file is accessible.

The function will list the output in following format:

<feature_name> : <Enabled|Disabled>
    <Description if available>
    <User State>    : <Enabled|Disabled|None>
    <Default State> : <Enabled|Disabled>

search_string (str) – Optional search string.

schrodinger.utils.featureflags.featureflags.get_nondefault_features() str

Return a string usable as the SCHRODINGER_FEATURE_FLAGS environment variable that includes any non-default settings in either the user settings or site settings, and any user settings that restore non-default site settings to their defaults.

Returns “0” if there are no non-default settings.

schrodinger.utils.featureflags.featureflags.get_site_nondefaults() Set[str]

Return the nondefault feature flags in the site state file.

schrodinger.utils.featureflags.featureflags.get_user_feature_env(feature_const: int, enable: bool = True)

Enable a feature flag and return dict with custom feature flags.

  • feature_const (int) – Feature to be enabled/disabled

  • enable (bool) – If True enable, if False disable


ValueError – If feature is unknown

Return type



Dict with key SCHRODINGER_FEATURE_FLAGS and all the custom flags as value


Setup code for argument parsing

Params argv

Arguments to parse.

schrodinger.utils.featureflags.featureflags.get_fflags_env_to_export(enable_flags: Set[str], disable_flags: Set[str], unknown_flags: List[str]) str

Returns a new value for SCHRODINGER_FEATURE_FLAGS that needs to be exported to pick up changes in the feature flags provided in the enable or disable arguments.

If the environment variable is not already set or there is no modification required, this returns None.

  1. We don’t clean the existing environment value and just extend the flags to enable or disable. So, if something is newly enabled, but disabled in the environment variable it will result in something like -FEATURE+FEATURE, which evaluates as enabled.

  2. If SCHRODINGER_FEATURE_FLAGS is set to 0 to ignore initially, we assume the value needs to be modified to accept user’s request to enable or disable feature flag.

  • enable_flags – feature flags to enable.

  • disable_flags – feature flags to disable.

  • unknown_flags – unknown feature flags categorized from enable_flags or disable_flags identified from user’s request to enable or disable.


new value to export for SCHRODINGER_FEATURE_FLAGS or None.