Toml sorting library
Project description
toml-sort
A command line utility to sort and format your toml files. Requires Python 3.6 or greater.
Installation
pip install toml-sort
Motivation
This library strives to sort TOML files by providing the following features:
- Preserve inline comments and top-level comments, when possible
- Sort tables / arrays of Tables
- Option to sort table keys, or not
- Standardize whitespace and indentation
I wrote this library because I couldn't find any "good" sorting utilities for TOML files.
Usage
This project can be used as either a command line utility or a Python library.
Command line interface
Read from stdin, write to stdout:
cat input.toml | toml-sort
Read from file on disk, write to file on disk:
toml-sort -o output.toml input.toml
Read from file on disk, write to stdout
toml-sort input.toml
Read from stdin, write to file on disk
cat input.toml | toml-sort -o output.toml
Sort all keys, not just top-level / table keys
cat input.toml | toml-sort -a
Local Development
Local development for this project is quite simple.
Dependencies
Install the following tools manually.
Recommended
Set up development environment
make setup
Run Tests
make test
Written by
Samuel Roeca samuel.roeca@gmail.com
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for toml_sort-0.12.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d88262bc5204aedb0c2c8385e368a2c885472a08fcf7c2439fe0f5fec943adef |
|
MD5 | 93b0cdcfc252b105baedc37890d2225b |
|
BLAKE2b-256 | e7d049e12c4f569f5a90b7ac5d8e5db42904c3e61d3e0b0193546b76ba10a86d |