PeetRonics' blog

All can be true!

Tue 03 December 2019 - read time: 2 min.

What I Have Learned Today - #029


Python Package logo

Today I learned to make my first Python Package 😁.

We’ve got an ever growing list of Python Projects within our company and we are no stranger to some copy-paste action of code snippets between these projects/repositories. Though there are cases where this is absolutely fine, most of the time this is bad practice.

One of the ways we’ve tried to counteract that is by keeping as much as possible within one code-base. But that is becoming more and more of a problem (and also bad practice).

Knowing about 3rd party Python Packages (of course we use them a lot), I have wanted to craft of my own package for some time, as a solution for sharing generic modules between projects. I always thought it required a good dose of black magic, but hey, never too late to learn that 😈.

I followed this tutorial from the Python Packaging Authority, and, surprise surprise, it was a lot easier than I thought!

For now I wouldn’t go as far as submitting the package to PyPi as it is purely for internal use. Which doesn’t mean I won’t do in (the foreseeable) future.

We do have an internal package manager called ProGet. But naive me thought this was only for .Net. Turns out it supports local Python Packages. Who knew! Learned that as well as an added bonus today 😆.

Pretty sure I will do some more packaging this month 😉 🎄

This post is part of a series of articles about “What I Have Learned Today”; acknowledging every day the thing I have learned. Feel free to read the other posts. all opinions in this article are my own and not necessarily represent the views of my employer.