module documentation

Automatic discovery of Python modules and packages (for inclusion in the distribution) and other config values. For the purposes of this module, the following nomenclature is used: - "src-layout": a directory representing a Python project that contains a "src" folder. Everything under the "src" folder is meant to be included in the distribution when packaging the project. Example:: . ├── tox.ini ├── pyproject.toml └── src/ └── mypkg/ ├── __init__.py ├── mymodule.py └── my_data_file.txt - "flat-layout": a Python project that does not use "src-layout" but instead have a directory under the project root for each package:: . ├── tox.ini ├── pyproject.toml └── mypkg/ ├── __init__.py ├── mymodule.py └── my_data_file.txt - "single-module": a project that contains a single Python script direct under the project root (no directory used):: . ├── tox.ini ├── pyproject.toml └── mymodule.py

Class ConfigDiscovery Fill-in metadata and options that can be automatically derived (from other metadata/options, the file system or conventions)
Class FlatLayoutModuleFinder No class docstring; 1/1 constant documented
Class FlatLayoutPackageFinder No class docstring; 1/2 constant, 0/1 static method documented
Class ModuleFinder Find isolated Python modules. This function will **not** recurse subdirectories.
Class PackageFinder Generate a list of all Python packages found within a directory
Class PEP420PackageFinder Undocumented
Function construct_package_dir Undocumented
Function find_package_path Given a package name, return the path where it should be found on disk, considering the ``package_dir`` option.
Function find_parent_package Find the parent package that is not a namespace.
Function remove_nested_packages Remove nested packages from a list of packages.
Function remove_stubs Remove type stubs (:pep:`561`) from a list of packages.
Type Alias StrIter Undocumented
Class _Filter Given a list of patterns, create a callable that will be true only if the input matches at least one of the patterns.
Class _Finder Base class that exposes functionality for module/package finders
Function _find_packages_within Undocumented
Function _valid_name Undocumented
Type Alias _Path Undocumented
def construct_package_dir(packages: List[str], package_path: _Path) -> Dict[str, str]: (source)

Undocumented

def find_package_path(name: str, package_dir: Mapping[str, str], root_dir: _Path) -> str: (source)

Given a package name, return the path where it should be found on disk, considering the ``package_dir`` option. >>> path = find_package_path("my.pkg", {"": "root/is/nested"}, ".") >>> path.replace(os.sep, "/") './root/is/nested/my/pkg' >>> path = find_package_path("my.pkg", {"my": "root/is/nested"}, ".") >>> path.replace(os.sep, "/") './root/is/nested/pkg' >>> path = find_package_path("my.pkg", {"my.pkg": "root/is/nested"}, ".") >>> path.replace(os.sep, "/") './root/is/nested' >>> path = find_package_path("other.pkg", {"my.pkg": "root/is/nested"}, ".") >>> path.replace(os.sep, "/") './other/pkg'

def find_parent_package(packages: List[str], package_dir: Mapping[str, str], root_dir: _Path) -> Optional[str]: (source)

Find the parent package that is not a namespace.

def remove_nested_packages(packages: List[str]) -> List[str]: (source)

Remove nested packages from a list of packages. >>> remove_nested_packages(["a", "a.b1", "a.b2", "a.b1.c1"]) ['a'] >>> remove_nested_packages(["a", "b", "c.d", "c.d.e.f", "g.h", "a.a1"]) ['a', 'b', 'c.d', 'g.h']

def remove_stubs(packages: List[str]) -> List[str]: (source)

Remove type stubs (:pep:`561`) from a list of packages. >>> remove_stubs(["a", "a.b", "a-stubs", "a-stubs.b.c", "b", "c-stubs"]) ['a', 'a.b', 'b']

Undocumented

Value
Iterator[str]
def _find_packages_within(root_pkg: str, pkg_dir: _Path) -> List[str]: (source)

Undocumented

def _valid_name(path: _Path) -> bool: (source)

Undocumented

Undocumented

Value
Union[str, os.PathLike]