Search code examples
pythongoogle-app-enginepipgoogle-cloud-endpointsmicroservices

how to deploy shared library in google app engine flex environment


I'm using app engine with cloud endpoints to deploy APIs. All service in the following description is about APIs.

I know in app engine flex env, I could deploy several independent service which talk to each other only through REST.

It's a great idea to make services as independent as possible, but there are some opportunities for code reuse I don't know how to achieve.

For example, there are same procedures I will need to use regardless which API under which service. Usually I'll write a helper library so all these small helper functions would be in one place and I could reuse them across various APIs.

The purpose is to write once and use at many places.
So my questions:

  1. Is this shared library still good idea under the context of app engine? If not, wouldn't it has too much overhead to make all those small function as api?
  2. If shared helper library still make sense, how to achieve it in app engine flex environment? I know in standard env you could use includes directive to include files, I don't see how in flex environment.
  3. I know we could use 3rd party library by declaring them in the requirement and pip support install from github repo, but my helper library would be a private repo, how to allow app engine to pip install private repo?

Thanks in advance.


Solution

  • You can specify private dependencies in requirements.txt files. You would do this in the same way you would handle private dependencies for any other python package. You might directly specify a github url, or you might use a private repository such as an instance of devpi.