Skip to content

Fix path resolution for configs and cache#1

Open
cjmielke wants to merge 5 commits intomahmoodlab:mainfrom
cjmielke:main
Open

Fix path resolution for configs and cache#1
cjmielke wants to merge 5 commits intomahmoodlab:mainfrom
cjmielke:main

Conversation

@cjmielke
Copy link

Hi MahmoodLab! SEAL is great work as usual, and thanks for the HuggingFace approval!

We noticed that the library relies on hard-coded relative paths (e.g., conf/config.yaml and cache/organ_ids.json). While this works perfectly when running scripts directly from the root of the cloned repository, it causes FileNotFoundErrors for users who install the package via pip and import it elsewhere.

This PR makes the library fully usable as an installed Python package while strictly preserving the existing behavior for local development and cluster deployments.

Changes Made:

Updated pyproject.toml: Configured the build system to include the conf/ and cache/ directories so they are bundled with the installed package.

Added Fallback Path Resolution: Refactored the file loading logic (e.g., in load_img_model_from_checkpoint and find_organ_ids) using pathlib. The code now dynamically checks for the files in two places:

  • Local Working Directory First
  • Package Directory Fallback

include conf dir in installed package
Find config.yaml in installed library path
need cache too for organs.json
Find organ_ids.json in installed package
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant