Skip to content

Commit

Permalink
Merge pull request #132 from MannLabs/issue127
Browse files Browse the repository at this point in the history
Make downloading example datasets in non-editable install possible
  • Loading branch information
namsaraeva authored Dec 11, 2024
2 parents 7409b41 + b04f1d7 commit 66a721a
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/scportrait/tools/ml/pretrained_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,18 @@ def get_data_dir() -> Path:
Path to data directory
"""

def find_root_by_file(marker_file: str, current_path: Path) -> Path | None:
def find_root_by_folder(marker_folder: str, current_path: Path) -> Path | None:
for parent in current_path.parents:
if (parent / marker_file).exists():
if (parent / marker_folder).is_dir():
return parent
return None

src_code_dir = find_root_by_file("README.md", Path(__file__))
if src_code_dir is None:
raise FileNotFoundError("Could not find scPortrait root directory")
src_code_dir = find_root_by_folder("io", Path(__file__))

if src_code_dir is None:
raise FileNotFoundError("Could not find scPortrait source directory")
data_dir = src_code_dir / "scportrait_data"

return data_dir.absolute()


Expand Down

0 comments on commit 66a721a

Please sign in to comment.