You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Delegate data management to third-party package and reduce maintenance burden of data and caching in utils.
Describe the desired outcome
Adding pooch as required dependency and refactor utils to use it instead of homegrown data management and caching.
First, a trade study needs to happen to ensure that pooch actually can satisfy all project requirements.
If this proceeds to implementation, this will be an extensive refactor with far reaching consequences. Even if we can replace functionality in utils, the stuff within still need to be deprecated first and probably longer than APE recommends because of the huge impact downstream. A coordinated effort to help downstream transition is also necessary.
I took a quick look at our API to see what parts of the backend pooch could replace.
TL;DR. The actual act of downloading looks to be pretty easily replaced by pooch.retrieve which unifies all our disparate downloading code into a single function. We can push further, using a pooch.Pooch data manager. We probably want to do this for Astropy data management internally, but in these general purpose downloader functions, 🤷.
Non-goal: remove these functions and make people learn a new API.
Goals:
replace the backend with something under active development and use, meaning if/when something breaks astropy devs have a community that's probably already working on the problem and don't need to themselves grok ftp minutiae. 🤝
Document the backend to users, keeping our current frontend, so they can benefit from the additional features. ⚡
Upstream useful stuff, thereby moving it out of our busy hands. ⬆️=😄
Possibly move this sub-package out of utils, since it has use outside of Astropy. 🌐
key: ⬜: N/A to pooch. ⬆️: missing from / upstream to pooch. ⬇️ : use pooch as backend
Astropy API
Pooch
Comments
CacheDamaged
⬆️
pooch should expose its errors / warnings. It's not clear if this specific error should be upstreamed.
CacheMissingWarning
⬆️
pooch should expose its errors / warnings. It's not clear if this specific error should be upstreamed.
Conf
⬇️⬜
use this to control creation of pooch.Pooch
cache_contents
⬜
pooch deals with downloading data, not the cache once downloaded
cache_total_size
⬜
N/A to pooch
check_download_cache
⬆️
this seems useful to upstream, for pooch to check a cache given the hashes
check_free_space_in_dir
⬜
N/A to pooch
clear_download_cache
❔
pooch has a "fetch" method, but maybe a "bury" would be useful to add
call to pooch.Pooch.fetch or pooch.retrieve, depending on context
download_files_in_parallel
❔
don't need to change, since calls download_file, except should use tqdm. Also opportunity to upstream, e.g. a 'retrieve_many' or 'fetch_many' or a context-manager for customizing the downloader where we write a parallel downloader, following link
export_download_cache
⬜
N/A to pooch
get_cached_urls
⬜
N/A to pooch
get_file_contents
⬜
N/A to pooch
get_pkg_data_contents
⬜
N/A to pooch
get_pkg_data_filename
⬇️
this is the output of pooch.retrieve or pooch.Pooch.fetch
@leouieda Thanks for making this great package! We are looking at pooch to possibly replace the downloading parts of astropy's data backend. On the above list of our API and how it relates to pooch I identified (marked with ⬆️) a few things which might be useful to upstream. I was just wondering what you thought of these: publicly exposing warnings / errors related to the target directory, and a function to check the health of a directory.
Activity
nstarman commentedon Dec 23, 2024
I took a quick look at our API to see what parts of the backend pooch could replace.
TL;DR. The actual act of downloading looks to be pretty easily replaced by
pooch.retrievewhich unifies all our disparate downloading code into a single function. We can push further, using apooch.Poochdata manager. We probably want to do this for Astropy data management internally, but in these general purpose downloader functions, 🤷.Non-goal: remove these functions and make people learn a new API.
Goals:
utils, since it has use outside of Astropy. 🌐key: ⬜: N/A to
pooch. ⬆️: missing from / upstream to pooch. ⬇️ : use pooch as backendpooch.Poochpooch.file_hashpooch.Poochpooch.Pooch.fetchorpooch.retrieve, depending on contextdownload_file, except should usetqdm. Also opportunity to upstream, e.g. a 'retrieve_many' or 'fetch_many' or a context-manager for customizing the downloader where we write a parallel downloader, following linkpooch.retrieveorpooch.Pooch.fetchnstarman commentedon Dec 23, 2024
@leouieda Thanks for making this great package! We are looking at
poochto possibly replace the downloading parts of astropy's data backend. On the above list of our API and how it relates to pooch I identified (marked with ⬆️) a few things which might be useful to upstream. I was just wondering what you thought of these: publicly exposing warnings / errors related to the target directory, and a function to check the health of a directory.timj commentedon Mar 18, 2025
Does pooch support cache expiration? I'm not sure it does from the docs.
Also, we use signed URLs a lot at Rubin and they tend to cause havoc with URL resource caching.