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

Other Useful Python Packaging Tools

This is the last lesson of the course and can be seen as a kind of appendix. It provides you a collection of additional useful Python packaging tools you may want to check out.

00:00 Now that you have an understanding of how to upload a project to PyPI, this will be kind of like an appendix video and cover a couple tools you can use to better manage your projects. Feel free to try them out on your next one.

00:13 The first thing we’ll cover are virtual environments. Now, we didn’t talk much about virtual environments, but they can help you with managing your dependencies. Because it’s so easy to pip install everything, your main Python distribution might end up with lots of things that conflict or aren’t easy to share with others. Virtual environments simplify this for you by giving you what’s basically a fresh install of Python to work with, and allow you to make sure your setup.py file has everything you need.

00:42 Another useful tool is Cookiecutter. Cookiecutter is based on setting up projects based on a template and a series of questions. Once you find a template that you would like to use, you can go ahead and run it with the link to that template, and you’ll get a series of prompts that you fill out and it’ll generate a project for you.

01:01 A good thing about Cookiecutter is there’s plenty of documentation out there for you to look at if you run into trouble or want to try something new. But it’s very general, and there are some other tools that we can use that are a bit more specific to publishing packages to PyPI. So let’s talk about Flit.

01:18 Flit is based on the thought that using an executable like setup.py is not ideal for building a package. PEP 518 recommends to use a .toml file, instead. TOML files are human readable and not too complex.

01:35 What Flit will do is it will work like Cookiecutter and ask you a series of questions, and then it will set up your project based on your answers to those questions.

01:44 A cool thing about Flit is that you can build using Flit and then you can even publish directly to PyPI from Flit. Finally, we’ll talk about Poetry. Poetry is very similar to Flit in that it will ask you a series of questions to structure your project.

02:01 You can then also build your package and upload it to PyPI through Poetry. Where Poetry is different is that it’s more focused on dependency management, and it works well with virtual environments.

02:14 Another cool thing about Poetry is it will add classifiers based on the license you select and the Python versions you indicate. By now, you know that you spend a good bit of time setting up the structure of your projects before you can get them onto PyPI, so take a look at some of these tools and see if they can help you speed up that process. There are links below to the documentation for each, so you can jump around and see if anything catches your eye. And that’s it!

02:40 Being able to upload packages to PyPI is an incredibly powerful tool for you to use as a developer and allows you to get your work in front of the entire Python community. Now it’s time to go out and see what you can do.

02:53 Thanks for watching.

Avatar image for derekm

derekm on Jan. 16, 2020

Good overview of how to package/publish.

Avatar image for johnbarney772

johnbarney772 on March 27, 2020

Thank You

Avatar image for ibrahim suleiman

ibrahim suleiman on March 29, 2020

thanks alot i really do appreciate

Avatar image for Abdullah Alhadab

Abdullah Alhadab on April 3, 2020

Thank you so much. It is a great course

Avatar image for hmhassanmehmood

hmhassanmehmood on April 15, 2020

Thanks for sharing!

Avatar image for Neeraj

Neeraj on May 28, 2020

Thanks for tutorial.

Avatar image for shivharep

shivharep on May 29, 2020

Very helpful tutorial

Avatar image for Marcelo Garbarino

Marcelo Garbarino on June 11, 2020

Thanks!

Avatar image for Ceteris Paribus

Ceteris Paribus on June 12, 2020

Thank you. Very interesting and informative.

Avatar image for laurentprat

laurentprat on Sept. 9, 2020

Thank you. Really important stuff btw

Avatar image for vlizana

vlizana on Sept. 10, 2020

Nice tutorial! It seems that pip is taking over dependency management with its new resolver. As further reading I would recommend cookiecutter’s pypackage template, which even though the repo is a bit outdated, it has a lot of new features to learn like continuous integration.

Avatar image for Alexia

Alexia on Sept. 2, 2021

Thank you for the course :)

Avatar image for historicode97

historicode97 on Jan. 21, 2022

Great tutorial on publishing to PyPi!

Avatar image for dennisvdijk

dennisvdijk on April 19, 2022

Not only is it helpful to publish to PyPi but it takes also, moderately, version control into account which could stir new insights (and interests :) ).

Avatar image for JBrooks

JBrooks on June 2, 2022

Programming is not my craft but I’m trying to learn more about the workflows to help me with my day job and this was fun. I felt on the cliff at times but was happy to have posted my content to the test pypi site. Thanks for a great tutorial!

Become a Member to join the conversation.