Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

YAML: The Missing Battery in Python

Python scripts and sample data for the YAML: The Missing Battery in Python tutorial on Real Python.

Installation

This code requires the following libraries:

  • PyYAML
  • FastAPI
  • uvicorn

To install them, activate your virtual environment, and type the following command:

(venv) $ python -m pip install -r requirements.txt

Additionally, you can install optional dependencies that were mentioned in the tutorial:

(venv) $ python -m pip install yamllint yq shyaml

Usage

Print a sample YAML document with syntax highlighting:

$ cat data.yaml | python colorize.py

Print a static HTML preview of a sample YAML document:

$ cat data.yaml | python yaml2html.py

Print an interactive HTML preview of a sample YAML document:

$ cat data.yaml | python tree.py

Start an interactive demo of a YAML formatter at http://localhost:8000/:

$ cd formatter/
$ uvicorn server:app