Skip to main content

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)

Metadata

Release files for flexy 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for flexy 0.1.1
File Interpreter ABI Platform
flexy-0.1.1-py3-none-any.whl Python 3 none any Details

Release files / flexy-0.1.1-py3-none-any.whl

Download URL flexy-0.1.1-py3-none-any.whl
Size 3.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5bf40d1cc703a2c8568ca4123082b80283e2c18fe144f60e98edab756a18f1b3
BLAKE2b-256 checksum
How to use checksums
5e97a634ce6762a565e1b38060aafc5d2802a03ffe90ca760f0b966af7b3043b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.10

Security for flexy 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page