Allow custom root directory for config/cache#5828
Allow custom root directory for config/cache#5828adrn wants to merge 15 commits intoastropy:masterfrom
Conversation
|
Also have to consider those packages who previously have to endure Is it possible to do something like |
|
@pllim To answer your 2nd question first, with this you would be able to use |
|
@eteq any suggestions for more tests to add in? |
|
@adrn - how much is missing from here? Can we aim to get this in this week? |
|
@adrn - This needs a changelog entry. |
|
Is there an associated PR over at Also, maybe mention this in http://docs.astropy.org/en/latest/development/affiliated-packages.html ? |
|
@adrn - If you could push a minor comment into http://docs.astropy.org/en/latest/development/affiliated-packages.html, then we could merge this before coffee? |
|
In reviewing this on my own, I realized that I think this requires some changes in config.update_default_config(
__package__, config_dir, version=__version__)Also: https://github.com/astropy/astropy/blob/master/astropy/config/configuration.py#L345 |
|
@adrn - Could you clarify whether the changes are needed to be done here or in the package template. If the latter, is this ready to final review and merge? |
|
I think this requires more changes or an assessment of whether this is still relevant - in either case, I don't think it will be ready in time for v2.0, so maybe we should re-milestone to v3.0? :/ |
|
@adrn I just went diving into the astropy config system to see if this could be done. Turns out you already kinda did it. What exactly is the issue with this as it stands? Where can I help? |
|
@Cadair This just needs to be rebased, and needs some better tests. Also at some point I started having Jeff Goldblum feelings about this PR, but if you'd find it useful I can try to wrap it up! |
|
It would allow me to use the astropy config system for both SunPy and DKIST packages and could be nicely exposed in the package template as a config option, so SunPy affiliated packages would use I am going to go and have a poke around until my desire to eat lunch becomes overwhelming. |
|
What seems to be missing in this system is anyway to customise this behaviour from the level of What could work is if there was a way for packages to subclass those two classes into their own see adrn#16 for a very fast attempt at this idea. |
edb47a8 to
16a6b5a
Compare
|
Hi there @adrn 👋 - 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 see this is an experimental pull request. I'll report back on the checks once the PR discussion in settled. If there are any issues with this message, please report them here. |
|
@adrn I would still like to see this moved forwards, do you have any opinions on what is in my PR to your branch (now in need of rebasing) or any other opinions on where we should go with this? |
|
@adrn @Cadair - some general thoughts on this: when originally designing the That said, I could see the argument for the A separate note is the idea of setting the cache directory for cases where there's large data sets that the user actually wants to manage. There I see the use case a lot more. But that's not so much a "package"-level deal as it is a feature needed for the caching machinery (i.e., should be able to use the "default" cache vs a custom location). |
|
I have rebased this and made #6985 if someone want's to pull it back in here, that's fine. |
|
All yours @Cadair! |
|
I run into this again today, and it seems we can change the config dir, but not the cache dir? If I misunderstand the situation, then we probably need to add more examples to the config dir, one especially for the case of the custom cache dir. |

The idea here is to provide the option to put / look for config and cache files in a customizable directory (i.e. not default to
~/.astropy/pkgname). This would mainly be for packages that use Astropy but aren't planned to be affiliated packages. My own need for this is that I like theConfigObjvalidation and the extra class-basedConfigItemfunctionality built on top, but I don't want my package to have config settings that live in~/.astropy/XX.cfg. In looking through the config code, however, I'm wondering why we don't try contributing it back to the Python 3 port ofConfigObjitself? Most of the code is very general and not astronomy-specific...I think the changes made here won't affect affiliated packages because the root path will default to
.astropy.This is probably still a work in progress because I think it still needs some more robust testing of the new functionality. But I need to figure out the best way to do that...
Fixes #5779.
cc @eteq