Getting started with Yamkix¶
This tutorial walks you through installing yamkix and formatting your first YAML file. At the end, you will know how to run yamkix on a file and read its output.
Step 1: Install yamkix¶
Yamkix is published on pypi.org. Install it as a standalone tool with uv:
Check that it works:
Other installation methods (like mise) are described in the installation how-to guide.
Step 2: Create a YAML file to format¶
Create a file named example.yml with some inconsistently formatted YAML:
Step 3: Format it¶
Run yamkix on the file:
yamkix rewrites the file in place with its opinionated styling rules:
Notice what happened:
- An explicit document start marker (
---) was added. - The extra spaces after
name:were normalized. - Comments (if any) would be preserved, thanks to the default
rt(round-trip) parsing mode.
Step 4: Preview without overwriting¶
If you prefer to review the result before touching the file, send the output to STDOUT:
Where to go next¶
- Learn all the ways to feed files to yamkix in Format files.
- The flow-style list
[blue, green]above was preserved as-is. yamkix can also convert JSON-style collections to block style — see Convert flow style to block style. - Wire yamkix into your workflow with the pre-commit hook or editor integration guides.
- Understand the reasoning behind the default formatting in Formatting rules.