Configuration system #49
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/config/init"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I would like to write a thin, type-safe (to the best of my ability) wrapper around Red-DiscordBot's
Configframework.Red's Config framework is awesome, and works well enough as is. It's really easy to use and understand, and that's a good thing. You don't have the overhead of learning something like Piccolo or (shiver) SQLAlchemy just to store some data, just toss it into Config!
However, Config does have quite a few quirks that make it less easy to use, often in ways that are not immediately obvious to newer cog developers. Here are some of what I would consider pressing issues with Red's existing Config framework.
force_registration=Trueis technically a sort-of workaround to issues this causes at runtime, but this does nothing for tooling that utilizes static analysis.Just as an example, this is what a cog utilizing this module might look like today. I would read this as if it were psuedo-code. Note that this is liable to change over time, and none of this module's structure is finalized. (In fact, as of writing, it doesn't actually work yet... pydantic issues... sigh)
PartialGuild.in_guilda proper implementation 83216c3c45PartialGuild.in_guildimplementation da20de8c73discordimport instead of importing symbols fromdiscord44940c5a5fHttpUrl.yarl4977d5825613a64124664c935b8b57Jsonabletotidegear.configand redefine it; work on serializationinitinSentinelConfigSchema10a0aa13a4MappingCustomConfigOption/Group, refactor sentinel type configuration__init__.pytidegear.configits own full module instead of a single filetidegear.configfromtidegear's inittidegear.configfromtidegear's documentationConfigMetatoschema& update module docstring.type()classmethod 4fec4e5e5dconfig_versionduring migrationBaseConfigSchema.optionsas a cached propertyoptionstoregistered_optionsto hopefully avoid namespace collisionI just want to get this merged, so configuration views / menus will come later. The core configuration system is done.
WIP: Configuration systemto Configuration system