Skip to content

Robust handling of nested field. #37

@jperkelens

Description

@jperkelens

Currently, the _find method resolves config values in priority order. However, it does not treat nested value robustly. Plenty of work has been done to support env binding support for nested config values. However, overrides & defaults will not respect nesting unless retrieved from the level in which they were set.

Example:

config:
     file_settings:
          name: cool_file
          permissions: rw
vyper.read_in_config(config.yaml)
vyper.set_default("config.file_settings.extension" , "txt")
vyper.set("config.file_settings.permissions" , "r")

vyper.get("config.file_settings.extension") # Returns: "txt"
vyper.get("config.file_settings.permissions") # Returns: "r"
vyper.get("config.file_settings") # Returns: { name: cool_file, permissions: rw }

The complexity of managing this in the _find method seems untenable and the library seems to be calling for some sort of composable, self referential construct built on config read to handle this appropriately. These are nascent thought but I'll try to work through a POC over the weekend.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions