Closed lstep closed 7 months ago
This looks like the best option. I'll give it a try soon!
If you want to try, here is the modified config.py file I used personnally:
import toml
class Config:
def __init__(self, app):
self.app = app
self.user_conf = self.load_toml('../data/config.toml')
self.config = {}
self.config.update(self.user_conf)
def get(self, name, default=None, path=None):
cfg = self.config
if path:
for part in path.split("."):
if part in cfg:
cfg = cfg[part]
else:
return default
if name in cfg:
return cfg[name]
return default
def load_toml(self, file):
cfg = toml.load(file)
return cfg
Thanks! I'll definitely give this a try next week and try to get it out. I think without tomllib as a dependency, the app will work on a lot more python versions.
Switched to toml from tomllib and pushed the code. Hope this helps future installs!
To be honest I hate toml, not the format itself, but the fact that tomllib only exists in python >= 3.11. And most distributions still use python 3.10 (including me :-) as it's the remcommended stable (and for stable diffusion) version. You can maybe use the toml module, instead of tomllib? Not sure if it's ok with python >= 3.11
Originally posted by @AndrewVeee in https://github.com/AndrewVeee/nucleo-ai/issues/5#issuecomment-1948416658