Skip to content

Allow custom root directory for config#6985

Closed
Cadair wants to merge 19 commits intoastropy:masterfrom
Cadair:config-custom-dir
Closed

Allow custom root directory for config#6985
Cadair wants to merge 19 commits intoastropy:masterfrom
Cadair:config-custom-dir

Conversation

@Cadair
Copy link
Member

@Cadair Cadair commented Dec 14, 2017

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

@astropy-bot
Copy link

astropy-bot bot commented Dec 14, 2017

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:

  • Changelog entry section (v3.0) inconsistent with milestone (v3.1)

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This entry seems unrelated to the PR.

conf = Conf()
"""

rootname = 'astropy'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is defined again in ConfigItem. Is this necessary here? Seems weird to define this twice separately.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Different bits of the machinery use ConfigItem and ConfigNamespace I could not see a simple way of sharing the value.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

although maybe this isn't actually used anywhere... 😕

The timeout, in seconds. Otherwise, use
`astropy.utils.data.Conf.remote_timeout`.

pkgname : TODO
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This docstring is incomplete.



def download_files_in_parallel(urls, cache=True, show_progress=True,
def download_files_in_parallel(urls, cache=False, show_progress=True,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change in behavior seems unrelated to this PR.


def _do_download_files_in_parallel(args):
return download_file(*args)
return download_file(*args, show_progress=False)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change in behavior seems unrelated to this PR.

else:
progress = io.BytesIO()

if timeout is None:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change in behavior seems unrelated to this PR.

@Cadair
Copy link
Member Author

Cadair commented Dec 14, 2017

looks like @pllim just found a whole bunch of my rebase fails 😆

@Cadair Cadair force-pushed the config-custom-dir branch 2 times, most recently from 1a394ec to 8b94857 Compare December 21, 2017 12:23
Cadair added a commit to Cadair/package-template that referenced this pull request Dec 21, 2017
@Cadair
Copy link
Member Author

Cadair commented Dec 21, 2017

I think all the major wrinkles in this are iorned out. Review please!

@Cadair
Copy link
Member Author

Cadair commented Dec 21, 2017

That's curious, I can't reproduce the Circle CI fail locally. That is a post-lunch problem.

@adrn
Copy link
Member

adrn commented Dec 22, 2017

Given that I wrote some fraction of this code, it would be good for @eteq to review this 😄

Copy link
Member

@eteq eteq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same deal here with it being an API-breaking change. Needs to default to 'astropy'

@bsipocz bsipocz modified the milestones: v3.0.0, v3.1 Jan 18, 2018
@astropy-bot astropy-bot bot closed this Jul 18, 2018
@astrofrog
Copy link
Member

There was a bug in the bot, it should not have been closed without the warning so re-opening.

@Cadair
Copy link
Member Author

Cadair commented Jul 19, 2018

I will get back to this one day...

@astropy astropy deleted a comment from astropy-bot bot Jul 19, 2018
@astropy-bot
Copy link

astropy-bot bot commented Jul 19, 2018

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 keep-open label to keep this PR open but it is discouraged unless absolutely necessary.

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.

@astropy-bot
Copy link

astropy-bot bot commented Aug 23, 2018

⏰ 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.

@astropy-bot astropy-bot bot closed this Aug 23, 2018
@bsipocz bsipocz added the closed-by-bot Closed by stale bot label Aug 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make astropy.config directory configurable by packages that use astropy_helpers

6 participants