DEV Community

Cover image for How to Python Package 📦  - Start to Finish

How to Python Package 📦 - Start to Finish

mbnlc profile image mbnlc Updated on ・2 min read

Recently, I published my first python package. In this series I want to briefly outline how I built yflive from start to finish. Moreover, I want to focus on some of the nuances that made my life easier while building and maintaining my own package.

Please keep in mind, that I am not an expert on this topic. I am simply sharing my experience.

For the sake of readability and my mental sanity I shall split this up into multiple posts... 😃

Why write a python package?

Building a python package has helped me gain a better understanding of opensource and the python universe. A package in itself forces you to compile a set of functionalities together, allowing you to work more thoroughly. For me personally this was a big help, as I tend to stray away from personal projects as soon as something 'new' and 'exciting' comes along. (Also the reason why I built yflive...).

As something intended to be publicised, I found myself writing cleaner code because I new other people would eventually see it. Sloppy code/documentation may be fine in personal projects. However, adopting a clean style has helped me stay focused on writing code that matters, without having to repeatedly go back to understand older components. This allows you to stay focused on a single project at a time and gives you the opportunity to switch between different projects without a lot of overhead.

What should I build?

Well, this is kinda up to you...

I'm guessing you might have an idea as you're reading this. Or you've already publish a python package. On the other hand, it could be, that your reading this out of pure interest and don't have an idea yet.

In any case, I suggest you wait until an opportunity presents itself. Don't force yourself.

I built yflive as part of a larger project (a framework for live-testing stock trading strategies) after discovering there was no good, reliable and free way of getting my hands on some real-time stock data. I did some research and discovered, my approach hadn't been published yet.

Because I already new what I wanted to build and why I wanted to build it, I had a clear path to follow.

Alt Text

The road ahead

In the following couple posts I want to give you an understanding of how to build your own python package, how to publish it and how to maintain it.

As I previously said, I am not an expert and I can only speak from personal experience.

The next post will cover how to set up a new project in a clean environment, giving you a good starting point for building the core functionality of your package.

Hope to see you there! 😃

Shameful advertisement:

If you want to check out my own python package you can find it on GitHub and Pypi. Always looking for contributors and things to improve.

Discussion (0)

Editor guide