pyufunc.pkg_public_func#

pyufunc.pkg_public_func(pkg_name, *, import_name=None, verbose=True)#

Show package-level public functions defined by a Python package.

The function first inspects the package in the current Python environment. If the package cannot be imported, it downloads the latest distribution from PyPI into a temporary directory and statically inspects the package source. Downloaded distributions are not installed.

Parameters:
  • pkg_name – Package import name or PyPI distribution name. For packages whose distribution name differs from the import name, pass the PyPI name here and set import_name when needed.

  • import_name – Optional import/package name override. For example, pkg_public_func("python-dateutil", import_name="dateutil").

  • verbose – Whether to print fallback errors. Defaults to True.

Note

Example

>>> from pyufunc import pkg_public_func
>>> public_funcs = pkg_public_func("pyufunc.util_img")
>>> "img_to_bytes" in public_funcs
True
>>> pkg_public_func("python-dateutil", import_name="dateutil")
Returns:

Sorted package-level public function names. The list includes functions whose implementation belongs to the package itself, and excludes classes, modules, private names, and external functions.

Return type:

list[str]