ammaraskar / sphinx-action

Github action that builds docs using sphinx and places errors inline
Apache License 2.0
194 stars 116 forks source link

Support dependencies that build from C source #6

Open ocket8888 opened 4 years ago

ocket8888 commented 4 years ago

I use autodoc for one of my packages that imports psutil which pip will try to build natively using gcc. 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, but psutil is pretty widely used, so I think it's a common use-case.

ammaraskar commented 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.

ocket8888 commented 4 years ago

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

ammaraskar commented 4 years ago

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?

ocket8888 commented 4 years ago

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.

larsoner commented 3 years ago

FYI I needed the workaround for psutil in https://github.com/mne-tools/mne-nirs/pull/186

rickstaa commented 3 years ago

@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.