Python scripts and sample data for the YAML: The Missing Battery in Python tutorial on Real Python.
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.txtAdditionally, you can install optional dependencies that were mentioned in the tutorial:
(venv) $ python -m pip install yamllint yq shyamlPrint a sample YAML document with syntax highlighting:
$ cat data.yaml | python colorize.pyPrint a static HTML preview of a sample YAML document:
$ cat data.yaml | python yaml2html.pyPrint an interactive HTML preview of a sample YAML document:
$ cat data.yaml | python tree.pyStart an interactive demo of a YAML formatter at http://localhost:8000/:
$ cd formatter/
$ uvicorn server:app