Skip to content

Commit 5108f0c

Browse files
committed
🔧 Global xtl.toml generation upon first import
xtl.config.settings:XTLSettings - The global `xtl.toml` file will now be generated upon the first import of the package
1 parent 36fbd15 commit 5108f0c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/xtl/config/settings.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,12 @@ def initialize(cls) -> 'XTLSettings':
216216
else:
217217
print(f'No local or global {cls._toml} found, initializing with defaults.')
218218
_settings = cls()
219+
try:
220+
_settings.to_toml(filename=cls.global_config, comments=True)
221+
print(f'Saved as global config: {cls.global_config}')
222+
except Exception as e:
223+
raise Exception(f'Failed to save global config: '
224+
f'{cls.global_config}') from e
219225

220226
# Check settings version
221227
_v = version_from_str(_settings.version)

0 commit comments

Comments
 (0)