Python readthedocs how to fulfill a sip (or pyqt) requirement

I want to publish the documentation of my project https://bitbucket.org/oaltun/opn in readthedocs.org.

Build failed. There are various errors in the https://readthedocs.org/builds/opn/2247789/ log, but the first is "without a module named sip".

sip needs pyqt, which the project needs.

Typically, in this situation, as I understand it, you added the missing package to your setup.py and checked the readthedocs.org option to create virtualenv. I check the box to create virtualenv. But I can not add sip or pyqt to setup.py.

The problem is pyqt, and sip does not use setuptools, so pip cannot be installed. Therefore, you cannot add them to setup.py (this fails even on my local machine).

In my local environment, I am installing pyqt with (ana) conda. But I think readthedocs.org uses pip to call dependencies.

So how can I include sip in my virtualenv?

+5
source share
1 answer

The trick is to mock these interfaces:

import mock MOCK_MODULES = ['sip', 'PyQt4', 'PyQt4.QtGui'] sys.modules.update((mod_name, mock.MagicMock()) for mod_name in MOCK_MODULES) 

Note that you must also mock the root package "PyQt4" or get an ImportError.

+1
source

Source: https://habr.com/ru/post/1212032/


All Articles