A very simple cli for manipulating toml files.
Project description
toml-adapt --- A simple command-line interface (CLI) for manipulating toml files
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)
Installation
pip3
Install toml-adapt with pip3:
pip3 install toml-adapt
Fedora Linux
To install toml-adapt on Fedora, use:
$ dnf install python-toml-adapt
Alpine Linux
To install toml-adapt on Alpine Linux, please enable Testing repository and use:
$ apk add toml-adapt
Usage
-a
Available actions are:
- add
- remove
- change
- add-dev
- remove-dev
- change-dev
-path
Specifies the path to the TOML file you wish to edit.
-dep
This option sets the name of dependency you wish to manipulate. Reserved keyword ALL
will instead do action on all dependencies.
-ver
This option sets the version. With Python Poetry, there is reserved keyword X
, which will become *
(meaning it accepts any version of dependency).
The following are examples of usage:
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
License
This package is distributed under the MIT License. This license can be found online at http://www.opensource.org/licenses/MIT.
Disclaimer
This framework is provided as-is, and there are no guarantees that it fits your purposes or that it is bug-free. Use it at your own risk!
Contributors ✨
Thanks goes to these wonderful people (emoji key):
Iztok Fister Jr. 💻 📦 💡 🤔 🧑🏫 📖 |
StrajnarFilip 💻 ⚠️ 🤔 💡 |
Ben Beasley 📖 📦 |
Tomasz Kłoczko 🐛 |
This project follows the all-contributors specification. Contributions of any kind welcome!
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_adapt-0.2.7-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 524872aac28345fb3da89e31d7d4fb8dba10771db246c85206accb65d0160a62 |
|
MD5 | 25bd4b5dbdc7f5bd22b299f1bc904f6c |
|
BLAKE2b-256 | 7345bb92a70d29ebed2c5241442f36ba1ed62500f2ddee7934f0e084b0179dbd |