uniqc.config module

Project-wide configuration and platform credentials helpers.

This module is the canonical source of truth for CONFIG_FILE and all configuration management functions (load_config, save_config, get_active_profile, …). uniqc.backend_adapter.config re-exports from here so that patching uniqc.config.CONFIG_FILE propagates to every import path.

All credentials and cache settings are persisted in ~/.uniqc/config.yaml.

Example configuration structure:

always_ai_hints: false
active_profile: default
default:
  originq:
    token: xxx
  quafu:
    token: xxx
  quark:
    QUARK_API_KEY: xxx
  ibm:
    token: xxx
    proxy:
      http: http://proxy:8080
      https: https://proxy:8080
uniqc.config.create_default_config(config_path=None)[source]
Parameters:

config_path (str | Path | None)

Return type:

None

uniqc.config.get_active_profile(config_path=None)[source]
Parameters:

config_path (str | Path | None)

Return type:

str

uniqc.config.get_always_ai_hints(config_path=None)[source]
Parameters:

config_path (str | Path | None)

Return type:

bool

uniqc.config.get_ibm_config(profile=None)[source]
Parameters:

profile (str | None)

Return type:

dict[str, Any]

uniqc.config.get_originq_config(profile=None)[source]
Parameters:

profile (str | None)

Return type:

dict[str, Any]

uniqc.config.get_platform_config(platform_name, profile='default', config_path=None)[source]
Parameters:
  • platform_name (str)

  • profile (str)

  • config_path (str | Path | None)

Return type:

dict[str, Any]

uniqc.config.get_quafu_config(profile=None)[source]
Parameters:

profile (str | None)

Return type:

dict[str, Any]

uniqc.config.get_quark_config(profile=None)[source]
Parameters:

profile (str | None)

Return type:

dict[str, Any]

uniqc.config.has_platform_credentials(platform)[source]

Check whether credentials exist for a platform without raising.

Returns True if the platform section exists in the active profile and contains a non-empty token/key field. Returns False otherwise (including when the config file does not exist or the platform is not configured at all).

Parameters:

platform (str)

Return type:

bool

uniqc.config.load_config(config_path=None)[source]
Parameters:

config_path (str | Path | None)

Return type:

dict[str, Any]

uniqc.config.load_dummy_config()[source]
Return type:

dict[str, Any]

uniqc.config.load_ibm_config()[source]
Return type:

dict[str, Any]

uniqc.config.load_originq_config()[source]
Return type:

dict[str, Any]

uniqc.config.load_quafu_config()[source]
Return type:

dict[str, Any]

uniqc.config.load_quark_config()[source]
Return type:

dict[str, Any]

uniqc.config.save_config(config, config_path=None)[source]
Parameters:
Return type:

None

uniqc.config.set_active_profile(profile, config_path=None)[source]
Parameters:
Return type:

None

uniqc.config.set_always_ai_hints(enabled, config_path=None)[source]
Parameters:
Return type:

None

uniqc.config.update_platform_config(platform_name, platform_config, profile='default', config_path=None)[source]
Parameters:
Return type:

None

uniqc.config.validate_config(config=None, config_path=None)[source]
Parameters:
Return type:

list[str]