module documentation

Translation layer between pyproject config and setuptools distribution and metadata objects. The distribution and metadata objects are modeled after (an old version of) core metadata, therefore configs in the format specified for ``pyproject.toml`` need to be processed before being applied. **PRIVATE MODULE**: API reserved for setuptools internal usage only.

Function apply Apply configuration dict read with :func:`read_configuration`
Function json_compatible_key As defined in :pep:`566#json-compatible-metadata`
Constant EMPTY Undocumented
Constant PYPROJECT_CORRESPONDENCE Undocumented
Constant SETUPTOOLS_PATCHES Undocumented
Constant TOOL_TABLE_DEPRECATIONS Undocumented
Constant TOOL_TABLE_RENAMES Undocumented
Exception _WouldIgnoreField Inform users that ``pyproject.toml`` would overwrite previous metadata.
Function _apply_project_table Undocumented
Function _apply_tool_table Undocumented
Function _attrgetter Similar to ``operator.attrgetter`` but returns None if ``attr`` is not found >>> from types import SimpleNamespace >>> obj = SimpleNamespace(a=42, b=SimpleNamespace(c=13)) >>> _attrgetter("a")(obj) 42 >>> _attrgetter("b...
Function _copy_command_options Undocumented
Function _dependencies Undocumented
Function _guess_content_type Undocumented
Function _handle_missing_dynamic Be temporarily forgiving with ``dynamic`` fields not listed in ``dynamic``
Function _license Undocumented
Function _load_ep Undocumented
Function _long_description Undocumented
Function _normalise_cmd_option_key Undocumented
Function _normalise_cmd_options Undocumented
Function _optional_dependencies Undocumented
Function _people Undocumented
Function _project_urls Undocumented
Function _python_requires Undocumented
Function _set_config Undocumented
Function _some_attrgetter Return the first "truth-y" attribute or None >>> from types import SimpleNamespace >>> obj = SimpleNamespace(a=42, b=SimpleNamespace(c=13)) >>> _some_attrgetter("d", "a", "b.c")(obj) 42 >>> _some_attrgetter("d", "e", "b...
Function _unify_entry_points Undocumented
Function _valid_command_options Undocumented
Constant _CONTENT_TYPES Undocumented
Constant _PREVIOUSLY_DEFINED Undocumented
Type Alias _CorrespFn Undocumented
Type Alias _Correspondence Undocumented
Type Alias _DictOrStr Undocumented
Type Alias _Path Undocumented
Variable _logger Undocumented
def apply(dist: Distribution, config: dict, filename: _Path) -> Distribution: (source)

Apply configuration dict read with :func:`read_configuration`

def json_compatible_key(key: str) -> str: (source)

As defined in :pep:`566#json-compatible-metadata`

Undocumented

Value
MappingProxyType({})
PYPROJECT_CORRESPONDENCE: Dict[str, _Correspondence] = (source)

Undocumented

Value
{'readme': _long_description,
 'license': _license,
 'authors': partial(_people,
                    kind='author'),
 'maintainers': partial(_people,
                        kind='maintainer'),
 'urls': _project_urls,
...
SETUPTOOLS_PATCHES: set[str] = (source)

Undocumented

Value
set(['long_description_content_type',
     'project_urls',
     'provides_extras',
     'license_file',
     'license_files'])
TOOL_TABLE_DEPRECATIONS: dict[str, str] = (source)

Undocumented

Value
{'namespace_packages': 'consider using implicit namespaces instead (PEP 420).'}
TOOL_TABLE_RENAMES: dict[str, str] = (source)

Undocumented

Value
{'script_files': 'scripts'}
def _apply_project_table(dist: Distribution, config: dict, root_dir: _Path): (source)

Undocumented

def _apply_tool_table(dist: Distribution, config: dict, filename: _Path): (source)

Undocumented

def _attrgetter(attr): (source)

Similar to ``operator.attrgetter`` but returns None if ``attr`` is not found >>> from types import SimpleNamespace >>> obj = SimpleNamespace(a=42, b=SimpleNamespace(c=13)) >>> _attrgetter("a")(obj) 42 >>> _attrgetter("b.c")(obj) 13 >>> _attrgetter("d")(obj) is None True

def _copy_command_options(pyproject: dict, dist: Distribution, filename: _Path): (source)

Undocumented

def _dependencies(dist: Distribution, val: list, _root_dir): (source)

Undocumented

def _guess_content_type(file: str) -> Optional[str]: (source)

Undocumented

def _handle_missing_dynamic(dist: Distribution, project_table: dict): (source)

Be temporarily forgiving with ``dynamic`` fields not listed in ``dynamic``

def _license(dist: Distribution, val: dict, root_dir: _Path): (source)

Undocumented

def _load_ep(ep: metadata.EntryPoint) -> Optional[Tuple[str, Type]]: (source)

Undocumented

def _long_description(dist: Distribution, val: _DictOrStr, root_dir: _Path): (source)

Undocumented

def _normalise_cmd_option_key(name: str) -> str: (source)

Undocumented

def _normalise_cmd_options(desc: List[Tuple[str, Optional[str], str]]) -> Set[str]: (source)

Undocumented

def _optional_dependencies(dist: Distribution, val: dict, _root_dir): (source)

Undocumented

def _people(dist: Distribution, val: List[dict], _root_dir: _Path, kind: str): (source)

Undocumented

def _project_urls(dist: Distribution, val: dict, _root_dir): (source)

Undocumented

def _python_requires(dist: Distribution, val: dict, _root_dir): (source)

Undocumented

def _set_config(dist: Distribution, field: str, value: Any): (source)

Undocumented

def _some_attrgetter(*items): (source)

Return the first "truth-y" attribute or None >>> from types import SimpleNamespace >>> obj = SimpleNamespace(a=42, b=SimpleNamespace(c=13)) >>> _some_attrgetter("d", "a", "b.c")(obj) 42 >>> _some_attrgetter("d", "e", "b.c", "a")(obj) 13 >>> _some_attrgetter("d", "e", "f")(obj) is None True

def _unify_entry_points(project_table: dict): (source)

Undocumented

def _valid_command_options(cmdclass: Mapping = EMPTY) -> Dict[str, Set[str]]: (source)

Undocumented

_CONTENT_TYPES: dict[str, str] = (source)

Undocumented

Value
{'.md': 'text/markdown', '.rst': 'text/x-rst', '.txt': 'text/plain'}
_PREVIOUSLY_DEFINED = (source)

Undocumented

Value
{'name': _attrgetter('metadata.name'),
 'version': _attrgetter('metadata.version'),
 'description': _attrgetter('metadata.description'),
 'readme': _attrgetter('metadata.long_description'),
 'requires-python': _some_attrgetter('python_requires',
                                     'metadata.python_requires'),
 'license': _attrgetter('metadata.license'),
...
_CorrespFn = (source)

Undocumented

Value
Callable[['Distribution', Any, _Path], None]
_Correspondence = (source)

Undocumented

Value
Union[str, _CorrespFn]
_DictOrStr = (source)

Undocumented

Value
Union[dict, str]

Undocumented

Value
Union[os.PathLike, str]

Undocumented