Layout for Client/Server project with common code
Question: I'm working on a client/server application in Python, where client and server
share a lot of code. How should the folder structure look like?

My idea is to have three folders with the code files in it

  * server 
    * server.py
    * etc.
  * client 
    * client.py
    * etc.
  * common 
    * common.py
    * etc.

But how can I import from common.py in server.py when server.py has to be
executable (can't be a package)?

Currently we have all files in the same folder but since the project got more
complex this isn't manageable anymore.


Answer: One solution is to have the executable scripts all at the top folder like
this:

  * server 
    * server specific code
  * client 
    * client specific code
  * common 
    * common code
  * server.py (executable script that imports from server and common)
  * client.py (executable script that imports from client and common)

When deploying the server I just copy server.py, the server and the common
folder. Similar for the client.

It's not the ideal solution and I'd be thankful if someone comes up with a
better one but that is how I use it now.

