Skip to main content

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:

  • Sort tables and Arrays of Tables (AoT)
  • Option to sort non-tables / non-AoT's, or not
  • Preserve inline comments
  • Option to preserve top-level document comments, 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

Print detailed help

toml-sort --help

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

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

toml-sort-0.13.0.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

toml_sort-0.13.0-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

Details for the file toml-sort-0.13.0.tar.gz.

File metadata

  • Download URL: toml-sort-0.13.0.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/0.12.17 CPython/3.7.4 Linux/4.15.0-55-generic

File hashes

Hashes for toml-sort-0.13.0.tar.gz
Algorithm Hash digest
SHA256 bc13e0a2e0d821ae1a6f7a5d72679e9434ea4a827064fc8ef52d73119917a76b
MD5 5788e9a8c23ac3b3e55f42b15f414402
BLAKE2b-256 36a3c97c817a0d32bfd9dac1a2b1d3078bb492b580bdae90f7558e1b3e57eba6

See more details on using hashes here.

File details

Details for the file toml_sort-0.13.0-py3-none-any.whl.

File metadata

  • Download URL: toml_sort-0.13.0-py3-none-any.whl
  • Upload date:
  • Size: 6.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/0.12.17 CPython/3.7.4 Linux/4.15.0-55-generic

File hashes

Hashes for toml_sort-0.13.0-py3-none-any.whl
Algorithm Hash digest
SHA256 19ac428593ca602e1e98b60fd006cb868df65d9259cd8d620327c5c32cf6dd25
MD5 76c8ea8bda2655dce921503fae8f2ef4
BLAKE2b-256 dfeff8816fada562f4b60c88aee379b1610132b8923f702343178f8f3ca87930

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page