Skip to content

Instantly share code, notes, and snippets.

@malkab
Last active May 30, 2021 18:04
Show Gist options
  • Save malkab/7d19b982203923678154e9367c7043e6 to your computer and use it in GitHub Desktop.
Save malkab/7d19b982203923678154e9367c7043e6 to your computer and use it in GitHub Desktop.
Python

Python Virtualenv

The interesting thing about virtualenv is that it allows a flexible NPM-like, in-project package management for Docker. Once the code is ready for production images, install them globally within the production image. Virtualenv is installed by default in our malkab/python Docker image.

Steps:

  • creating the virtualenv:
virtualenv libpyexample
  • activating:
. libpyexample/bin/activate
  • list packages installed:
pip list

Jupyter

To install:

pip3 install jupyter

To run locally, launch it in the folder containing the notebooks:

jupyter notebook

All notebooks present in the folder will be adquired, and all new ones created will be put in it.

Command Mode Shortcuts (press ESC to enable this mode):

Key Command
Enter Enter edit mode.
Shift-Enter Run cell, select below.
Ctrl-Enter Run cell.
Alt-Enter Run cell, insert below.
Y  To code.
M To Markdown.
R To raw.
1,2,3,4,5,6 To heading 1,2,3,4,5,6.
Up/K  Select cell above.
Down/J Select cell below.
A/B Insert cell above/below.
Cut selected cell.
C  Copy selected cell.
Shift-V  Paste cell above.
V  Paste cell below.
Z Undo last cell deletion.
D,D  Delete selected cell.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment