polynomials_on_simplices.generic_tools.package_utils module

Extensions to the standard library pkgutil module.

source_file_paths(package_path, absolute_path=True, exclude_test_files=False, include_hidden_files=False, include_private_files=False)[source]

Yield the path of each Python source file (files ending with ‘.py’) in a package.

Parameters:
  • package_path (str) – Path to the package we want to investigate.
  • package_path – Path to the package we want to investigate.
  • absolute_path (bool) – Whether or not yielded paths should be absolute or relative to the package path.
  • exclude_test_files (bool) – Whether or not to exclude unit test files. A file is considered a test file if it ends with ‘_test.py’ or ‘_test_interactive.py’ and resides in a folder called ‘test’.
  • include_hidden_files (bool) – Whether or not to include hidden source files in the package (files starting with ‘.’ or residing in a directory starting with ‘.’).
  • include_private_files (bool) – Whether or not to include private source files in the package (files starting with ‘_’).
Returns:

Path to each source file in the package.

Return type:

Iterator[str]

submodule_paths(package_path, absolute_path=True)[source]

Yield the path of each submodule in a package.

Parameters:
  • package_path (str) – Path to the package we want to investigate.
  • absolute_path (bool) – Whether or not yielded paths should be absolute or relative to the package path.
Returns:

Path to each submodule in the package.

Return type:

Iterator[str]

submodules(package_path)[source]

Yield each submodule in a package.

Parameters:package_path (str) – Path to the package we want to investigate.
Returns:Relative import path to each submodule in the package.
Return type:Iterator[str]
subpackage_paths(package_path, absolute_path=True)[source]

Yield the path of each subpackage in a package.

Parameters:
  • package_path (str) – Path to the package we want to investigate.
  • absolute_path (bool) – Whether or not yielded paths should be absolute or relative to the package path.
Returns:

Path to each subpackage in the package.

Return type:

Iterator[str]