librelist archives

« back to archive

How to generate documentation when some packages are missing in the server?

How to generate documentation when some packages are missing in the server?

From:
Javier Collado
Date:
2011-08-23 @ 15:32
Hello,

I uploaded the documentation of a project to readthedocs.org.
Unfortunately, autodoc sphinx extension failed to generate all the
documentation because some modules aren't available in the server
(gtk).

I created a virtualenv with --no-site-packages and managed to
reproduce the problem locally so, looking at the project configuration
in readthedocs.org, I believe that the way to fix the problem is set
'Use virtualenv' and 'Requirements file'. It doesn't look difficult,
but since I'm not familiar with pip requirements files I decided to
look at some projects that use readthedocs.org to check how they do
it, but haven't found any that seems to use a pip requirements file.
Is this the right approach?

I decided to go forward, and it looks like is not possible to install
gtk just with pip, so maybe the requirements file isn't going to fix
the problem after all. Since this is probably a common problem, I
guess that there is some way to generate the documentation even if
there are import errors. Github issue#77 suggest to use import hooks
so I tried to set some values to sys.modules in sphinx conf.py to
prevent the imports from failing, but still there are some problems in
the statements for the classes that inherit from gtk.

Do you have any advice to easily generate the documentation?

Best regards,
   Javier

Re: [readthedocs] How to generate documentation when some packages are missing in the server?

From:
Eric Holscher
Date:
2011-08-23 @ 17:07
Hey,

Yea, I believe #77 is the correct way to handle things. Libraries that
depend on C libraries aren't able to be installed sanely into a virtualenv
without installing the C library, which is something I'm not willing to
support on the build server. Most projects that use wrappers like this don't
need them for the docs, so mocking out the library on import is probably the
correct answer. However, that work is still kinda of scary and hard to
understand.

Cheers,
Eric

On Tue, Aug 23, 2011 at 8:32 AM, Javier Collado <javier.collado@gmail.com>wrote:

> Hello,
>
> I uploaded the documentation of a project to readthedocs.org.
> Unfortunately, autodoc sphinx extension failed to generate all the
> documentation because some modules aren't available in the server
> (gtk).
>
> I created a virtualenv with --no-site-packages and managed to
> reproduce the problem locally so, looking at the project configuration
> in readthedocs.org, I believe that the way to fix the problem is set
> 'Use virtualenv' and 'Requirements file'. It doesn't look difficult,
> but since I'm not familiar with pip requirements files I decided to
> look at some projects that use readthedocs.org to check how they do
> it, but haven't found any that seems to use a pip requirements file.
> Is this the right approach?
>
> I decided to go forward, and it looks like is not possible to install
> gtk just with pip, so maybe the requirements file isn't going to fix
> the problem after all. Since this is probably a common problem, I
> guess that there is some way to generate the documentation even if
> there are import errors. Github issue#77 suggest to use import hooks
> so I tried to set some values to sys.modules in sphinx conf.py to
> prevent the imports from failing, but still there are some problems in
> the statements for the classes that inherit from gtk.
>
> Do you have any advice to easily generate the documentation?
>
> Best regards,
>    Javier
>



-- 
Eric Holscher
Engineer at Urban Airship in Portland, Or
http://ericholscher.com

Re: [readthedocs] How to generate documentation when some packages are missing in the server?

From:
Javier Collado
Date:
2011-08-24 @ 07:01
Hello,

2011/8/23 Eric Holscher <eric@ericholscher.com>:
> Yea, I believe #77 is the correct way to handle things.

Thanks for letting me know that I was on the right track.

After some trial and error I found that what it works for my project is:
https://gist.github.com/1167446

(I've also added this as comment to issue#77).

Best regards,
    Javier