<#733 fix: skip .venv and ignored directories in l...
# flyte-github
a
#733 fix: skip .venv and ignored directories in load_python_modules Pull request opened by pingsutw Summary •
load_python_modules
with
recursive=True
used
path.glob("**/*.py")
which blindly recursed into
.venv
directories, attempting to import ~1800+ installed package files when running
flyte deploy --all --recursive packages
from a uv workspace • Replaced
glob
with
os.walk
+
IgnoreGroup(StandardIgnore, GitIgnore)
filtering, matching the pattern already used in
bundle.py
and
_packaging.py
• Resolved paths to absolute before passing to
IgnoreGroup
to handle the CLI's relative path arguments correctly Test plan • Added
tests/flyte/utils/test_module_loader.py
with two tests: •
test_load_python_modules_skips_venv
— verifies
.venv
files are excluded with absolute paths •
test_load_python_modules_skips_venv_with_relative_paths
— verifies the fix works with relative paths matching real CLI behavior (
path=Path("packages"), root_dir=Path.cwd()
) • Existing tests pass:
pytest tests/flyte/code_bundle/test_ignore.py
• Manual:
cd examples/project_structures/uv_workspace/albatross && flyte -vvv deploy --all --recursive packages
should skip
.venv
files flyteorg/flyte-sdk