Skip to content

rootname as class variables - #16

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

adrn merged 3 commits into
adrn:config-custom-dirfrom
Cadair:config-custom-dir

Conversation

@Cadair

@Cadair Cadair commented Jul 11, 2017

Copy link
Copy Markdown

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
Copy Markdown
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
Comment thread astropy/config/configuration.py Outdated
package or module.
"""
cfg = get_config(packageormod)
cfg = get_config(packageormod, rootname=None)

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

adrn commented Oct 1, 2017

Copy link
Copy Markdown
Owner

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

Cadair commented Oct 19, 2017

Copy link
Copy Markdown
Author

@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