class documentation

class ConfigDiscovery: (source)

View In Hierarchy

Fill-in metadata and options that can be automatically derived (from other metadata/options, the file system or conventions)

Method __call__ Automatically discover missing configuration fields and modifies the given ``distribution`` object in-place.
Method __init__ Undocumented
Method analyse_name The packages/modules are the essential contribution of the author. Therefore the name of the distribution can be derived from them.
Instance Variable dist Undocumented
Method _analyse_explicit_layout The user can explicitly give a package layout via ``package_dir``
Method _analyse_flat_layout Try to find all packages and modules under the project root.
Method _analyse_flat_modules Undocumented
Method _analyse_flat_packages Undocumented
Method _analyse_package_layout Undocumented
Method _analyse_src_layout Try to find all packages or modules under the ``src`` directory (or anything pointed by ``package_dir[""]``).
Method _disable Internal API to disable automatic discovery
Method _ensure_no_accidental_inclusion Undocumented
Method _explicitly_specified ``True`` if the user has specified some form of package/module listing
Method _find_name_from_packages Try to find the root package that is not a PEP 420 namespace
Method _find_name_single_package_or_module Exactly one module or package
Method _ignore_ext_modules Internal API to disregard ext_modules.
Instance Variable _called Undocumented
Instance Variable _disabled Undocumented
Instance Variable _skip_ext_modules Undocumented
Property _package_dir Undocumented
Property _root_dir Undocumented
def __call__(self, force=False, name=True, ignore_ext_modules=False): (source)

Automatically discover missing configuration fields and modifies the given ``distribution`` object in-place. Note that by default this will only have an effect the first time the ``ConfigDiscovery`` object is called. To repeatedly invoke automatic discovery (e.g. when the project directory changes), please use ``force=True`` (or create a new ``ConfigDiscovery`` instance).

def __init__(self, distribution: Distribution): (source)

Undocumented

def analyse_name(self): (source)

The packages/modules are the essential contribution of the author. Therefore the name of the distribution can be derived from them.

Undocumented

def _analyse_explicit_layout(self) -> bool: (source)

The user can explicitly give a package layout via ``package_dir``

def _analyse_flat_layout(self) -> bool: (source)

Try to find all packages and modules under the project root. Since the ``flat-layout`` is more dangerous in terms of accidentally including extra files/directories, this function is more conservative and will raise an error if multiple packages or modules are found. This assumes that multi-package dists are uncommon and refuse to support that use case in order to be able to prevent unintended errors.

def _analyse_flat_modules(self) -> bool: (source)

Undocumented

def _analyse_flat_packages(self) -> bool: (source)

Undocumented

def _analyse_package_layout(self, ignore_ext_modules: bool) -> bool: (source)

Undocumented

def _analyse_src_layout(self) -> bool: (source)

Try to find all packages or modules under the ``src`` directory (or anything pointed by ``package_dir[""]``). The "src-layout" is relatively safe for automatic discovery. We assume that everything within is meant to be included in the distribution. If ``package_dir[""]`` is not given, but the ``src`` directory exists, this function will set ``package_dir[""] = "src"``.

def _disable(self): (source)

Internal API to disable automatic discovery

def _ensure_no_accidental_inclusion(self, detected: List[str], kind: str): (source)

Undocumented

def _explicitly_specified(self, ignore_ext_modules: bool) -> bool: (source)

``True`` if the user has specified some form of package/module listing

def _find_name_from_packages(self) -> Optional[str]: (source)

Try to find the root package that is not a PEP 420 namespace

def _find_name_single_package_or_module(self) -> Optional[str]: (source)

Exactly one module or package

def _ignore_ext_modules(self): (source)

Internal API to disregard ext_modules. Normally auto-discovery would not be triggered if ``ext_modules`` are set (this is done for backward compatibility with existing packages relying on ``setup.py`` or ``setup.cfg``). However, ``setuptools`` can call this function to ignore given ``ext_modules`` and proceed with the auto-discovery if ``packages`` and ``py_modules`` are not given (e.g. when using pyproject.toml metadata).

Undocumented

_disabled: bool = (source)

Undocumented

_skip_ext_modules: bool = (source)

Undocumented

@property
_package_dir: Dict[str, str] = (source)

Undocumented

Undocumented