How to install PySide on Travis?

My tests for Quamash depend on PySide (or ultimately PyQt) for Python 3.4, so I wonder how I can install this dependency on Travis so that it is available for testing?

I know that I can install PySide from source through pip, but this is a very slow process.

Let me know if I need to provide more information.

+6
source share
2 answers

Installation via apt-get is currently not possible. See github issue and travis docs .

Three other options.

Just use pip

Your .travis.yml will include:

 install: - pip install PySide 

As you already mentioned, it takes a long time to create PySide from sources on travis-ci servers. However, this method is guaranteed to work.

Wait for Travis CI to upgrade to Ubuntu 14.04

Issue . Python3.4 is included in Ubuntu 14.04. Then your .travis.yml might look like this:

 install: - sudo apt-get install python3-pyside 

Create your own wheel

You can create your own PySide wheel , so building a Travis-CI using Python3.4 should not create PySide from the source.

Following these instructions , I built the PySide wheel:

 $ git clone https://github.com/PySide/pyside-setup.git pyside-setup $ cd pyside-setup $ python3.4 setup.py bdist_wheel --qmake=/usr/bin/qmake-qt4 --version=1.2.2 

Then you can place this wheel somewhere and access it with travis:

 install: - sudo apt-get install libqt4-dev - pip install PySide --no-index --find-links https://<your-site>; # Travis CI servers use virtualenvs, so we need to finish the install by the following - python ~/virtualenv/python${TRAVIS_PYTHON_VERSION}/bin/pyside_postinstall.py -install 

where <your-site> is a web page containing a link to a wheel named PySideXXXXXXX.whl , with the correct naming convention . Use --no-index to prevent PySide from detecting and installing a new user from pypi .

I went ahead and tried this, basic use works!

See the source.

The wheel is placed on the gh page .

Note on my machine with Ubuntu 14.04, creating a wheel, created the dist/PySide-1.2.2-cp34-cp34m-linux_x86_64.whl , which was approximately 17 MB. When I instead added the --standalone tag at build time, the file was ~ 77 MB.

Note that only import PySide has been verified so far. Because of this, created under Ubuntu 14.04 and Travis-Ci servers running Ubuntu 12.04, I don’t know how functional PySide library is. If you run into problems, you can repeat this on a machine with Ubuntu 12.04.

Update:

Next python script

 import PySide from PySide import QtGui 

failed when the PySide wheel was built on Ubuntu 14.04. See crash . However, this succeeds when PySide is built on Ubuntu 12.04, see success .

Using My PySide Wheel

In your .travis.yml file, specify the following:

 install: - sudo apt-get install libqt4-dev - pip install PySide --no-index --find-links https://parkin.imtqy.com/python-wheelhouse/; # Travis CI servers use virtualenvs, so we need to finish the install by the following - python ~/virtualenv/python${TRAVIS_PYTHON_VERSION}/bin/pyside_postinstall.py -install 
+11
source

A good solution is to use the Travis caching feature to cache the wheels line by line.

Adding

 language: python cache: pip 

to the cache .travis.yml $HOME/.cache/pip . Thus, the PySide wheel will be built once and will be saved during the restoration of your application.

0
source

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


All Articles