+ - 0:00:00
Notes for current slide
Notes for next slide

28: Python virtual environments, VSCode launch configurations, packages w/ pip and requirements.txt

1 / 10

Our bug from yesterday: a Vim browser extension

  • If anyone else uses Chrome Remote Desktop with Vimium active, you have been warned!
3 / 10

Python virtual environments (in VSCode)

  • Virtual environments at a high level -- sandboxing project packages so that they don;t interfere with each other
  • In VSCode specifically: https://jasonmurray.org/posts/2020/vscodepythonvenv/
  • In the integrated terminal, run:
    • python -m venv .venv
    • And then ./.venv/Scripts/activate to activate the virtual environment
4 / 10

Setting up a launch configuration in VSCode

Example:

{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"configurations": [
{
"name": "Preprocess",
"type": "python",
"request": "launch",
"program": "main.py",
"console": "integratedTerminal"
}
]
}
5 / 10

Python packages, the Python package index, and pip

Example:

  • Let's say you want to build a URL from a file path. URLs don't have spaces (conventionally), and usually follow a specific format. To get strings in a format, we can download a package and use it: https://pypi.org/project/python-slugify/
6 / 10

Python packages, the Python package index, and pip

Let's say we had a simple program like the following

import slugify
def make_url(input_string):
return slugify.slugify(input_string)

You can also just import the function directly (from slugify import slugify = in the format of from module_name import function_name), and then you don't need to worry about the module name when invoking the method.

7 / 10

Package dependencies at the project level, requirements.txt

8 / 10

Preview: Git (with Git bash), SourceTree, and GitHub (remote repository host)

  • Git is a version control system. There are other options too, but Git is probably the most popular.
  • Version control systems track the changes you make to files over time, and are absolutely essential to the software development process, especially when working on a team of developers.
  • Today we will just be downloading and setting up a couple tools. We will get into specifics in our next lesson

9 / 10
Paused

Help

Keyboard shortcuts

, , Pg Up, k Go to previous slide
, , Pg Dn, Space, j Go to next slide
Home Go to first slide
End Go to last slide
Number + Return Go to specific slide
b / m / f Toggle blackout / mirrored / fullscreen mode
c Clone slideshow
p Toggle presenter mode
t Restart the presentation timer
?, h Toggle this help
Esc Back to slideshow