Date created: 09/07/18 09:36:37. Last modified: 05/18/20 15:30:04
--Python Notes--
Linting:
https://black.readthedocs.io/en/stable/
Pip:
List installed packages with:
pip3 freeze
or
pip3 list
Upgrade pip:
sudo -H pip3 install --upgrade pip
or
sudo -H pip install --upgrade pi
On Mac with brew installed Python3:
/Library/Frameworks/Python.framework/Versions/3.7/bin/python3 -m pip install --upgrade pip
Python Guides:
https://treyhunner.com/2019/05/python-builtins-worth-learning/
Style Guides:
https://google.github.io/styleguide/pyguide.html
https://github.com/google/styleguide/blob/gh-pages/pyguide.md
venv:
$ sudo apt-get install virtualenv
$ virtualenv -p `which python3` v1
$ cd v1/
$ source bin/activate
...
$ deactivate
Testing a specific branch in a venv:
$ mkdir napalm-text
$ git clone -b confirm_username_fix https://github.com/napalm-automation/napalm.git ./napalm-text/
$ cd napalm-text/
$ virtualenv -p `which python3` ./
$ source bin/activate
$ sudo -H pip3 install ./
...
$ deactivate
$ cd ../
$ rm -rf napalm-text/
Previous page: Problem 20
Next page: Basic Netmiko Example