diff --git a/34_PyPackaging/assets/venv-demo-1.png b/34_PyPackaging/assets/venv-demo-1.png new file mode 100644 index 0000000..5152b40 Binary files /dev/null and b/34_PyPackaging/assets/venv-demo-1.png differ diff --git a/34_PyPackaging/assets/venv-demo-2.png b/34_PyPackaging/assets/venv-demo-2.png new file mode 100644 index 0000000..6ebdec7 Binary files /dev/null and b/34_PyPackaging/assets/venv-demo-2.png differ diff --git a/34_PyPackaging/assets/venv-demo-3.png b/34_PyPackaging/assets/venv-demo-3.png new file mode 100644 index 0000000..676cb96 Binary files /dev/null and b/34_PyPackaging/assets/venv-demo-3.png differ diff --git a/34_PyPackaging/assets/venv-demo-4.png b/34_PyPackaging/assets/venv-demo-4.png new file mode 100644 index 0000000..0a0bb5b Binary files /dev/null and b/34_PyPackaging/assets/venv-demo-4.png differ diff --git a/34_PyPackaging/assets/venv-demo-5.png b/34_PyPackaging/assets/venv-demo-5.png new file mode 100644 index 0000000..748347b Binary files /dev/null and b/34_PyPackaging/assets/venv-demo-5.png differ diff --git a/34_PyPackaging/assets/venv-demo-6.png b/34_PyPackaging/assets/venv-demo-6.png new file mode 100644 index 0000000..14c6b88 Binary files /dev/null and b/34_PyPackaging/assets/venv-demo-6.png differ diff --git a/34_PyPackaging/main.md b/34_PyPackaging/main.md index 4141d03..a184eab 100644 --- a/34_PyPackaging/main.md +++ b/34_PyPackaging/main.md @@ -304,7 +304,54 @@ environments work. Let's take a look at a `venv` virtual environment and what happens when I install packages in it. -[LIVE] + +```bash +$ which python # none found--it's called python3 +$ which python3 # /usr/bin/python3 +$ python3 --version # Python 3.10.12 +$ python3 -m venv tmp/my-venv +$ source tmp/my-venv/bin/activate +$ which python # now returns ~/tmp/my-venv/bin/python +``` + + + + +Note the paths: +- `''` will give the current working directory +- `/usr/lib/python310.zip`, `/usr/lib/python3.10`, `/usr/lib/python3.10/lib-dynload` +are for preinstalled packages +- `/home/jsoules/tmp/my-venv/lib/python3.10/site-packages` is what we care about + + + + + +Now let's install numpy! + +```bash +$ pip install numpy +``` + +And see that `numpy` gets copied into the package directory. + + + + +What about a local package installed in editable mode? + + + + +Note we get a project descriptor, but no actual code directory. + +Instead: + + +The project src directory gets added to `sys.path`. + +This means my changes are visible live--no reinstall needed. + ## Properly Handling Python Projects