pyproject#
Tools for loading, inspecting, and updating pyproject.toml
.
- class Pyproject(document: PyprojectTOML, source: IO | Path | None = None)[source]#
Bases:
object
Read-only representation of a
pyproject.toml
file.- classmethod load(source: IO | Path | str = PosixPath('pyproject.toml')) T [source]#
Load a
pyproject.toml
file from a file, I/O stream, orstr
.
- final get_package_name() str | None [source]#
- final get_package_name(*, raise_on_missing: Literal[False]) str | None
- final get_package_name(*, raise_on_missing: Literal[True]) str
- class ModifiablePyproject(document: PyprojectTOML, source: IO | Path | None = None, changelog: list[str] = NOTHING)[source]#
Bases:
Pyproject
,AbstractContextManager
Stateful representation of a
pyproject.toml
file.Use this class to apply multiple modifications to a
pyproject.toml
file in separate sub-hooks. The modifications are dumped once the context is exited.- classmethod load(source: IO | Path | str = PosixPath('pyproject.toml')) T [source]#
Load a
pyproject.toml
file from a file, I/O stream, orstr
.
- complies_with_subset(settings: Mapping, minimal_settings: Mapping, *, exact_value_match: bool = True) bool [source]#
Compare if a nested mapping fits inside another nested mapping.
>>> complies_with_subset( ... {"channels": ["conda-forge"]}, ... {"channels": ["conda-forge"], "platforms": ["linux-64"]}, ... ) False >>> complies_with_subset( ... {"channels": ["conda-forge"], "platforms": ["linux-64"]}, ... {"channels": ["conda-forge"]}, ... ) True >>> complies_with_subset( ... {"channels": ["conda-forge", "default"]}, ... {"channels": ["conda-forge"]}, ... exact_value_match=False, ... ) True
- get_constraints_file(python_version: Literal['3.6', '3.7', '3.8', '3.9', '3.10', '3.11', '3.12']) Path | None [source]#
- load_pyproject_toml(source: IO | Path | str, modifiable: bool) PyprojectTOML [source]#
Load a
pyproject.toml
file from a file, I/O stream, orstr
.The
modifiable
flag determines which parser to use:
Submodules and Subpackages