Skip to content

Nested variable behavior change from 0.4.3 to 1.0.0 #103

Description

@nrodnova

The following project.yml works in weasel 0.4.3 and doesn't in weasel 1.0.0:

title: "Testing nested variables"

vars :
  vars-level-1:
    var-1-1: "var-1-1"
    var-1-2: "prefix-${vars.vars-level-1.var-1-1}-suffix"


commands :
  - name : test
    help : "Testing nested vars"
    script :
      - echo "Hello ${vars.vars-level-1.var-1-2}"

My friend Claude claims that it's a confection issue.

weasel 0.4.3 (+ confection==0.1.5 ) produces this:

$ python -m weasel run test

==================================== test ====================================
Running command: echo 'Hello prefix-var-1-1-suffix'
Hello prefix-var-1-1-suffix

weasel 1.0.0 (+ confection==1.3.3):

$ python -m weasel run test
╭──────────────────────────────────────────────────────────────────────────────────────────────────────── Traceback (most recent call last) ─────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ .venv/lib/python3.13/site-packages/weasel/cli/run.py:42 in project_run_cli                                                                                                                                │
│                                                                                                                                                                                                                                                    │
│    39 │   │   print_run_help(project_dir, subcommand, parent_command)                                                                                                                                                                              │
│    40 │   else:                                                                                                                                                                                                                                    │
│    41 │   │   overrides = parse_config_overrides(ctx.args)                                                                                                                                                                                         │
│ ❱  42 │   │   project_run(                                                                                                                                                                                                                         │
│    43 │   │   │   project_dir,                                                                                                                                                                                                                     │
│    44 │   │   │   subcommand,                                                                                                                                                                                                                      │
│    45 │   │   │   overrides=overrides,                                                                                                                                                                                                             │
│                                                                                                                                                                                                                                                    │
│ /Users/nrodnova/Projects/eon/monorepo/ds/.venv/lib/python3.13/site-packages/weasel/cli/run.py:81 in project_run                                                                                                                                    │
│                                                                                                                                                                                                                                                    │
│    78 │   skip_requirements_check (bool): No longer used, deprecated.                                                                                                                                                                              │
│    79 │   """                                                                                                                                                                                                                                      │
│    80 │   config = load_project_config(project_dir, overrides=overrides)                                                                                                                                                                           │
│ ❱  81 │   commands = {cmd["name"]: cmd for cmd in config.get("commands", [])}                                                                                                                                                                      │
│    82 │   workflows = config.get("workflows", {})                                                                                                                                                                                                  │
│    83 │   validate_subcommand(list(commands.keys()), list(workflows.keys()), subcommand)                                                                                                                                                           │
│    84                                                                                                                                                                                                                                              │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
TypeError: string indices must be integers, not 'str'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions