Skip to main content

Allow variable and expression in YAML file

Project description

yamlx

yaml内で変数や計算式を扱えるようにしたもの

How to install

>> pip install yamlx

How to use

存在しているキーの値を代入したいとき -> ${key1.key2.key3 ...}

計算式を入れたいとき -> 普通に演算子を用いて書いてください(+,-,*,/,%,//,**)が使えます.${...}も使えます.

# example.yaml

train :
  batch_size    : 16
  learning_rate : 0.001
  epochs        : 50

signal : 
  sample_rate : 16000
  hop_size : 256
  n_mels   : 80
  eps      : 1 / 100
  max_len  : ${signal.sample_rate} // ${signal.hop_size}

model :
  input_dim      : 128
  input_channel  : ${signal.n_mels}
  output_channel : 5
>> import yamlx
>> path = "./example.yaml"
>> data = yamlx.load(path)
>> print(data)
>> {'train': {'batch_size': 16, 'learning_rate': 0.001, 'epochs': 50}, 'signal': {'sample_rate': 16000, 'hop_size': 256, 'n_mels': 80, 'eps': 0.01, 'max_len': 62.0}, 'model': {'input_dim': 128, 'input_channel': 80, 'output_channel': 5}}  

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

yamlx-0.0.8.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

yamlx-0.0.8-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file yamlx-0.0.8.tar.gz.

File metadata

  • Download URL: yamlx-0.0.8.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.1

File hashes

Hashes for yamlx-0.0.8.tar.gz
Algorithm Hash digest
SHA256 95884b69a7c35161058615ae5920b2f31ccc62897afe9b3a0ef9422e6f68b3bf
MD5 f55c2163ca10ff6fb52150448e082ee9
BLAKE2b-256 17908c6778e5d2aac6d37f519d08673e38892602b74c45157cda14b41831581e

See more details on using hashes here.

File details

Details for the file yamlx-0.0.8-py3-none-any.whl.

File metadata

  • Download URL: yamlx-0.0.8-py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.1

File hashes

Hashes for yamlx-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 23633a499822616330be6403426166c00ddd9a8af453b04f9aefed53e1a04b82
MD5 5ba316b69cc921285ecfe2591b21d0bf
BLAKE2b-256 e9ef988af576d25978d1f66a1a7193bebc5528d7d7d5481764407e96ae6dac9f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page