Modern Python Projects Transcripts
Chapter: Python versions and packages
Lecture: Summary

Login or purchase this course to watch this video and the rest of the course contents.
0:00 It was a very long chapter.
0:01 But if you're watching this video and you followed all the steps,
0:04 you should now have a rock solid set up for your future Python projects.
0:08 Let's quickly recap what we did and how it's going to help us.
0:11 First, we installed pyenv, so we can easily install different versions of python and
0:16 switch between them. So with pyenv to install new python version,
0:20 you can use pyenv install and the name of the version,
0:24 and then you basically use one of the three commands.
0:27 If you want to change the global Python version on your computer,
0:30 then you're gonna use pyenv global.
0:32 If you want to change Python version for this current folder and all the sub folders
0:36 you going to use pyenv local.
0:38 And finally, if you want to set specific Python version for the current shell session
0:42 you're gonna use pyenv shell.
0:45 The main benefits of using pyenv are, first
0:48 You don't mess with the Python version that it's already installed on your computer.
0:52 You should never update the system python because there are other programs that depends on this
0:57 specific version. If you updated,
0:59 they will break. Once you have pyenv installed and working,
1:03 you are almost guaranteed that installing new version of python through pyenv will be successful
1:08 There might be some problems with your first python version,
1:12 because you might be missing some dependencies,
1:14 but once you sort it out,
1:16 it's gonna be much easier to install.
1:17 new python version. The biggest benefit is that you can install multiple versions of python
1:22 and instantly switch between them. This is super useful if you're working on different projects
1:27 that use different python versions. Because if you quickly need to switch,
1:31 let's say, from Python 3.9 to 3.6.
1:34 It's just one command away.
1:37 And if you mess up something you can easily reinstall pyenv,
1:40 you just remove the .pyenv folder and you install pyenv again.
1:45 or we can completely uninstall pyenv, and you'll be back to whatever version of python you
1:50 have used on your computer before.
1:52 Next, we saw how to use virtual environments, so we will no longer have problems
1:57 that one python package uninstalled some other python packages.
2:01 How you are going to use virtual environments depends if you're using the built in venv
2:05 module for one of the tools,
2:07 for example, the virtualenvwrapper that I recommended.
2:10 But basically, in both cases,
2:12 you first need to create a virtual environment.
2:15 Then you need to activate it to start using it.
2:17 And when you are done or when you want to switch to a different virtual environment
2:21 you have to deactivate it.
2:23 Some of the benefits of using virtual environments include starting with python 3.3 venv is a
2:29 built in module in python, so it's a default standard for managing dependencies In
2:34 Python World. Virtual environments isolate packages between your projects,
2:39 so each python project on your computer has its own set of dependencies,
2:43 and they can all live in harmony.
2:46 And if you mess something up,
2:47 you can always delete a virtual environment and create a new one.
2:51 Finally, we installed pipx,
2:53 so our global python packages are nicely isolated from each other.
2:58 We no longer risk that when we install a new python package globally,
3:01 it will mess up some other packages.
3:05 We could solve this problem by always using virtual environments,
3:08 but it's very inconvenient. So when you use pipx,
3:12 the only difference is that Now you have to install global packages with pipx install
3:18 command, instead of the usual pip install.
3:21 Main benefits of using pipx are that it isolates global packages.
3:25 So you no longer risk that installing one global package will uninstall dependencies for some other
3:32 global package. And it's pretty transparent to use, when you install a package using pipx.
3:37 You can use it as you would normally use that package if it was
3:40 installed with pip. With all those tools set up,
3:44 we are ready to start building python projects in the next chapter.