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:
parent
fb0c1289f0
commit
5ac5636e7f
4 changed files with 104 additions and 8 deletions
21
my/simple.py
Normal file
21
my/simple.py
Normal 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)
|
Loading…
Add table
Add a link
Reference in a new issue