Python Packaging Cheatsheet
This is an area for me to put my notes/resources to do with creating Python packages before I forget about them. When I learn how to work around an issue, I'll put my notes here.
- Lecture - Publishing (Perfect) Python Packages on PyPi
- Install Python Packages Hosted On Private GitHub
- Simple example package on GitHub
- Extended example package with binary assets on GitHub
- A wheel file is a single "bundle file" for your package that you can install from. This may be the simplest way to distribute and install your package.
- Installing from a wheel file can be much faster than installing from a GitHub repository for heavy packages (machine learning or large assets).
Build the wheel file with:
python setup.py bdist_wheel
package_data option will allow things to be installed correctly when pip installing from a GitHub repository or URL,
but only if data assets are included in the
Manifest.in file, will the assets be included in the generated wheel file.
graft line to include all files within a directory in your package. E.g.
If using GitHub/GitLab for a source to install packages from with pip, and the repository makes use of LFS, then ensure you have LFS installed on your client e.g.
sudo apt-get install git-lfs -y.
I ran into this when trying to install packages inside a Docker container.
First published: 6th October 2021