Skip to content

Arbitrary Constructors and Variables #7

@HassanAbouelela

Description

@HassanAbouelela

The YAML library allows you to add arbitrary constructors, and use variables which are parsed at runtime in your config. Here are a few examples:

https://github.com/python-discord/bot/blob/b91820a30af9dcae0c1952432639661889c74970/config-default.yml#L360-L362

https://github.com/python-discord/bot/blob/b91820a30af9dcae0c1952432639661889c74970/config-default.yml#L369-L372

These are currently unsupported by the tool, as it'll error on the unknown constructors, and won't carry variables across. This is problematic as it means end users will have to modify their configs by hand at the end to add the variables back, and config makers can't use any constructors.

I see a few possible options here:

  1. Allow users to define arbitrary constructors/loaders and pass them to the package. There is more information about this in the documentation under Constructors, representers, resolvers.
  2. Ignore unrecognized constructors and just spit them back out at the end. I'm not sure how the implementation for this will work, but it should still allow users to use constructors as they like.

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