hatch icon indicating copy to clipboard operation
hatch copied to clipboard

DRAFT: Rewrite of the configuration system

Open KaiSforza opened this issue 1 year ago • 2 comments

Massive rewrite of the config system using pydantic. Definitely not ready to merge, I'm still figuring out some stuff here, just wanted to see if there was any feedback, honestly. I'm still figuring out what could be done here for performance, but otherwise it really cleans up the validation stuff.

KaiSforza avatar May 14 '24 08:05 KaiSforza

I'm quite busy currently but I'm extremely interested in this and have been planning on switching to Pydantic eventually!

ofek avatar May 16 '24 04:05 ofek

@ofek awesome, I was just messing around with this, it seems quite a bit slower from when I've been testing, but I went way overboard in some places, and there are probably better ways to do many of the things I've been thinking.

Most of the reason I ended up doing this stuff was just because I noticed we were already 'parsing' the full config file, so it didn't make sense to do like 99% of the deferred rendering if we could get some sane, fast defaults. The only ones that keep messing with me are the git ones, but that shouldn't be too hard to come up with a lazy method for that.

It also really messes with test_model.py, since without the lazy rendering the tests will all fail pretty fast and need to test for subsets of the dict, not just the whole thing (see these). I'll keep poking at it, but it's a huge thing to switch this with what I'm currently doing.

In the latest version I have locally I made BaseConfig inherit from collections.abc.MutableMapping for some ease of use later in the process, which definitely makes things a bit more familiar. (can do foo(**config) and get expected results).

Anyway, I'll push some more things up later today.

KaiSforza avatar May 20 '24 12:05 KaiSforza