Skip to main content

tomcli

builds.sr.ht status

copr build status (gotmax23/tomcli)

copr build status (gotmax23/tomcli-dev)

CLI for working with TOML files. Pronounced "tom clee."

Links

Examples

tomcli get

Query TOML files

Print a TOML table:

$ tomcli get pyproject.toml build-system
[build-system]
requires = ["flit_core >=3.2,<4"]
build-backend = "flit_core.buildapi"

Get a newline-separated list of strings:

$ tomcli get pyproject.toml --formatter newline-list project.dependencies
click
importlib_metadata; python_version<'3.11'

List all available formatters for use with tomcli get -F / tomcli get --formatter:

$ tomcli-formatters
default
        Use the `toml` formatter if the object is a Mapping and fall back to
        `string`.

json
        Return the JSON representation of the object

newline-keys
        Return a newline-separated list of Mapping keys

newline-list
        Return a newline separated list

newline-values
        Return a newline-separated list of Mapping values

string
        Print the Python str() representation of the object

toml
        Return the TOML mapping of the object

tomcli set

Modify TOML files

Delete a TOML value:

$ tomcli set pyproject.toml del 'project.dependencies'

Set a value to true or false:

$ tomcli set pyproject.toml true 'tool.mypy.check_untyped_defs'
$ tomcli set pyproject.toml false 'tool.mypy.check_untyped_defs'

Set a float or int value:

$ tomcli set pyproject.toml float 'tool.coverage.run.fail_under' '90.0'
$ tomcli set pyproject.toml int 'tool.coverage.run.fail_under' '90'

Set a string value:

$ tomcli set pyproject.toml str 'project.readme' 'README.rst'

tomcli get arrays

Modify arrays within a TOML file

Remove all values that match a Python regex:

NOTE: The regex must match the entire string

$ tomcli set pyproject.toml arrays delitem \
    'project.classifiers' 'Programming Language :: Python.*'

Remove all values that match an fnmatch-style pattern:

$ tomcli set pyproject.toml arrays delitem --type fnmatch \
    'project.optional-dependencies.dev' '*cov*'

Replace values that match a Python regex:

NOTE: The regex must match the entire string

$ tomcli set pyproject.toml arrays replace \
    'project.optional-dependencies.test' '(.+)==(.+)' '\1>=\2'

Create a list of strings:

## Create the new file
$ touch plays.toml
## Automatically creates the "Romeo and Juliet" table
$ tomcli set plays.toml arrays str \
    '"Romeo and Juliet".characters' 'Romeo' 'Juliet' 'Mercuitio' 'Nurse'

Contributing

See CONTRIBUTING.md.

License

This repository is licensed under

SPDX-License-Identifer: MIT

Release files for tomcli 0.10.1

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

Source distribution (sdist)

Source distribution for tomcli 0.10.1
File Size Uploaded
tomcli-0.10.1.tar.gz 36.1 kB Details

Built distribution (wheel)

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

Total release size: 57.1 kB

Release files / tomcli-0.10.1.tar.gz

Download URL tomcli-0.10.1.tar.gz
Size 36.1 kB
Tags Source
SHA-256 checksum
How to use checksums
0a27c685620b10a0f389b1d55dc66ea904054b178176d41440de55d296e1109d
BLAKE2b-256 checksum
How to use checksums
27ded8dcb1700bc8339b93f2efd3b6ba1c0e990262ae2da51516424e2453e466
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.5

Release files / tomcli-0.10.1-py3-none-any.whl

Download URL tomcli-0.10.1-py3-none-any.whl
Size 21.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c6cb59a795544b291d001faa452039b10cc37f4395d168b16c79d1ec13b64bfc
BLAKE2b-256 checksum
How to use checksums
37c6d1316f907207ea3a5081175c37d04a7ebbe343247b73e213dc96fb2cb26f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.5

Release history Release notifications | RSS feed

This release

0.10.1 This release

2 release files

0.9.0

2 release files

0.8.0

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.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