feat: add image download cache#70
Draft
hollandjg wants to merge 2 commits intofix--duplicated-labelsfrom
Draft
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR introduces an image download caching mechanism using an SQLite database to cache requests, enabling image downloads to be reused across sessions.
- Added the "requests-cache" dependency in pyproject.toml.
- Extended the load function to optionally use a cached session when a cache directory is provided.
- Updated the CLI in app.py to accept and forward the cache directory parameter.
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| pyproject.toml | Added requests-cache dependency to manage caching. |
| src/ebfloeseg/load.py | Added cache_directory parameter and caching session support. |
| src/ebfloeseg/app.py | Propagated cache_directory parameter to the load function. |
Comments suppressed due to low confidence (2)
src/ebfloeseg/load.py:207
- Ensure that requests_cache.CachedSession is being used correctly; it may expect a cache name string rather than a Path object. Consider reviewing the requests-cache documentation to validate the correct parameter type and usage.
session = requests_cache.CachedSession(cache_directory)
src/ebfloeseg/load.py:166
- Add unit tests to verify the caching functionality when cache_directory is provided and when it is omitted.
cache_directory: Optional[pathlib.Path] = None,
Member
|
I triggered the Copilot review out of curiosity. The changes look good to me but I concur that some tests should be added before merging this feature. |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This will create an sqlite database cache of all the requests made when downloading images, and allow downloads to be reused across different sessions.