TDS Archive

An archive of data science, data analytics, data engineering, machine learning, and artificial intelligence writing from the former Towards Data Science Medium publication.

Member-only story

Use git submodules to install a private, custom python package in a docker image

Mike Huls
4 min readJul 27, 2021

--

This Python is packaged up and ready to be shipped! (image by Worldspectrum on Pexels)

Wow that title contains a lot of terms! Simply said this article offers you the best way to share your Python code privately and easily, even run it in a docker container! In the end you’ll be able to distribute private packages that run everywhere, are easily maintainable and updateable. Let’s code!

Preparation

You’ve created a Python script with all kinds of handy functions that you want to share with others. You have two choices on how to approach this:

  1. Package your code and distribute it publicly on PyPi as detailed in this article. This means that anyone is able to install the package by just calling pip install yourpackage just like pandas e.g.
  2. Package your code and distribute it privately as detailed in this article. This means that only certain people are able to install the package, like coworkers in your company.

We are going for the second option, making sure that our code stays private. We’re going to build upon the article in the second option so make sure to read it first. After reading it you’ve got a Python package that you can pip install from your git repository.

--

--

TDS Archive
TDS Archive

Published in TDS Archive

An archive of data science, data analytics, data engineering, machine learning, and artificial intelligence writing from the former Towards Data Science Medium publication.

Mike Huls
Mike Huls

Written by Mike Huls

I write about interesting programming-related things: techniques, system architecture, software design and how to apply them in the best way. — mikehuls.com

Responses (3)