import pathlib
from typing import List


def _find_python_modules(folder: pathlib.Path) -> List[str]:
    """Find modules in a directory.

    :param folder: The directory to look for Python modules in.
    :return: A list of Python module names.

    """
    module_names = []

    for child in folder.iterdir():
        if child.is_file() and child.suffix in (".py", ".so"):
            module_names.append(child.stem)

        elif child.is_dir() and not child.stem.startswith("__"):
            module_names.append(child.stem)

    return sorted(module_names)