Skip to content

rootname as class variables#16

Merged
adrn merged 3 commits intoadrn:config-custom-dirfrom
Cadair:config-custom-dir
Oct 19, 2017
Merged

rootname as class variables#16
adrn merged 3 commits intoadrn:config-custom-dirfrom
Cadair:config-custom-dir

Conversation

@Cadair
Copy link

@Cadair Cadair commented Jul 11, 2017

A package that wanted to customise this would then have a config subpackage that looks like this:

import astropy.config as apy_config

class ConfigNamespace(apy_config.ConfigNamespace):
    rootname = 'sunpy'

class ConfigItem(apy_config.ConfigItem):
    rootname = 'sunpy'

then just import configs from it's own namespace rather than astropy's?


# this is not in __all__ because it's not intended that a user uses it
def update_default_config(pkg, default_cfg_dir_or_fn, version=None):
def update_default_config(pkg, default_cfg_dir_or_fn, version=None, rootname='astropy'):
Copy link
Author

Choose a reason for hiding this comment

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

I did this just in case, and it might be useful in the package template. Not a clue though.

@adrn adrn force-pushed the config-custom-dir branch from edb47a8 to 16a6b5a Compare September 1, 2017 17:35
package or module.
"""
cfg = get_config(packageormod)
cfg = get_config(packageormod, rootname=None)
Copy link
Owner

Choose a reason for hiding this comment

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

Should this be rootname=rootname?

@adrn
Copy link
Owner

adrn commented Oct 1, 2017

If you rebase, I think your changes could be merged. I'll then take a look at how to finish this up!

@Cadair Cadair force-pushed the config-custom-dir branch from 4ea151e to 3918757 Compare October 19, 2017 12:53
@Cadair
Copy link
Author

Cadair commented Oct 19, 2017

@adrn rebased at last.

@adrn adrn merged commit 55238ed into adrn:config-custom-dir Oct 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants