Skip to content

Commit 447443a

Browse files
Fix broken find_project_root
1 parent 6200b58 commit 447443a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

shared/python/utils.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -639,13 +639,15 @@ def find_project_root() -> str:
639639
"""
640640
current_dir = os.getcwd()
641641

642-
# Look for marker files that indicate the project root
642+
# Look for marker files that indicate the project root.
643+
# Require all markers to avoid incorrectly treating notebook folders
644+
# (which often contain their own README.md) as the repo root.
643645
marker_files = ['requirements.txt', 'README.md', 'bicepconfig.json']
644646

645647
while current_dir != os.path.dirname(current_dir): # Stop at filesystem root
646-
if any(os.path.exists(os.path.join(current_dir, marker)) for marker in marker_files):
647-
# Return as soon as marker files are found; do not require 'samples' directory
648+
if all(os.path.exists(os.path.join(current_dir, marker)) for marker in marker_files):
648649
return current_dir
650+
649651
current_dir = os.path.dirname(current_dir)
650652

651653
# If we can't find the project root, raise an error

0 commit comments

Comments
 (0)