From df7a1f481e26f9c495db76809f7e9b7f7b6e30d3 Mon Sep 17 00:00:00 2001
From: neodarz <neodarz@neodarz.net>
Date: Sun, 31 Mar 2019 23:13:43 +0200
Subject: Add more cheat

---
 cheat/.cheat/pip | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)
 create mode 100644 cheat/.cheat/pip

(limited to 'cheat/.cheat/pip')

diff --git a/cheat/.cheat/pip b/cheat/.cheat/pip
new file mode 100644
index 0000000..9b438ea
--- /dev/null
+++ b/cheat/.cheat/pip
@@ -0,0 +1,34 @@
+# Search for packages
+pip search SomePackage
+
+# Install some packages
+pip install SomePackage
+
+# Install some package in user space
+pip install --user SomePackage
+
+# Upgrade some package
+pip install --upgrade SomePackage
+
+# Output and install packages in a requirement file
+pip freeze > requirements.txt
+pip install -r requirements.txt
+
+# Show details of a package
+pip show SomePackage
+
+# List outdated packages
+pip list --outdated
+
+# Upgrade all outdated packages, thanks to http://stackoverflow.com/a/3452888
+pip freeze --local | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip install -U
+
+# Upgrade outdated packages on latest version of pip
+pip list --outdated --format=freeze | cut -d = -f 1 | xargs -n1 pip install -U
+
+# Install specific version of a package
+pip install -I SomePackage1==1.1.0 'SomePackage2>=1.0.4'
+
+# Best pratice to use pip
+# source: https://linuxfr.org/users/oliver_h/journaux/quelques-bonnes-pratiques-python-pour-2019
+python3 -m pip <same syntax as above>
-- 
cgit v1.2.1