Locked learning resources

Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Locked learning resources

This lesson is for members only. Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Developing and Workflow

DevOps Libraries linked in this lesson:

Real Python DevOps Reources:

Development Environment Libraries:

Real Python Development Environment Resources:

00:00 In the previous lesson, I discussed embedded system and robotics libraries for Python. This lesson is the start of section four on development tools.

00:09 DevOps is one of those terms that’s been overloaded, and depending on who you’re talking to, they might mean something different. Within the context of this lesson, I’ll be talking about code that manages development operations.

00:22 That means automating your development process, like having scripts for building, testing, packaging, and deploying software.

00:30 There are several libraries out there to help you script and manage infrastructure. Ansible is a Python-compatible one, so why use some configuration language when you already know how to code Python?

00:42 If you’re using Docker containers in your deployment, the Docker Compose tool helps you define and manage those containers. For a list of tutorials on using Python for DevOps, see this link, or for a step-by-step process, follow this learning path.

01:00 For better or for worse, the core Python team decided not to include packaging as part of the standard library. The thinking is that different parts of the community have different needs, and the tools can be separated from the core parts.

01:12 The result is there are a lot of different ones out there and new ones all the time. Some are small tools for specific tasks, while others are entire ecosystems.

01:23 There’s still a lot going on in this space and it’s hard to write or talk about it as things are changing rapidly.

01:30 The one tool that does come with Python is the pip module. This performs the basic installation of packages from the Python Package Index. For more complex tools, pip tends to be how you bootstrap and fetch them.

01:44 conda is a huge package management system and an alternative not only to pip, but also to the Python Package Index. It’s popular in the data science space and before the invention of wheels, which are binary packages, it provided pre-compiled versions of libraries built in C. conda is quite robust and will have most packages that you want, but it doesn’t play well with pip, so you tend to want to use one or the other.

02:09 Once you start to build projects, you’re going to want different libraries for different projects. To do this, you construct virtual environments, which act like containers for groups of modules that your project depends upon.

02:20 Python standard library includes the venv command to create and manage virtual environments. For a more centralized approach, pipenv combines pip’s installation mechanisms with venv’s, virtual environment tech, all in one place.

02:36 Sometimes, you’re building a project and need an environment for it, and sometimes you want to install a library to run a specific utility. You could have one virtual environment for each utility you install, but then you have to manage them all.

02:49 What pipx does is manage installations of Python programs, automatically creating environments for each of them and managing their dependencies, so that you don’t have to. If you’re coding libraries, there’s a chance the people using your code won’t be on the same version of Python that you are.

03:05 It’s good to test on each of the Python versions that your code might encounter. The pyenv tool helps you manage multiple Python installations on your machine.

03:15 Once you’ve built code for others, you’re going to want to ship it to them. The setuptools library is the de facto module for building packages so that you can share them with other people.

03:27 Once you’ve got your package built, you might want to put it up on the Python Package Index. Twine includes tools to help you publish your code.

03:36 You may recall that I said there are loads of package building and management tools out there. Flit is yet another one for building packages, and Poetry covers even more than that, doing build, install and other things as well.

03:51 One of the newer entries to this space is uv, but man has it grown popular quickly. uv is written in Rust and so is significantly faster than other packaging tools out there.

04:01 For installation, it uses pip compatible commands, so you might even already know how to use it.

04:07 Your friends might not be programmers and don’t want to have to get Python and do all sorts of package management to run your software. Instead, you could use PyInstaller, which builds standalone installation packages for the most common operating systems out there.

04:24 As there are lots of tools, there are lots of Python articles to help you out. This link has a whole bunch of articles to help you figure out your way through this windy topic.

04:35 This learning path covers how to set up your programming environment and covers editors, packages, virtual environments, and much more. But if you need to get something started quickly and don’t have time for a full learning path, this tutorial covers a lot of the basics.

04:50 Once you’re ready to publish a package, this article can help. And if you want to learn how to use PyInstaller, this is a great place to start.

04:59 Next up, two things you’ll probably need to code with: databases and testing.

Become a Member to join the conversation.