From ad05d8420ab8fb789e47c74273927f0eff1dc2ba Mon Sep 17 00:00:00 2001 From: Stefan Imhoff Date: Thu, 12 Jan 2023 19:36:48 +0100 Subject: [PATCH] feat: add methods to backup and restore Python environment --- fish/functions/pythonBackup.fish | 3 +++ fish/functions/pythonRestore.fish | 3 +++ zsh/zshrc | 8 ++++++++ 3 files changed, 14 insertions(+) create mode 100644 fish/functions/pythonBackup.fish create mode 100644 fish/functions/pythonRestore.fish diff --git a/fish/functions/pythonBackup.fish b/fish/functions/pythonBackup.fish new file mode 100644 index 0000000..af41379 --- /dev/null +++ b/fish/functions/pythonBackup.fish @@ -0,0 +1,3 @@ +function pythonBackup --description "Python backup" + pip freeze > ~/.dotfiles/python/pip-requirements.txt +end diff --git a/fish/functions/pythonRestore.fish b/fish/functions/pythonRestore.fish new file mode 100644 index 0000000..f081705 --- /dev/null +++ b/fish/functions/pythonRestore.fish @@ -0,0 +1,3 @@ +function pythonRestore --description "Install Python packages" + pip install -r ~/.dotfiles/python/pip-requirements.txt +end diff --git a/zsh/zshrc b/zsh/zshrc index 2179af6..3dac5c5 100644 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -141,6 +141,14 @@ function homebrewRestore () { brew bundle --file ~/.dotfiles/Brewfile } +function pythonBackup () { + pip freeze > ~/.dotfiles/python/pip-requirements.txt +} + +function pythonRestore () { + pip install -r ~/.dotfiles/python/pip-requirements.txt +} + # Encode images in Base64 encodeBase64() { uuencode -m $1 /dev/stdout | sed '1d' | sed '$d'