A question to the Python professionals here (which...
# help
b
A question to the Python professionals here (which I am not, obviously): I read a number of posts regarding the use of custom (unpublished) Python projects inside a nextflow pipeline. My problem seems to have a different root, though. My pipeline runs with docker and I try to use officially released docker images throughout. One of the tools, however, sets some parameters in a
params.py
module which is part of the tool code base inside the docker image. I tried adding a modified
params.py
to the
/bin
directory in the pipeline and adding this path to the
PYTHONPATH
variable. I checked that
PYTHONPATH
is correctly set and that
params.py
is accessible inside the nextflow module. However, it does not seem to work, and the module (and the parameters) are still loaded from the original file. Any ideas why that is? Any hints how to deal with tools that hard-code parameters (except building custom docker images)?
a
The
PYTHONPATH
from outside the docker image probably isn’t propagated inside the docker image, and neither should it really be. Depending on how this tool is designed/packaged, then simply putting a custom
params.py
on the
PYTHONPATH
ahead of the embedded one wouldn’t work anyway, and even if it did it’s a horribly hacky way of managing it. I would either ask them to change how those variables are set, fork and modify the tool, or if you are already the tool author, make the params you need to override configurable from the command line.
➕ 2
t
I don't know a lot about Docker, but I believe the images can be stacked in layers, so you might be able to add a layer that just overwrites that
params.py
in the image. But of course, as Arthur said, the longer term goal should be to have the authors fix how they pass parameters -- that should be done either with command line parameters or in a config file that you can pass to the tool via a command line parameter.
b
Thanks for the input. Yes, patching the docker image and automate that build is probably my best option.
👍 1
➕ 1