harbor run -t openthoughts/tasktrove-exp-flat25-stackoverflow-v2-5k-stackoverflow-2163harbor download openthoughts/tasktrove-exp-flat25-stackoverflow-v2-5k-stackoverflow-2163Title: How to implement pull_package_submodules to initialize and update Git submodules in a cloned repo using GitPython (with optional per-submodule callback and Path support)
Body: I'm working on a Python project and need to implement a function called pull_package_submodules. The function should live in protostar/commands/install/pull_package_submodules.py and must satisfy the following requirements exactly as part of a test suite that exercises submodules in a cloned repository.
What to implement
Acceptance criteria mapped to the tests
Implementation guidance
Notes
Code skeleton (to illustrate the expected signature; feel free to adapt as needed):
# protostar/commands/install/pull_package_submodules.py
from pathlib import Path
from typing import Callable, Optional, Union
from git import Repo
def pull_package_submodules(
on_submodule_update_start: Optional[Callable[[], None]] = None,
repo_dir: Union[str, Path] = ".",
libs_dir: Union[str, Path, None] = None,
) -> None:
# Implementation goes here
pass
Question How would you implement pull_package_submodules to meet these requirements robustly, ensure compatibility with Path-like inputs, optionally scope updates to libs_dir, and properly invoke the per-submodule callback for each updated submodule? Any caveats with GitPython usage or path handling I should be aware of to avoid regressions in tests that expect a single submodule under lib/package to be updated and its foo.txt to exist afterward?