prompt-toolkit / ptpython

A better Python REPL
BSD 3-Clause "New" or "Revised" License
5.23k stars 281 forks source link

Add auto save and restore for config options #531

Open bulletmark opened 1 year ago

bulletmark commented 1 year ago

Fixes issue #232 and #339. Seems very odd to a new user that ptpython does not save the options the user sets via the nice F2 menu so this PR adds that feature.

The ptpython settings are saved at ~/.config/config.json and the ptipython settings are saved at ~/.config/ipython-config.json. Only settings that are different from default are saved and the values are pruned each time to ensure that any old config values are removed. Any config.py, if present, re-defines the user's default.

I've been careful in the way I have designed this change and to keep it very generic so please ask questions here if you think something looks odd.

jonathanslenders commented 1 year ago

Thanks, I'll look into this soon. Maybe I'll end up cherry-picking changes from here. This is a great start.