Mastering Python Packaging: A Comprehensive Guide to Setuptools and PyInstaller

Simplify Your Python Deployment with Setuptools and Create Standalone Executables with PyInstaller

Laxman Singh
4 min readJul 4, 2024

Packaging in python makes it easy to publish your work in simplest manner to others. Packaging also removes the system dependency and make your code look like a binary. This is very good way to remove dependency and make your code work in any environment independent of operating system kind dependency.

As a name suggests, we want to consolidate our code into one file so that it becomes easier to distribute your code. We have multiple options to do so. First option is to bundle your code and you can use the code by importing that or running to use it. And, another way is to package it as binary or executable which will make your code like running a program or app.

Tool/Library used for this purpose are : setuptools and pyinstaller

Setuptools vs PyInstaller

Using setuptools

Setuptools is capable of providing distributable code in packaged form to share and install. You can streamline the process and bring uniformity in setting up your code.

There are some prerequisite for achieving this:

--

--

Laxman Singh

Machine Learning Engineer | Data Science | MTECH NUS, Singapore