confuse icon indicating copy to clipboard operation
confuse copied to clipboard

Lazy sources - after submodules

Open beasteers opened this issue 5 years ago • 1 comments

I know I keep doing new PRs, sorry. Hopefully this will be the last one!!

Basically the goal is: ConfigSources manage their entire state and minimal assumptions are made about the internal workings of a ConfigSource by other Config objects (making ConfigSources much more extendable).

So for example, say you have some custom complicated source that is made by combining multiple files and an API call (idk why). By abstracting away ConfigSource.exists for example, the config source can define that state on its own without Configuration ever having to be privy to those details.

Notes:

  • we still have that bug where python 2.7 doesn't actually call dict.keys (or anything else) when casting to dict, so a hotfix is to look for keys in __getattribute__ and call load if keys was accessed. Obviously, I'd like to get rid of this, but I'm not sure what the best way is.
  • this is built on the submodule breakup PR so once that is merged, we should only have commits starting at 2ea14db
  • pypy is currently failing (like the 2.7 dict bug) because I'm guessing that it doesn't get keys when casting to dict. I'm guessing that because ConfigSource subclasses dict, it just does isinstance(src, dict)

beasteers avatar Jun 08 '20 13:06 beasteers

I think we could do 1+2, and then do 3 separately. 1 doesn't do much for simplification unless we have 2 in place as well.

beasteers avatar Jun 26 '20 17:06 beasteers