Allow custom root directory for config#6985
Conversation
|
Hi there @Cadair 👋 - thanks for the pull request! I'm just a friendly 🤖 that checks for issues related to the changelog and making sure that this pull request is milestoned and labeled correctly. This is mainly intended for the maintainers, so if you are not a maintainer you can ignore this, and a maintainer will let you know if any action is required on your part 😃. I noticed the following issue with this pull request:
Would it be possible to fix this? Thanks! If there are any issues with this message, please report them here. |
CHANGES.rst
Outdated
| customizable. This allows affiliated packages to put their configuration | ||
| files in locations other than ``CONFIG_DIR/.astropy/``. [#5828] | ||
|
|
||
| - The config and cache directories and the name of the config file are now |
There was a problem hiding this comment.
Duplicate change log entry. Also needs to be updated to include this PR number.
CHANGES.rst
Outdated
| ^^^^^^^^^^^ | ||
|
|
||
| - Removed deprecated ``wcs.rotateCD``. [#6170] | ||
| - The bundled version of pytest has now been removed, but the |
There was a problem hiding this comment.
This entry seems unrelated to the PR.
astropy/config/configuration.py
Outdated
| conf = Conf() | ||
| """ | ||
|
|
||
| rootname = 'astropy' |
There was a problem hiding this comment.
This is defined again in ConfigItem. Is this necessary here? Seems weird to define this twice separately.
There was a problem hiding this comment.
Different bits of the machinery use ConfigItem and ConfigNamespace I could not see a simple way of sharing the value.
There was a problem hiding this comment.
although maybe this isn't actually used anywhere... 😕
astropy/utils/data.py
Outdated
| The timeout, in seconds. Otherwise, use | ||
| `astropy.utils.data.Conf.remote_timeout`. | ||
|
|
||
| pkgname : TODO |
astropy/utils/data.py
Outdated
|
|
||
|
|
||
| def download_files_in_parallel(urls, cache=True, show_progress=True, | ||
| def download_files_in_parallel(urls, cache=False, show_progress=True, |
There was a problem hiding this comment.
This change in behavior seems unrelated to this PR.
astropy/utils/data.py
Outdated
|
|
||
| def _do_download_files_in_parallel(args): | ||
| return download_file(*args) | ||
| return download_file(*args, show_progress=False) |
There was a problem hiding this comment.
This change in behavior seems unrelated to this PR.
astropy/utils/data.py
Outdated
| else: | ||
| progress = io.BytesIO() | ||
|
|
||
| if timeout is None: |
There was a problem hiding this comment.
This change in behavior seems unrelated to this PR.
|
looks like @pllim just found a whole bunch of my rebase fails 😆 |
1a394ec to
8b94857
Compare
8b94857 to
6fb60a3
Compare
|
I think all the major wrinkles in this are iorned out. Review please! |
|
That's curious, I can't reproduce the Circle CI fail locally. That is a post-lunch problem. |
|
Given that I wrote some fraction of this code, it would be good for @eteq to review this 😄 |
There was a problem hiding this comment.
I guess I'm willing to accept this in concept since it's clear SunPy has a need for it.
The one high-level concern I have on this is that setting the cache consistently is quite awkward. But I guess I'm ok with that because it will still keep people from having more than one location? I think for the cache it's harder to understand why I would even want this, since the point of a cache is to save things for re-use...
But aside from the inline comments I made about an API-breaking change that shouldn't be there, one other thing is missing: docs explaining how to use this! I would put most of the discussion in http://docs.astropy.org/en/stable/config/index.html and then some mention in http://docs.astropy.org/en/stable/utils/index.html#module-astropy.utils.data about the cache directory
|
|
||
|
|
||
| def get_config_dir(create=True): | ||
| def get_config_dir(rootname, create=True): |
There was a problem hiding this comment.
This is a public API function so this is a breaking API change. I think rootname needs to default to astropy, and be the second argument. I realize this isn't used that much, but I think it is used by some affiliated packages that use tricks to do something else.
| assert 'astropy' in paths.get_config_dir() | ||
| assert 'astropy' in paths.get_cache_dir() | ||
| assert 'astropy' in paths.get_config_dir('astropy') | ||
| assert 'astropy' in paths.get_cache_dir('astropy') |
There was a problem hiding this comment.
Related to the above: this test has to be left unchanged to not be a public API-breaking change. Same with all the stuff below in this file.
|
|
||
|
|
||
| def get_cache_dir(): | ||
| def get_cache_dir(rootname): |
There was a problem hiding this comment.
Same deal here with it being an API-breaking change. Needs to default to 'astropy'
|
There was a bug in the bot, it should not have been closed without the warning so re-opening. |
|
I will get back to this one day... |
|
Hi humans 👋 - this pull request hasn't had any new commits for approximately 6 months. I plan to close this in a month if the pull request doesn't have any new commits by then. In lieu of a stalled pull request, please consider closing this and open an issue instead if a reminder is needed to revisit in the future. Maintainers may also choose to add If this PR still needs to be reviewed, as an author, you can rebase it to reset the clock. You may also consider sending a reminder e-mail about it to the astropy-dev mailing list. If you believe I commented on this pull request incorrectly, please report this here. |
|
⏰ Time's up! ⏰ I'm going to close this pull request as per my previous message. If you think what is being added/fixed here is still important, please remember to open an issue to keep track of it. Thanks! If this is the first time I am commenting on this issue, or if you believe I closed this issue incorrectly, please report this here. |
This is an adoption of #5828 because I think I have more reason to want it than @adrn.
I have rebased this for 3.0+ (so it's Python 3 only now) and I have also opened astropy/package-template#290 which demonstrates the changes needed to use this in the template. Also I have used this successfully in DKISTDC/dkist#3 to prove it works.
@eteq opinions?
EDIT: Fix #5779 , close #5828