or run

tessl search
Log in

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/yacs@0.1.x
tile.json

tessl/pypi-yacs

tessl install tessl/pypi-yacs@0.1.0

A lightweight library for defining and managing system configurations for scientific experimentation.

Agent Success

Agent success rate when using this tile

97%

Improvement

Agent success rate improvement when using this tile compared to baseline

1.05x

Baseline

Agent success rate without this tile

92%

task.mdevals/scenario-1/

Configuration File Loader

Build a utility that loads and merges configuration settings from external files into a configuration object. The utility should handle both YAML and Python configuration files and properly compose configurations from multiple sources.

Requirements

Your implementation should:

  1. Create a base configuration with default values for a machine learning training pipeline
  2. Load and merge configuration values from YAML files
  3. Load and merge configuration values from Python files
  4. Maintain proper type handling during the merge process

Base Configuration Structure

The base configuration should include:

  • MODEL section with TYPE (string) and NUM_LAYERS (integer)
  • TRAIN section with LEARNING_RATE (float), BATCH_SIZE (integer), and EPOCHS (integer)
  • DATA section with PATH (string) and AUGMENT (boolean)

Test Cases

  • Loading a YAML file that overrides MODEL.TYPE to "resnet50" updates the configuration correctly @test
  • Loading a Python file that sets TRAIN.LEARNING_RATE to 0.001 updates the configuration correctly @test
  • Merging from multiple files in sequence applies all changes in order @test
  • Attempting to merge from a non-existent file handles the error appropriately @test

Implementation

@generates

API

def create_base_config():
    """
    Creates and returns the base configuration with default values.

    Returns:
        A configuration object with default settings for MODEL, TRAIN, and DATA sections
    """
    pass

def merge_from_file(config, filepath):
    """
    Loads configuration from a YAML or Python file and merges it into the provided config.

    Args:
        config: The configuration object to merge into
        filepath: Path to the YAML (.yaml, .yml) or Python (.py) file

    Returns:
        The updated configuration object

    Raises:
        FileNotFoundError: If the file does not exist
    """
    pass

def get_value(config, key_path):
    """
    Retrieves a configuration value using dot notation.

    Args:
        config: The configuration object
        key_path: Dot-separated path to the value (e.g., "MODEL.TYPE" or "TRAIN.LEARNING_RATE")

    Returns:
        The value at the specified path
    """
    pass

Dependencies { .dependencies }

yacs { .dependency }

Provides configuration management with file merging capabilities.

yacs==0.1.8