toml-adapt - Man Page

adapt/manipulate toml files

Synopsis

toml-adapt [--help] [-path TEXT] [-path TEXT] [-dep TEXT] [-ver TEXT]

Description

Working with TOML files is becoming inevitable during the package maintenance process in different ecosystems. Many times package maintainers must either change the version of dependency or add/remove dependencies when building their packages, due to the inconsistent base system. For example, solving this issue can be done either by using the provided patches or using sed commands. However, this may be slightly time-consuming and irritating. A very simple yet user-friendly command line interface was developed in order to make this process easier.

Features

CLI currently supports the following operations:

  • adding/removing dependencies
  • changing the  dependency version
  • changing the dependency versions of all packages concurrently
  • adding/removing/changing dev dependencies

Supported Packaging Tools

The following packaging tools are currently supported by this software:

  • poetry
  • flit
  • cargo
  • julia (partly)

Options

--help

Show a help message and exit.

-path TEXT

Specifies the path to the TOML file you wish to edit. [required]

-a TEXT

Action. Any of the following: add, remove, change, add-dev, remove-dev, change-dev. [required]

-dep TEXT

This option sets the name of dependency you wish to manipulate. Reserved keyword ALL will instead do action on all dependencies. [required]

-ver TEXT

This option sets the version. With Python Poetry, there is reserved keyword X, which will become * (meaning it accepts any version of dependency).

Examples

Change dependency
toml-adapt -path pyproject.toml -a change -dep niaclass -ver 0.1.0
Add dependency
toml-adapt -path pyproject.toml -a add -dep niaclass -ver 0.1.0
Remove dependency
toml-adapt -path pyproject.toml -a remove -dep niaclass -ver 0.1.0

Other Examples

Change all existing dependencies in toml file
toml-adapt -path pyproject.toml -a change -dep ALL -ver X

X represents a *

How to Use It in Spec Files?

%prep
...
# Make dependencies consistent with Fedora dependencies
toml-adapt -path pyproject.toml -a change -dep ALL -ver X

Info

November 2023