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.pyand/orsetup.cfg.
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.WritePyprojectsetuptools command. This does the same thing aspython setup.py pyproject, except that ifsetup.pydoesn’t exist, it will act as though there were a “stub”setup.pyscript with the following contents:import setuptools setuptools.setup()
Effectively, this lets you use
setuptools-pyproject-migrationwithout having to install the plugin and without having to create asetup.pyfile if all you have issetup.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.