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

Talk Python's Mastodon Michael Kennedy's Mastodon