<#1098 feat: add FlyteIgnore for excluding git-tra...
# flyte-github
a
#1098 feat: add FlyteIgnore for excluding git-tracked files from code bundles Pull request opened by AdilFayyaz Motivation If users need to exclude files that are tracked in git (e.g. large datasets, notebooks, docs) from the code bundle shipped to remote workers. The existing GitIgnore only filters files git already ignores, so committed files always ended up in the bundle. Summary • New
FlyteIgnore
class in
_ignore.py
that reads
.flyteignore
files and applies patterns to all files regardless of git tracking status. • Added
_normalize_flyteignore_pattern()
to translate gitignore-style patterns into the explicit forms PatternMatcher requires (bare patterns now match at any depth, data/ matches a data dir anywhere, leading / anchors, negation preserved). • Wired
FlyteIgnore
into
default_ignores
so it runs automatically in every bundle build — no caller changes required. • Added
examples/basics/bundle_ignore/
demonstrating a realistic usage with
.flyteignore
excluding training_data/, *.ipynb, and docs/. Test Plan • 12 new tests in
tests/flyte/code_bundle/test_ignore.py
covering: tracked-file exclusion, directory patterns, wildcards, per-subdirectory .flyteignore scoping, no-git operation, no-file no-op, integration with
list_files_to_bundle
, plus gitignore semantics (bare-pattern depth, anchored /pattern, negation). • Run the suite:
uv run pytest tests/flyte/code_bundle/ -v
— 69/69 pass, no regressions on the 57 pre-existing tests. • Manual verification on the example:
git init && git add -A && git commit -m init
inside
examples/basics/bundle_ignore/
, then check that
FlyteIgnore(root)
excludes docs/a.txt, dummy.ipynb, and training_data/data.xlsx while keeping main.py. flyteorg/flyte-sdk