1

I have a package that contains protocols for specific hardware from multiple vendors. This is basically a collection of multiple different protocols that have similar interface. It is ported to python by me. But now I have two projects that handle communication with this equipment using different transport protocols one is over TCP another is over RS-485/232. How to share the package with protocols between this two projects so that I don't need to copy it after I add new functionality support or bug fixes.

asked Mar 30, 2017 at 8:45

1 Answer 1

7

You can build a python package (more info here: https://python-packaging.readthedocs.io/en/latest/)

Once you have created your package containing a setup.py file, you can install it on your machine using the command pip install -e myPackage (where "myPackage" is the folder containing the setup.py file). The advantage of using the -e flag is that changes made to your package are directly included in the installed version.

Once your package is installed, you can share it across multiple projects, simply by importing your package in Python, e.g.

import myPackage as myPackage
Josh Correia
4,4103 gold badges42 silver badges67 bronze badges
answered Mar 30, 2017 at 8:57
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.