API

setuptools-pyproject-migration is only intended for use as a setuptools plugin or a command-line executable, so it does not expose an API to be used as a Python library.

setuptools_pyproject_migration

There should generally be no need to use this API unless you’re trying to invoke setuptools plugins in a custom way, in which case you’re probably better off looking at the setuptools documentation.

class setuptools_pyproject_migration.WritePyproject(dist: Distribution, **kw)

Bases: Command

finalize_options()

Set final values for all options/attributes used by the command. Most of the time, each option/attribute/cache should only be set if it does not have any value yet (e.g. if self.attr is None: self.attr = val).

initialize_options()

Set or (reset) all options/attributes/caches used by the command to their default values. Note that these values may be overwritten during the build.

run()

Write out the contents of a pyproject.toml file containing information ingested from setup.py and/or setup.cfg.

user_options: List[Tuple[str, str | None, str]] = [('readme-content-type=', None, "content type to use for the README, or 'auto' if the program should guess; required if the content type cannot be determined automatically")]

setuptools_pyproject_migration.cli

This API is only meant for use by this project’s built-in console script. You can call it from Python at your own risk.

A simple command-line interface to the plugin.

setuptools_pyproject_migration.cli.main() None

Run the setuptools_pyproject_migration.WritePyproject setuptools command. This does the same thing as python setup.py pyproject, except that if setup.py doesn’t exist, it will act as though there were a “stub” setup.py script with the following contents:

import setuptools
setuptools.setup()

Effectively, this lets you use setuptools-pyproject-migration without having to install the plugin and without having to create a setup.py file if all you have is setup.cfg.

Note

This function changes sys.argv. If you call this from Python, make sure to restore the original argument list afterwards if your program needs it.

setuptools_pyproject_migration.cli.old_main() None

Print a deprecation warning and then call main().