A PyPI packaging repository for yamlfmt, making it easily accessible to the Python ecosystem.
This repository provides a Python package wrapper for Google's yamlfmt
tool, enabling seamless integration with Python package managers and development workflows. The original yamlfmt
is a powerful YAML formatter written in Go, and this package makes it available through PyPI for easier installation and use in Python projects.
- Easy Installation: Install via pip or any Python package manager
- Python Ecosystem Integration: Works seamlessly with Python development workflows
- Pre-commit Support: Perfect for use with pre-commit hooks
- Cross-platform: Available on all platforms supported by the original yamlfmt
To install google-yamlfmt, ensure you have Python 3.9 or higher, then run:
pip install google-yamlfmt
After installation, you can format YAML files using the yamlfmt
command:
yamlfmt <file_or_directory>
Examples:
# Format a single file
yamlfmt example.yaml
# Format multiple files
yamlfmt file1.yaml file2.yaml
# Format all YAML files in current directory
yamlfmt *.yaml
# Check if files need formatting (lint mode)
yamlfmt -lint example.yaml
For more advanced usage options and configuration, please refer to the original documentation or run yamlfmt -h
.
To use with pre-commit, add this to your .pre-commit-config.yaml
:
repos:
- repo: https://github.com/PFCCLab/yamlfmt-pre-commit-mirror.git
rev: v0.17.2
hooks:
- id: yamlfmt
This package is a redistribution of the original yamlfmt tool created by Google. All credit for the core functionality goes to the original maintainers. This packaging effort aims to make the tool more accessible to Python developers and integrate better with Python-based development workflows.
Contributions are welcome! Please feel free to submit issues or pull requests to help improve this packaging and distribution effort.