Reusing Python Packages over GitHub

Well, the title speaks for itself. In this article, I will demonstrate how to reuse a Python library in various projects over GitHub.

I prefer this method over reusing local files due to benefits of GitHub.

Library Project

In this article, I will use a sample library called “Databus”.

The project structure should look like this:

  • All of your Python library files should be placed in a package called “databus”
  • Your folder root should contain a file called “”
  • It’s nice to include a file (optional)

Here is how the folder structure would look like:

Note that all of my library files are placed under a folder called databus. This ensures that the client may use the libraries as databus.driver.primal_driver ; without mixing them with their main project.

Here is how looks like:

import setuptools

    author="Kerem Koseoglu",
    description="A framework to transfer data between systems",
    long_description="A framework to transfer data between systems",
        "Programming Language :: Python :: 3",
        "License :: OSI Approved :: MIT License",
        "Operating System :: OS Independent",

The content is pretty intuitive. You ideally need to increase the version in case you make new releases though.

At this point, you can push the library project to GitHub.

Client Project

What we need to do for the client project is pretty simple.

First, ensure that your virtual environment is activated. This can be achieved with the following terminal command:

. venv/bin/activate

Once your virtual environment is active, you can use the following command to install the library client:

pip install git+

Obviously; the path would depend on your GitHub username and project name – but that’s how the command should look like.

Once pip finishes working, you can start using the library right away!

""" SAP sales order creation module """
import json
import requests
from databus.pqueue.queue_status import PassengerQueueStatus, QueueStatus
from databus.pusher.abstract_pusher import AbstractPusher

class Sap(AbstractPusher):
    """ SAP sales order creation class """
    def __init__(self, p_log=None):

In Visual Studio Code, you might need to change the environment to your OS environment & back to the project virtual environment for the IDE to detect the new package.

Voila & cheers!








Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s