Skip to content

Feature Request: Allow discovery of available config items #8524

Closed

Description

@pllim

For my own package that uses the Astropy configuration machinery, I find myself needing to programmatically (re)discover all the config items in my package.conf without having to hardcode them one by one. Currently it is only possible as such, with is rather ugly:

from astropy.config import ConfigItem

from mypackage import conf

my_item_names = []

for key, val in conf.__class__.__dict__.items():
    if isinstance(val, ConfigItem):
        my_item_names.append(key)

What would be nice (API negotiable):

from mypackage import conf

# This currently gives an error stating that conf is not iterable.
for configitem in conf:
    do_something_with_configitem
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions