Imagine you're in a Python setup, with all of the projects you're working on. Now, as a base line, you have a Python module that is the backbone (backbone.py) to everything when it comes to getting data from a datasource. There is also a FastAPI implementation of this this backbone (backbone-api.py), offering a handy way of getting the data out.
Now, there is another project emerging, which needs to use the data of the backbone. Also implemented with python and FastAPI (different-angle.py). Pretty much just a different angle of the data.
There appear to be two options:
Option A: Importing the backbone module directly into the new project, to allow direct access to the data and best performance.
Option B: Using the FastAPI implementation of the backbone, to simplify the process, but at the cost of latency.
To my mind, Option A seems to be slightly better. This is mostly as this will increase performance and leverages Python modules better. Option B has the advantage of being an easy setup, as you don't need to install the backbone module and its configuration. This is probably also fine for smaller operations, but Option B would probably have some disadvantages when it comes to returning larger amounts of data.