Skip to main content

Flexible YAML loader.

Project description

Flexy – Flexible YAML Loader

Flexy provides lightweight and flexible YAML configs to applications.

Flexy is listed on PyPI.

I created this library in the despair of the fact that YAML's powerful features (explicit typing, anchors, aliases, etc.) are in fact of little use to me, as well as in the belief that simple is better than complex.

Hope it makes your life easier too.

Lightweight

Flexy ONLY supports Python built-in types: dict, list, str, int, float, bool. Flexy also guarantees that only these types are returned.

Flexible: file inclusion

Flexy supports non-intrusive file inclusion. Including entries are written in a special format in comments, very similar to C/C++ header inclusion.

conf: value
...
#include <parallel-conf.yaml>
#include <../another-config.yaml>
#include <~/.config/conf-in-my-home.yml>
#include </absolute/path/to/config.yml>
...

Inclusions are expanded as semantic-blind plain texts before sending them to YAML parser.

Flexible: variable substitutions

Flexy supports variable substitution with the great power of revo (PyPI).

Emacs yaml-mode hacks

Sample configs: contrib/yaml-mode-hack.el

(require 'yaml-mode)

(defun yaml-extra-highlights ()
  (font-lock-add-keywords 'yaml-mode
   '(;; included files
     ("^\\s-*\\(#\\s-*include\\)\\s-+\\(<[^>]*>\\)"
      (1 font-lock-preprocessor-face prepend)
      (2 font-lock-doc-face prepend))
     ;; variable dollar sign
     ("\\(\\$\\)(" 1 font-lock-keyword-face prepend)
     ;; variable name
     ("\\$(\\([^)$]+\\))" 1 font-lock-function-name-face prepend))))

(add-hook 'yaml-mode-hook 'yaml-extra-highlights)

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

flexy-0.1.1-py3-none-any.whl (3.5 kB view hashes)

Uploaded Python 3

Supported by

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