This Python package is an attempt to make it a little easier to
patch pyproject.toml
in place.
It is mainly useful for maintainers of system packages.
If you’re not a maintainer of system packages, or if you don’t know
what that means, then pyproject-patcher
is probably not for you.
The following examples all assume the following import statement:
from pyproject_patcher import patch_in_place
with patch_in_place('pyproject.toml') as toml:
toml.set_project_version('1.2.3')
with patch_in_place('pyproject.toml') as toml:
toml.strip_build_system_dependency_constraint('setuptools-git-versioning')
# or, equivalently:
# toml.build_system_requires.strip_constraint('setuptools-git-versioning')
with patch_in_place('pyproject.toml') as toml:
toml.remove_build_system_dependency('setuptools-git-versioning')
# or, equivalently:
# toml.build_system_requires.remove_dependency('setuptools-git-versioning')
with patch_in_place('pyproject.toml') as toml:
toml.set_project_version('1.2.3')
toml.tools.setuptools_git_versioning.remove()
with patch_in_place('pyproject.toml') as toml:
toml.tools.setuptools_git_versioning.template_ignore_dirty_git()
pyproject-patcher supports the following environment variable:
PYPROJECT_PATCHER_DEBUG
: If set to a non-zero value, causes pyproject-patcher to enable debug-level
: logging.