Python Packaging
🐍

Python Packaging

Tags
Location
Published
Published November 29, 2024
Author
Apoorva Singh
How hard can it be to share a Python application/script that you want to share with a non-technical friend using a Microsoft Windows box? Turns out its not straight forward at all.

My Audience

I need to target two types of people:
  1. Technical people using Mac
  1. Non-Technical people using Windows

My Requirements

  1. Works on Windows
  1. Works on Mac
  1. Carry all its dependencies
  1. Ability to build for all targets from 1 development machine (optional)

Initial Outlook

Packaging for *nix like environments seems far easier than shipping something for Windows.
My goal is to find a basic set of tools that I can use to package my application and distribute it within my team reliably.

pipx

Github. pipx is a tool to help you install and run end-user applications written in Python. It's roughly similar to macOS's brew, JavaScript's npx, and Linux's apt.
  • focused on installing and managing Python packages that can be run from the command line directly as applications.
  • Expose CLI entrypoints of packages ("apps") installed to isolated environments with the install command. This guarantees no dependency conflicts and clean uninstalls!
 
I am using it to publish my application to PyPI and then use pipx install myapp to use it in an isolated on any computer I want.
 

Publishing and Distribution

The applications that we build and use are not exactly meant to be in the public domain. How can we securely publish python apps while still maintaining the simplicity?
 

devpi

Docs. It is a MIT-licensed devpi system features a powerful PyPI-compatible server and a complementary command line tool to drive packaging, testing and release activities with Python.
 
We use devpi to host our private python packages that we then use within our organisation.