pythonpython-3.xmulti-projectcode-sharing

How to share code between Python internals projects?


Let's say I am building an event-driven architecture, with Python microservices. I have a stream package handling all interactions with the streaming platform. It is supposed to be used internally only, in the company.

stream
    __init__.py
    produce.py
    process.py
    security.py

What are my options for sharing this package between all my Python microservices?

Should I publish my stream package so my projects can install it?

Is there some kind of Gradle for python including the Multi project feature?


Solution

  • You can package your Python code to reusable packages.

    Poetry is a popular modern tool to manage your Python package.

    Poetry, and other Python package managers like pip, can directly install private packages from an internal file server or Git link.