Skip to content

Commit 4ea123d

Browse files
authored
fix: Ignore ipynb files during apply (#6151)
* Pre commit Hook changes Signed-off-by: Saipuneet Munikuntla <saipuneet357@gmail.com> * Filtering out pytest_cache, __pycache__, and ipynb_checkpoints in all subdirectories during feast apply Signed-off-by: Saipuneet Munikuntla <saipuneet357@gmail.com> * removing **/*.ipynb as its redundant Signed-off-by: Saipuneet Munikuntla <saipuneet357@gmail.com> * Removing broad glob pattern and only keeping exact match of directory name inside subdirectories Signed-off-by: Saipuneet Munikuntla <saipuneet357@gmail.com> * Adding tests to validated if checkpoints are being picked up in subdirectories Signed-off-by: Saipuneet Munikuntla <saipuneet357@gmail.com> * Fixing Tests To Incorporate New Changes Signed-off-by: Saipuneet Munikuntla <saipuneet357@gmail.com> --------- Signed-off-by: Saipuneet Munikuntla <saipuneet357@gmail.com>
1 parent ed4a4f2 commit 4ea123d

2 files changed

Lines changed: 30 additions & 3 deletions

File tree

sdk/python/feast/repo_operations.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,9 @@ def get_repo_files(repo_root: Path) -> List[Path]:
9292
".git",
9393
".feastignore",
9494
".venv",
95-
".pytest_cache",
96-
"__pycache__",
97-
".ipynb_checkpoints",
95+
"**/.ipynb_checkpoints",
96+
"**/.pytest_cache",
97+
"**/__pycache__",
9898
]
9999
ignore_files = get_ignore_files(repo_root, ignore_paths)
100100

sdk/python/tests/unit/infra/scaffolding/test_repo_operations.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,27 @@ def feature_repo(feastignore_contents: Optional[str]):
2828
(repo_root / "bar").mkdir()
2929
(repo_root / "bar/subdir1").mkdir()
3030
(repo_root / "bar/subdir1/subdir2").mkdir()
31+
(repo_root / "foo/__pycache__").mkdir()
32+
(repo_root / "foo/.pytest_cache").mkdir()
33+
(repo_root / "foo/.ipynb_checkpoints").mkdir()
34+
(repo_root / "bar/subdir1/.ipynb_checkpoints").mkdir()
35+
(repo_root / "bar/subdir1/subdir2/.ipynb_checkpoints").mkdir()
3136

3237
(repo_root / "a.py").touch()
3338
(repo_root / ".ipynb_checkpoints/test-checkpoint.py").touch()
3439
(repo_root / "foo/b.py").touch()
40+
(repo_root / "foo/__pycache__/b.cpython.pyc").touch()
41+
(repo_root / "foo/.pytest_cache/test-README.md").touch()
42+
(repo_root / "foo/.ipynb_checkpoints/foo-checkpoint.py").touch()
3543
(repo_root / "foo1/c.py").touch()
3644
(repo_root / "foo1/bar/d.py").touch()
3745
(repo_root / "bar/e.py").touch()
3846
(repo_root / "bar/subdir1/f.py").touch()
47+
(repo_root / "bar/subdir1/.ipynb_checkpoints/subdir1-checkpoint.py").touch()
3948
(repo_root / "bar/subdir1/subdir2/g.py").touch()
49+
(
50+
repo_root / "bar/subdir1/subdir2/.ipynb_checkpoints/nested-checkpoint.py"
51+
).touch()
4052

4153
if feastignore_contents:
4254
with open(repo_root / ".feastignore", "w") as f:
@@ -80,6 +92,7 @@ def test_feastignore_no_stars():
8092
{
8193
(repo_root / "foo/b.py").resolve(),
8294
(repo_root / "bar/subdir1/f.py").resolve(),
95+
(repo_root / "foo/.ipynb_checkpoints/foo-checkpoint.py").resolve(),
8396
}
8497
)
8598
assertpy.assert_that(get_repo_files(repo_root)).is_equal_to(
@@ -110,6 +123,13 @@ def test_feastignore_with_stars():
110123
{
111124
(repo_root / "foo/b.py").resolve(),
112125
(repo_root / "bar/subdir1/f.py").resolve(),
126+
(
127+
repo_root
128+
/ "bar/subdir1/subdir2/.ipynb_checkpoints/nested-checkpoint.py"
129+
).resolve(),
130+
(
131+
repo_root / "bar/subdir1/.ipynb_checkpoints/subdir1-checkpoint.py"
132+
).resolve(),
113133
(repo_root / "bar/e.py").resolve(),
114134
(repo_root / "bar/subdir1/f.py").resolve(),
115135
(repo_root / "bar/subdir1/subdir2/g.py").resolve(),
@@ -135,6 +155,13 @@ def test_feastignore_with_stars2():
135155
assertpy.assert_that(get_ignore_files(repo_root, ignore_paths)).is_equal_to(
136156
{
137157
(repo_root / "bar/subdir1/f.py").resolve(),
158+
(
159+
repo_root
160+
/ "bar/subdir1/subdir2/.ipynb_checkpoints/nested-checkpoint.py"
161+
).resolve(),
162+
(
163+
repo_root / "bar/subdir1/.ipynb_checkpoints/subdir1-checkpoint.py"
164+
).resolve(),
138165
(repo_root / "bar/e.py").resolve(),
139166
(repo_root / "bar/subdir1/f.py").resolve(),
140167
(repo_root / "bar/subdir1/subdir2/g.py").resolve(),

0 commit comments

Comments
 (0)