coconut icon indicating copy to clipboard operation
coconut copied to clipboard

Feature: native `yaml` blocks with expressions for values

Open JacobFV opened this issue 2 years ago • 0 comments

A lot of config information doesn't justify a full blown class, but Python dicts can be hard on my eyes and right pinky because arbitrary keys must be enclosed in string quote marks. Can coconut support native yaml blocks? And can it also support using Coconut statements in the yaml object value slots?

Native yaml support might work like so:

import wandb

yaml wandb.config:
  lr: 1.0
  epochs: 34
  dense_hparams:
    k1: v1
    k2: v2
    layer_sizes:
    - 256
    - 100
    - 10
  lstm_hparams: ...
  default_activation: CustomFunction(...) # this is a Python object

Why not just load yaml from an inline string or separate file? Sometimes its more convenient to write Coconut instead of a messy nest of yaml dicts and lists; other times, yaml is cleaner and faster

JacobFV avatar May 25 '22 22:05 JacobFV