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 |
|
Fill-in metadata and options that can be automatically derived (from other metadata/options, the file system or conventions) |
Class |
|
No class docstring; 1/1 constant documented |
Class |
|
No class docstring; 1/2 constant, 0/1 static method documented |
Class |
|
Find isolated Python modules. This function will **not** recurse subdirectories. |
Class |
|
Generate a list of all Python packages found within a directory |
Class |
|
Undocumented |
Function | construct |
Undocumented |
Function | find |
Given a package name, return the path where it should be found on disk, considering the ``package_dir`` option. |
Function | find |
Find the parent package that is not a namespace. |
Function | remove |
Remove nested packages from a list of packages. |
Function | remove |
Remove type stubs (:pep:`561`) from a list of packages. |
Type Alias |
|
Undocumented |
Class | _ |
Given a list of patterns, create a callable that will be true only if the input matches at least one of the patterns. |
Class | _ |
Base class that exposes functionality for module/package finders |
Function | _find |
Undocumented |
Function | _valid |
Undocumented |
Type Alias | _ |
Undocumented |
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'
List[ str]
, package_dir: Mapping[ str, str]
, root_dir: _Path
) -> Optional[ str]
:
(source)
¶
Find the parent package that is not a namespace.
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']