Skip to main content
Build Status Read the Docs CII Best Practices Code Coverage Status
Version License Python versions dev status pypi monthly downloads

yaml4rst is a linting/checking/reformatting tool for YAML files documented with inline RST which goes hand in hand with yaml2rst.

It has been written to help with keeping the defaults/main.yml file in Ansible roles of DebOps up-to-date and to assist with writing or including new roles. DebOps uses Sphinx to generate Ansible role documentation which also includes the default role variables. Refer to debops/docs for details.

Usage

The typical use case for this program is to improve the defaults YAML file of Ansible roles.

The recommended way to do this is to commit all your changes in the repository of the role, then run:

yaml4rst -e 'ansible_full_role_name=ROLE_OWNER.ROLE_NAME' defaults/main.yml -i

from the root of the role repository. Be sure to replace ROLE_OWNER.ROLE_NAME with the particular Ansible role name.

This will check and reformat the defaults/main.yml file in place.

Now you can check the reformatted file with a diffing/editing tool of your choosing and fix any warning which yaml4rst might have emitted.

Refer to input_files and output_files in the tests directory for automatically tested examples of input and output files.

Note that for continues usage yaml4rst is invoked from debops-optimize when yaml4rst is installed so you might want to try debops-optimize.

Features

Checks for:

  • Reasonable variable namespace

  • Undocumented variables

Automatically fixes:

  • RST sections which are not folds

  • Undocumented variables (adds a FIXME for the user)

  • Documented variables which are not folds

  • YAML documents without a defined header

  • Spacing between variables and sections

Known limitations

  • Does not handle folds with implicit level and missing closing fold marker.

    Status: Should be doable but currently not needed nor implemented. A NotImplementedError exception is thrown which causes the CLI program to terminate immediately with an error and reference to this section.

    As workaround just strip out the opening folds with your favorite editor as yaml4rst will add missing folds for sections and variables anyway. Refer to the Makefile (prepare-real-data target) where such a workaround is used for integration testing. Note that this is not perfect as can be seen on the debops.apt_install test case.

Repository

  • GitHub (primary repo with issue tracker)

Documentation

Authors

License

GNU Affero General Public License v3 (AGPL-3.0)

Release files for yaml4rst 0.1.6

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

Source distribution (sdist)

Source distribution for yaml4rst 0.1.6
File Size Uploaded
yaml4rst-0.1.6.tar.gz 135.4 kB Details

Built distribution (wheel)

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

Total release size: 154.3 kB

Release files / yaml4rst-0.1.6.tar.gz

Download URL yaml4rst-0.1.6.tar.gz
Size 135.4 kB
Tags Source
SHA-256 checksum
How to use checksums
98cbcf2089ea2e1941de5d3226641f2c17b1201f1f811fcbfe97d03323824215
BLAKE2b-256 checksum
How to use checksums
eded8dc0452d26096ddf80f96383acb8fd18a523df96735660be8c9e91aeb693
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / yaml4rst-0.1.6-py3-none-any.whl

Download URL yaml4rst-0.1.6-py3-none-any.whl
Size 19.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5b7759101e87f3e51f16ea4ca721a3517b13dff890bb6e930252b69b745b6ea5
BLAKE2b-256 checksum
How to use checksums
f56a5774cf9f1c33d8fa17aa6605487044045c4078587abe690a8d7eadc2d39f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1.6 This release

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

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