-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add Test Data classes to download from github releases #194
Merged
Merged
Changes from 20 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
a92b906
feat: Add GitHubReleaseDataset class for fetching and downloading dat…
jjjermiah b7e176f
feat: Introduce GitHubReleaseAsset and GitHubRelease classes for enha…
jjjermiah cef129b
feat: Enhance GitHubReleaseManager with latest release caching and im…
jjjermiah f1fbdec
feat: Update MedImageTestData to filter extracted files and add struc…
jjjermiah aa26b87
feat: Update dependencies in pyproject.toml and add import error hand…
jjjermiah e09479d
feat: Update pixi.toml to include extras for med-imagetools in dev an…
jjjermiah fd7a21d
feat: Enhance GitHub release management with asynchronous asset downl…
jjjermiah 2be30bc
feat: Remove structureset module and its associated imports
jjjermiah 18bb461
feat: Update test_extract to download specific assets from the latest…
jjjermiah f768eda
feat: Add progress bar for asynchronous asset downloads in MedImageTe…
jjjermiah 0e79040
feat: Implement progress bar for dataset downloads in MedImageTestData
jjjermiah 167900b
feat: Add CLI command to download test data from the latest GitHub re…
jjjermiah 04f6e29
feat: Update test_extract to filter assets based on specific strings …
jjjermiah 49e3e3a
feat: Add assertion to check minimum release version in test_extract
jjjermiah 1018c71
feat: Temporarily comment out pytest-xdist dependency in pixi.toml
jjjermiah f0bc308
feat: Enhance CLI with test data command and update workflows for ver…
jjjermiah 5753d1e
feat: Update GitHubReleaseManager to use environment variable for GIT…
jjjermiah 5ad5982
feat: Set GITHUB_TOKEN environment variable in GitHub Actions workflo…
jjjermiah 74b77c6
feat: Enhance GitHubReleaseManager to support configurable request pa…
jjjermiah a795528
feat: Increase timeout for GitHub API requests and simplify token han…
jjjermiah 19d19f2
feat: Add Windows support to CI workflow and update package platforms
jjjermiah cec5365
refactor: Update test cases for file handling to improve readability …
jjjermiah fdbd4c5
feat: Add debug optional dependency for pyvis in pyproject.toml
jjjermiah File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
import pathlib | ||
from typing import List | ||
|
||
import click | ||
|
||
|
||
def is_testdata_available() -> bool: | ||
try: | ||
from github import Github # type: ignore # noqa | ||
|
||
return True | ||
except ImportError: | ||
return False | ||
|
||
|
||
if is_testdata_available(): | ||
from imgtools.datasets import MedImageTestData | ||
|
||
|
||
@click.command() | ||
@click.argument( | ||
"dest", | ||
type=click.Path( | ||
exists=False, | ||
file_okay=False, | ||
dir_okay=True, | ||
writable=True, | ||
path_type=pathlib.Path, | ||
resolve_path=True, | ||
), | ||
) | ||
@click.option( | ||
"-a", | ||
"--assets", | ||
multiple=True, | ||
help="Specific assets to download. If not provided, all assets will be downloaded.", | ||
) | ||
@click.help_option( | ||
"-h", | ||
"--help", | ||
) | ||
def testdata(dest: pathlib.Path, assets: List[str]) -> None: | ||
"""Download test data from the latest GitHub release. | ||
|
||
DEST is the directory where the test data will be saved. | ||
|
||
assets can be one of the following: | ||
|
||
\b | ||
- 4D-Lung.tar.gz | ||
- CC-Tumor-Heterogeneity.tar.gz | ||
- NSCLC-Radiomics.tar.gz | ||
- NSCLC_Radiogenomics.tar.gz | ||
- QIN-PROSTATE-Repeatability.tar.gz | ||
- Soft-tissue-Sarcoma.tar.gz | ||
- Vestibular-Schwannoma-SEG.tar.gz | ||
|
||
""" | ||
manager = MedImageTestData() | ||
selected_assets = None | ||
|
||
if assets: | ||
selected_assets = [asset for asset in manager.datasets if asset.name in assets] | ||
if not selected_assets: | ||
click.echo(f"No matching assets found for: {', '.join(assets)}") | ||
return | ||
|
||
downloaded_files = manager.download(dest, assets=selected_assets) | ||
click.echo(f"Downloaded files: {', '.join(str(file) for file in downloaded_files)}") | ||
jjjermiah marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
|
||
if __name__ == "__main__": | ||
testdata() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from .github_helper import ( | ||
GitHubRelease, | ||
GitHubReleaseAsset, | ||
GitHubReleaseManager, | ||
MedImageTestData, | ||
) | ||
|
||
__all__ = [ | ||
"GitHubRelease", | ||
"GitHubReleaseAsset", | ||
"GitHubReleaseManager", | ||
"MedImageTestData", | ||
] |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codebase verification
The "all" extras group is missing in pyproject.toml
The
extras = ["all"]
specified in pixi.toml cannot be resolved as the "all" extras group is not defined in pyproject.toml. Currently, only "torch" and "test" extras groups are available.🔗 Analysis chain
Verify the "all" extras group exists in pyproject.toml.
The addition of
extras = ["all"]
looks good, but we should verify that this extras group is properly defined.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
Length of output: 199