pytest_pep723.extract¶
Parse PEP 723 inline script metadata and extract imports from Python files.
Attributes¶
Functions¶
|
Check whether source contains a PEP 723 script metadata block. |
|
Extract normalized package names from a PEP 723 script block. |
|
Extract all top-level package names from import statements in source. |
|
Map an import name to the expected PyPI package name. |
|
Check a PEP 723 script for uncovered imports. |
|
Recursively find .py files under root with PEP 723 script blocks. |
Module Contents¶
- pytest_pep723.extract.has_pep723_block(source: str) bool[source]¶
Check whether source contains a PEP 723 script metadata block.
- pytest_pep723.extract.parse_pep723_deps(source: str) set[str][source]¶
Extract normalized package names from a PEP 723 script block.
Returns the set of lowercased package names (version specs stripped).
- pytest_pep723.extract.extract_imports(source: str) set[str][source]¶
Extract all top-level package names from import statements in source.
- pytest_pep723.extract.normalize_import_to_pkg(imp: str) str[source]¶
Map an import name to the expected PyPI package name.
- pytest_pep723.extract.check_script(source: str, ignore_imports: frozenset[str] = frozenset()) list[str][source]¶
Check a PEP 723 script for uncovered imports.
Returns a list of import names that are not covered by the declared inline dependencies, stdlib, or the ignore set.
- pytest_pep723.extract.find_pep723_scripts(root: pathlib.Path) list[pathlib.Path][source]¶
Recursively find .py files under root with PEP 723 script blocks.