Skip to main content

A simple command-line interface for manipulating toml files

Project description

toml-adapt --- A simple command-line interface (CLI) for manipulating toml files


PyPI Version PyPI - Python Version PyPI - Downloads Documentation Status Downloads GitHub license GitHub commit activity Average time to resolve an issue Percentage of issues still open All Contributors Fedora package AUR package Packaging status DOI

  • Free software: MIT license
  • Python versions: 3.8.x, 3.9.x, 3.10.x, 3.11.x, 3.12.x
  • Documentation: https://toml-adapt.readthedocs.io/en/latest/
  • Tested OS: Windows, Ubuntu, Debian, Fedora, Alpine, Arch, macOS. However, that does not mean it does not work on others.

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 pip:

pip 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, use:

$ apk add toml-adapt

Arch Linux

To install toml-adapt on Arch Linux, please use an AUR helper:

$ yay -Syyu 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

Cite us

Fister, Jr., I., & Strajnar, F. (2024). firefly-cpp/toml-adapt: 0.3.1 (0.3.1). Zenodo. https://doi.org/10.5281/zenodo.10467167

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.
Iztok Fister Jr.

💻 📦 💡 🤔 🧑‍🏫 📖
StrajnarFilip
StrajnarFilip

💻 ⚠️ 🤔 💡
Ben Beasley
Ben Beasley

📖 📦
Tomasz Kłoczko
Tomasz Kłoczko

🐛
Oromion
Oromion

📦
Tadej Lahovnik
Tadej Lahovnik

📖

This project follows the all-contributors specification. Contributions of any kind welcome!

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_adapt-0.3.3.tar.gz (11.3 kB view details)

Uploaded Source

Built Distribution

toml_adapt-0.3.3-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

File details

Details for the file toml_adapt-0.3.3.tar.gz.

File metadata

  • Download URL: toml_adapt-0.3.3.tar.gz
  • Upload date:
  • Size: 11.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.12.2 Linux/6.7.9-200.fc39.x86_64

File hashes

Hashes for toml_adapt-0.3.3.tar.gz
Algorithm Hash digest
SHA256 c143314d21156ed8dd131169ef57a9189e43e0316edef3201c5e803673de4a34
MD5 5acd12c6ebbfc30c4db9b07e19538d6a
BLAKE2b-256 3c091da0f80ee0ea056db0ace7fc0ce67a0bac525b57febee5f2b4a677817a1f

See more details on using hashes here.

File details

Details for the file toml_adapt-0.3.3-py3-none-any.whl.

File metadata

  • Download URL: toml_adapt-0.3.3-py3-none-any.whl
  • Upload date:
  • Size: 11.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.12.2 Linux/6.7.9-200.fc39.x86_64

File hashes

Hashes for toml_adapt-0.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 9bf0e03541c1ec068f91e600f03b076b8d3649a7c44b373701b7cc2f8859255c
MD5 936fb09ef5ab95a54f56540fa759a8bd
BLAKE2b-256 47df2bb922df3c62257edffa8b2588e98abe3df13043f5787e070b3febbee702

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