core: better support for ad-hoc configs

properly reload/unload the relevant modules so hopefully no more weird hacks should be required

relevant
- https://github.com/karlicoss/promnesia/issues/340
- https://github.com/karlicoss/HPI/issues/46
This commit is contained in:
Dima Gerasimov 2023-02-09 00:13:56 +00:00
parent fb0c1289f0
commit 81334c00df
4 changed files with 104 additions and 8 deletions

21
my/simple.py Normal file
View file

@ -0,0 +1,21 @@
'''
Just a demo module for testing and documentation purposes
'''
from dataclasses import dataclass
from typing import Iterator
from my.core import make_config
from my.config import simple as user_config
@dataclass
class simple(user_config):
count: int
config = make_config(simple)
def items() -> Iterator[int]:
yield from range(config.count)