Open ocket8888 opened 4 years ago
Hmm, for now you could solve this yourself by using a pre-build-command
(https://github.com/ammaraskar/sphinx-action#advanced-usage)
You'd probably want:
pre-build-command: "apt-get update -y && apt-get install -y python-dev build-essential"
But you're right, this is a pretty common use case. Let me monitor for a bit, if it comes up again I'll bake the packages needed for C extensions into the image.
Another workaround pre-build-command:
is apt-get update -y && apt-get install -y python3-psutil
because the packages are available pre-built through distro package managers
I've been taking a look at https://github.com/search?p=1&q=ammaraskar%2Fsphinx-action&type=Code every once in a while. Looks like this hasn't popped up as a use case for many people (or they tried it and gave up :D). Did your pre-build-command
solution work for you?
yeah, but that depends on the package being available as a binary on PyPI - if my package was itself a CPython extension I'd need to use your workaround to get it to build.
FYI I needed the workaround for psutil in https://github.com/mne-tools/mne-nirs/pull/186
@ocket8888 For my workflow, I modified this action into a composite action. Now I can compile, and setup all the required dependencies before the sphinx-build and commenting script are run. You can check it out on my fork. I will add the ability to install Python/sphinx and other dependencies if they are not yet installed in the future when the uses
keyword becomes available for composite actions.
I use autodoc for one of my packages that imports
psutil
whichpip
will try to build natively usinggcc
. The build fails, though, with the error:gcc: command not found
. I'm not sure how you'd detect that at runtime, but a possible solution is just including an entire C compiler in the image. Which I know isn't ideal, butpsutil
is pretty widely used, so I think it's a common use-case.