mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-11-13 12:13:36 +01:00
fix(ipython): keep in-session history in memory only
Assisted-by: DeepSeek Harness (deepseek-flash)
This commit is contained in:
1 parent
d7c493f5cd
commit
9f29b48bf6
3 files changed
+12
-9
No files matched your search
@@ -2,7 +2,9 @@
|
||||
|
||||
[`default.nix`](./default.nix) manages `~/.ipython/profile_default` with two pieces:
|
||||
|
||||
- `ipython_config.py` disables SQLite history because interactive sessions may contain secrets.
|
||||
- `ipython_config.py` keeps SQLite history in memory (`HistoryManager.hist_file = ":memory:"`), so
|
||||
arrow keys and `%history` recall the current session while nothing is written to disk, because
|
||||
interactive sessions may contain secrets.
|
||||
- `startup/10-data-helpers.py` loads JSON, YAML, TOML, and CSV helpers at every IPython start. It
|
||||
also pre-imports a small set of common standard-library names such as `Path`, `Counter`, and
|
||||
`datetime`.
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
{ ... }:
|
||||
{
|
||||
# Interactive IPython sessions routinely handle credentials and other
|
||||
# sensitive values, so keep the SQLite history disabled rather than relying
|
||||
# on the profile directory's lifetime. Home Manager recreates these files
|
||||
# from the Nix store on every activation.
|
||||
# sensitive values, so keep the SQLite history in memory instead of on disk:
|
||||
# arrow-key recall and %history still work within a session, but no history
|
||||
# file is written. Home Manager recreates these files from the Nix store on
|
||||
# every activation.
|
||||
home.file = {
|
||||
".ipython/profile_default/ipython_config.py".text = ''
|
||||
c = get_config()
|
||||
c.HistoryManager.enabled = False
|
||||
c.HistoryManager.hist_file = ":memory:"
|
||||
'';
|
||||
".ipython/profile_default/startup/10-data-helpers.py".source = ./data-helpers.py;
|
||||
};
|
||||
|
||||
@@ -222,10 +222,10 @@ in
|
||||
".config/Joplin" # joplin-desktop
|
||||
|
||||
".local/share/jupyter"
|
||||
# Deliberately not persisted: ~/.ipython contains history.sqlite, and
|
||||
# interactive sessions may contain credentials or other sensitive
|
||||
# values. Home Manager recreates the profile config and startup helpers
|
||||
# from the Nix store on every activation.
|
||||
# Deliberately not persisted: IPython keeps its history database in
|
||||
# memory (HistoryManager.hist_file = ":memory:") and the profile config
|
||||
# and startup helpers are recreated from the Nix store on every
|
||||
# activation, so this directory holds no state worth preserving.
|
||||
|
||||
# ======================================
|
||||
# Cloud Native
|
||||
|
||||
Reference in new issue
Block a user