akx / pyproject-migrator

Convert setup.cfg, etc. to pyproject.toml files
MIT License
14 stars 3 forks source link

pyproject-migrator

PyPI - Version PyPI - Python Version


What is this?

This tool helps with converting setup.cfg (and other configuration files such as mypy.ini) to a single pyproject.toml file.

Installation

You can install the project from Pip with

pip install pyproject-migrator

but it may be more useful to use pipx to run it as a tool; if you prefer to do that, just substitute pipx run pyproject-migrator for pyproject-migrator in the examples below.

Usage

The tool can be run against a number of files or directories, but these files are considered to be part of the same project. The tool will then attempt to merge these into a single pyproject.toml file fragment.

$ pyproject-migrator setup.cfg mypy.ini

or

$ pyproject-migrator .

The tool will output a chunk of TOML you can copy-paste (or >> redirect) into your pyproject.toml file.

It may also output a number of warnings about configuration that could not be converted.

Some of these are because the tool does not yet support the option, but others are because there is no direct equivalent in the TOML format. In these cases, you will need to manually convert the option.

Supported configuration

The tool currently supports the following configuration:

Explicitly unsupported is

Other tools that emit "Unknown section" currently include, but are not limited to (based on the setup.cfgs I had at hand):

License

pyproject-migrator is distributed under the terms of the MIT license.