PyCharm, how to setup self contained subprojects

zljubisic at gmail.com zljubisic at gmail.com
Thu May 21 21:41:49 EDT 2020


Hi,

I should provide python code for (Spring) microservice patform.
In microservice paradigm, each microservice should do a simple task, so python code beneath it should be very small. 

As a PyCharm (community) user, I don't know how to set up such development environment.

Each microservice could be a separate PyCharm project, but these projects should share some common classes. For example, let's say that you have a class for communication with outer world.
Each PyCharm project (microservice) should use instance of this class, and do the different things with its data.

I would like to avoid coping this common object to each PyCharm project (and prevent refactoring).

Another, requirement is deployment of PyCharm project to the microservice platform.
At the moment, my each microservice code is in separate project.
I am coping each project files on separate folder on deployment server.
So, each PyCharm project has its own main.py (the name of main.py can be different for each microservice).

On deployment servers I cannot install anything.

Another approach would be to have single PyCharm project with many root directories for microservices and multiple main.py files.

In this case, when I deploy a single microservice, I will have trouble finding out what files I should copy (common classes), or to copy everything from PyCharm project, but specify main.py for specific microservice (root).

If anyone is in the same situation, please share how you have set up PyCharm for such purpose, and how you are doing development.

Regards


More information about the Python-list mailing list