Skip to main content

Automatically conversion of .ini/.cfg files to TOML equivalents

Project description

Built Status ReadTheDocs Coveralls PyPI-Server Project generated with PyScaffold

ini2toml

Automatically translates .ini/.cfg files into TOML

Description

The original purpose of this project is to help migrating setup.cfg files to PEP 621, but by extension it can also be used to convert any compatible .ini/.cfg file to TOML.

Please notice, the provided .ini/.cfg files should follow the same syntax supported by Python’s ConfigParser library (here referred to as INI syntax) and more specifically abide by ConfigUpdater restrictions (e.g., no interpolation or repeated fields).

Usage

ini2toml comes in two flavours: “lite” and “full”. The “lite” flavour will create a TOML document that does not contain any of the comments from the original .ini/.cfg file. On the other hand, the “full” flavour will make an extra effort to translate these comments into a TOML-equivalent (please notice sometimes this translation is not perfect, so it is always good to check the TOML document afterwards).

To get started, you need to install the package, which can be easily done using pipx:

$ pipx install 'ini2toml[lite]'
# OR
$ pipx install 'ini2toml[full]'

Now you can use ini2toml as a command line tool:

# in you terminal
$ ini2toml --help
$ ini2toml path/to/ini/or/cfg/file

You can also use ini2toml in your Python scripts or projects:

# in your python code
from ini2toml.api import Translator

profile_name = "setup.cfg"
toml_str = Translator().translate(original_contents_str, profile_name)

To do so, don’t forget to add it to your virtual environment or specify it as a project dependency.

More details about ini2toml and its Python API can be found in our docs.

Note

This project was initially created in the context of PyScaffold, with the purpose of helping migrating existing projects to PEP 621-style configuration when it is made available on setuptools. For details and usage information on PyScaffold see https://pyscaffold.org/.

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

ini2toml-0.5.2.tar.gz (93.8 kB view details)

Uploaded Source

Built Distribution

ini2toml-0.5.2-py2.py3-none-any.whl (50.4 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file ini2toml-0.5.2.tar.gz.

File metadata

  • Download URL: ini2toml-0.5.2.tar.gz
  • Upload date:
  • Size: 93.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.0 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

File hashes

Hashes for ini2toml-0.5.2.tar.gz
Algorithm Hash digest
SHA256 7c6c5bbd0739ba3abc5c684ce27da86c23485d9f9658903838d2b673d6b5198d
MD5 73a742227c936c9733d119e985c12c66
BLAKE2b-256 d487e266b64c95bb2f0d4de68285d42d94191f5bed81d7a332314bd9cb5ca208

See more details on using hashes here.

File details

Details for the file ini2toml-0.5.2-py2.py3-none-any.whl.

File metadata

  • Download URL: ini2toml-0.5.2-py2.py3-none-any.whl
  • Upload date:
  • Size: 50.4 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.0 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

File hashes

Hashes for ini2toml-0.5.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 b8e3fd3268062237369836ece712431eba3fbb05d2be05cf83bf61c15f0ec417
MD5 5f6f49d41cf434a88634971e4f5d3732
BLAKE2b-256 1940d7df6e46b9b506070032b8a7c4f5769cc99c0fecd8d9b66143d71d87c39f

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