astropy / astropy/astropy

Add way to have utils.data functions w/ cache have their cache expire

Open
#1,162 4 comments 0 reactions 0 assignees View on GitHub
Feature Request utils
Dominant language
Python
Stars
5.3k
Forks
2.2k
Avg merge
1d 19h
Merged PRs (30d)
75

Description

Right now, the various functions in `utils.data` that have a `cache` option hold onto their cached copy of a download until the file is deleted. There are some use cases that require the cache expire after a certain time, and get re-downloaded (e.g. #1145).

So these functions (which all depend on `download_file` I believe), should allow `cache` to give a specific timeframe after which the file should be re-downloaded. This is pretty straightforward, but there is a question how best to define the expiration time. My instinct is to use stdlib `datetime.datetime` and `datetime.timedelta` objects, but an alternative might be `astropy.time.Time` and `astropy.time.DeltaTime`.

Contributor guide

Open the contributing guide

Research direction

Start by tracing the cache-enabled functions in utils.data and their shared download_file dependency. Decide how the cache option should represent an expiration interval, considering the datetime/datetime.timedelta and astropy.time alternatives raised in the issue. Done means cached downloads are refreshed after the configured interval while existing cache behavior remains supported.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.