Bug 1278605 - [RFE] support installing beaker-client through pip
[RFE] support installing beaker-client through pip
Status: CLOSED CURRENTRELEASE
Product: Beaker
Classification: Community
Component: command line (Show other bugs)
21
Unspecified Unspecified
medium Severity unspecified (vote)
: 24.0
: ---
Assigned To: Dan Callaghan
tools-bugs
: FutureFeature, Patch, Triaged
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-11-05 18:36 EST by Dan Callaghan
Modified: 2017-02-21 13:50 EST (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2017-02-21 13:50:51 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Dan Callaghan 2015-11-05 18:36:27 EST
This is desirable because it makes the client usable on non-RPM-based platforms.

I think these are the missing pieces which need to be done:

* make Client/setup.py not try to create empty /etc/beaker

* declare dependencies in setup.py, instead of just at the RPM level

* ideally remove Client's dependency on Common to avoid messing around with that extra package (there should be little to nothing in Common which is really needed by Client)

* put Client on PyPI as "beaker-client" so you can install using "pip install beaker-client"
Comment 1 Dan Callaghan 2015-11-05 18:37:33 EST
(In reply to Dan Callaghan from comment #0)
> This is desirable because it makes the client usable on non-RPM-based
> platforms.

... and also in virtualenvs (even on RPM-based platforms) which is also useful for some people.
Comment 4 Dan Callaghan 2016-11-01 21:33:50 EDT
(In reply to Dan Callaghan from comment #0)
> * ideally remove Client's dependency on Common to avoid messing around with
> that extra package (there should be little to nothing in Common which is
> really needed by Client)

This is not too easy, since client relies heavily on HubProxy (so does the LC code). But it should be no problem to just upload beaker-common to PyPI as well.
Comment 5 Dan Callaghan 2016-11-01 21:42:47 EDT
(In reply to Dan Callaghan from comment #0)
> * make Client/setup.py not try to create empty /etc/beaker

Can't remember why I wrote this... It doesn't seem to cause any harm as is.

I do notice that inside a virtualenv pip does not install package_data to the proper absolute path (because it can't, I guess) so the bash completion script ends up in ./lib/python2.7/site-packages/usr/share/bash-completion/completions/bkr which is useless, but not particularly harmful.
Comment 6 Dan Callaghan 2016-11-01 22:07:27 EDT
With this patch:

http://gerrit.beaker-project.org/5390

I can upload beaker-common and beaker-client to PyPI (tested using TestPyPI) and then successfully run `pip install beaker-client` inside a virtualenv. However the bkr client fails with:

ImportError: No module named libxml2

since it wants to import libxml2-python and libxslt-python bindings. Those aren't available from PyPI so they aren't declared as requirements in setup.py, they have to be installed from the native libxml2 package. (This is the eternal problem with Python-level packaging and why I don't think anyone should bother with it.)
Comment 7 Dan Callaghan 2016-11-01 22:09:46 EDT
(In reply to Dan Callaghan from comment #6)
> However the bkr client fails with:
> 
> ImportError: No module named libxml2

The way to avoid this seems to be to create the virtual env using `virtualenv --system-site-packages` and then ensure that libxml2-python and libxslt-python system packages are installed.
Comment 8 Dan Callaghan 2016-11-07 02:21:18 EST
I have used the above patch to upload beaker-common and beaker-client version 23.2 (and today also 23.3) to PyPI.

Steps to verify:
1. virtualenv --system-site-packages asdf
2. cd asdf
3. source bin/activate
4. pip install beaker-client
5. bkr whoami
Comment 10 Dan Callaghan 2017-02-21 13:50:51 EST
Beaker 24.0 has been released.

Note You need to log in before you can comment on or make changes to this bug.