Configuration API
Public API for configuration operations.
- pstrain.api.config.generate_markdown_docs()[source]
Generate Markdown documentation for all config parameters.
- Returns:
Markdown string suitable for docs
- Return type:
- pstrain.api.config.generate_rst_docs()[source]
Generate reStructuredText documentation for all config parameters.
- Returns:
RST string suitable for Sphinx docs
- Return type:
- pstrain.api.config.get_user_config(config_file=None, force_reload=False)[source]
Get user configuration instance with caching.
- pstrain.api.config.list_parameters(prefix='')[source]
List all configuration parameters with descriptions.
- pstrain.api.config.list_profiles(project_dir)[source]
List profiles through a concrete public-API call frame.
- pstrain.api.config.migrate_project(project_dir, *, check)[source]
Render or atomically write the canonical profiles document.
- pstrain.api.config.resolve_config(project_dir, *, profile_name='default', experiment='default', cli_overrides=None, user_config_path=None)[source]
Resolve built-in < user < project < experiment < CLI.
- pstrain.api.config.CURRENT_CONFIG_VERSION
Current version number for the canonical configuration schema.
User settings
~/.pstrain/config.yaml holds both semantic overrides and presentation
preferences. PSTRAIN_USER_CONFIG selects an alternate file for both readers.
For example:
config_version: 1
features:
alpha: 0.9
training:
tied:
max_iterations: 7
json_output:
indent: 4
get_user_config().save() preserves the semantic blocks while saving changed
preferences. It validates the document and replaces the file atomically;
omitted semantic blocks remain omitted, so saving preferences does not freeze
unrelated defaults. Project and experiment overlays accept semantic settings
only. Unknown fields in a versioned user document are errors.
The legacy defaults block remains readable for compatibility but is not a
training override. Use features, training, split, runner,
sharding, and alignment for effective settings. Saving a legacy document
writes version 1 and preserves the legacy fields that the resolver actually
consumed, such as features.num_ceps as features.ncep.
Exclusion schedules accept positive pass numbers or "*". Numeric strings
are normalized to integer pass numbers; aliases for the same pass in one
schedule are rejected rather than silently overwriting an exclusion list.