Custom Python packages in Docker image

Hi,
It would be great if there was a simpler way to include extra Python libraries into self-hosted Grist instance.

I think it could be easily done if the Docker image would take additional ENV variable EXTRA_PYTHON3_REQUIREMENTS
that could be set to i.e. /persist/requirements.txt that would get installed then container gets created.

I imagine you could run potentially into clashes if user wants to install higher version of package than Grist supports/needs, but I guess if you install from user provided requirements.txt first and then force install Grist default requirements.txt on top of that then it should be sufficient solution for now.

3 Likes

Your idea makes sense @Pawel_Cwiek. My one concern would be needing to go through an installation step each time a container is created. Perhaps a volume could be mounted or a subdirectory of /persist used to store and retain the installed material?

Hi, I’m not that fluent in Docker and it’s still quite new for me, but your suggestion on subdirectory of /persist makes sense. When creating a container you would still need to always try to install from that custom requirement var specified file but it could skip the packages already present in that persist subfolder from previous installs

1 Like

Just was having a thought about this, the easiest way to implement this in the way as you mentioned @paul-grist I think would be if that env variable was a path that would get appended to PATH system variable inside container. Python then uses that variable to discover available packages

1 Like