module documentation

Load setuptools configuration from ``setup.cfg`` files. **API will be made private in the future**

Class ConfigHandler Handles metadata supplied in configuration files.
Class ConfigMetadataHandler No class docstring; 1/1 property, 0/2 instance variable, 1/3 class variable, 1/2 method documented
Class ConfigOptionsHandler No class docstring; 1/1 property, 0/2 instance variable, 0/1 class variable, 7/12 methods, 0/1 class method documented
Function apply_configuration Apply the configuration from a ``setup.cfg`` file into an existing distribution object.
Function configuration_to_dict Returns configuration data gathered by given handlers as a dict.
Function parse_configuration Performs additional parsing of configuration options for a distribution.
Function read_configuration Read given configuration file and returns options from it as a dict.
Type Variable Target Undocumented
Type Alias AllCommandOptions Undocumented
Type Alias SingleCommandOptions Dict that associate the name of the options of a particular command to a tuple. The first element of the tuple indicates the origin of the option value (e.g. the name of the configuration file where it was read from), while the second element of the tuple is the option value itself...
Function _apply Read configuration from ``filepath`` and applies to the ``dist`` object.
Function _get_option Given a target object and option key, get that option from the target object, either through a get_{key} method or from an attribute directly.
Function _warn_accidental_env_marker_misconfig Because users sometimes misinterpret this configuration:
Type Alias _Path Undocumented
def apply_configuration(dist: Distribution, filepath: _Path) -> Distribution: (source)

Apply the configuration from a ``setup.cfg`` file into an existing distribution object.

def configuration_to_dict(handlers: Tuple[ConfigHandler, ...]) -> dict: (source)

Returns configuration data gathered by given handlers as a dict. :param list[ConfigHandler] handlers: Handlers list, usually from parse_configuration() :rtype: dict

def parse_configuration(distribution: Distribution, command_options: AllCommandOptions, ignore_option_errors=False) -> Tuple[ConfigMetadataHandler, ConfigOptionsHandler]: (source)

Performs additional parsing of configuration options for a distribution. Returns a list of used option handlers. :param Distribution distribution: :param dict command_options: :param bool ignore_option_errors: Whether to silently ignore options, values of which could not be resolved (e.g. due to exceptions in directives such as file:, attr:, etc.). If False exceptions are propagated as expected. :rtype: list

def read_configuration(filepath: _Path, find_others=False, ignore_option_errors=False) -> dict: (source)

Read given configuration file and returns options from it as a dict. :param str|unicode filepath: Path to configuration file to get options from. :param bool find_others: Whether to search for other configuration files which could be on in various places. :param bool ignore_option_errors: Whether to silently ignore options, values of which could not be resolved (e.g. due to exceptions in directives such as file:, attr:, etc.). If False exceptions are propagated as expected. :rtype: dict

Undocumented

Value
TypeVar('Target',
        bound=Union['Distribution', 'DistributionMetadata'])
AllCommandOptions = (source)

Undocumented

Value
Dict['str', SingleCommandOptions]
SingleCommandOptions = (source)

Dict that associate the name of the options of a particular command to a tuple. The first element of the tuple indicates the origin of the option value (e.g. the name of the configuration file where it was read from), while the second element of the tuple is the option value itself

Value
Dict['str', Tuple['str', Any]]
def _apply(dist: Distribution, filepath: _Path, other_files: Iterable[_Path] = (), ignore_option_errors: bool = False) -> Tuple[ConfigHandler, ...]: (source)

Read configuration from ``filepath`` and applies to the ``dist`` object.

def _get_option(target_obj: Target, key: str): (source)

Given a target object and option key, get that option from the target object, either through a get_{key} method or from an attribute directly.

def _warn_accidental_env_marker_misconfig(label: str, orig_value: str, parsed: list): (source)

Because users sometimes misinterpret this configuration: [options.extras_require] foo = bar;python_version<"4" It looks like one requirement with an environment marker but because there is no newline, it's parsed as two requirements with a semicolon as separator. Therefore, if: * input string does not contain a newline AND * parsed result contains two requirements AND * parsing of the two parts from the result ("<first>;<second>") leads in a valid Requirement with a valid marker a UserWarning is shown to inform the user about the possible problem.

Undocumented

Value
Union[str, os.PathLike]