def _list_tasks(target_path: Optional[str] = None):
    """
    A special task accessible via `poe _list_tasks` for use in shell completion

    Note this code path should include minimal imports to avoid slowing down the shell
    """

    try:
        from .config import PoeConfig

        config = PoeConfig()
        config.load(target_path, strict=False)
        task_names = (task for task in config.task_names if task and task[0] != "_")
        print(" ".join(task_names))
    except Exception:
        # this happens if there's no pyproject.toml present
        pass

    A special task accessible via `poe _list_tasks` for use in shell completion

    Note this code path should include minimal imports to avoid slowing down the shell
    
poethepoet/__init__.py