launchpadlib not compatible with latest version of httplib2

Bug #1803558 reported by Ben
26
This bug affects 4 people
Affects Status Importance Assigned to Milestone
lazr.restfulclient
Fix Released
High
Colin Watson

Bug Description

launchpadlib 1.10.6 (latest) is not compatible with the latest version of httplib2 0.12.0.

httplib2 0.12.0 has removed httplib2.re_slash, thus preventing launchpadlib from being imported:

## ERROR ###############################################################################

Running Python 3.6.6 on Kubuntu 18.04.1

$ pip install launchpadlib

$ python -c "from launchpadlib.launchpad import Launchpad"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/ben/envs/tmp-259ccbfb9717a89/lib/python3.6/site-packages/launchpadlib/launchpad.py", line 38, in <module>
    from lazr.restfulclient.resource import (
  File "/home/ben/envs/tmp-259ccbfb9717a89/lib/python3.6/site-packages/lazr/restfulclient/resource.py", line 68, in <module>
    from lazr.restfulclient._browser import Browser, RestfulHttp
  File "/home/ben/envs/tmp-259ccbfb9717a89/lib/python3.6/site-packages/lazr/restfulclient/_browser.py", line 85, in <module>
    from httplib2 import _md5, re_url_scheme, re_slash
ImportError: cannot import name 're_slash'

# SUCCESS ###############################################################################

However if an older version of httplib2 is specified first

$ pip install httplib2==0.11.3 launchpadlib

$ python -c "from launchpadlib.launchpad import Launchpad"

Related branches

Colin Watson (cjwatson)
affects: launchpadlib → lazr.restfulclient
Changed in lazr.restfulclient:
assignee: nobody → Colin Watson (cjwatson)
importance: Undecided → High
status: New → In Progress
Revision history for this message
Colin Watson (cjwatson) wrote :

Fixed in lazr.restfulclient 0.14.1.

Changed in lazr.restfulclient:
status: In Progress → Fix Released
Revision history for this message
Sorin Sbarnea (ssbarnea) wrote :

Out of curiosity where can I see the CI results on master branch of lazr.restfulclient? Thanks.

Revision history for this message
Colin Watson (cjwatson) wrote :

I'm afraid we don't have proper CI set up yet - I just run tox by hand. (It's particularly awkward because the test suite uses stuff like lazr.restful that hasn't been ported to Python 3 yet.)

Revision history for this message
Sorin Sbarnea (ssbarnea) wrote :

Would it be too much to question why not moving this to gihub so we could use travis and pull requests? It would make testing and contributing much easier (and less human "demanding").

Revision history for this message
Sorin Sbarnea (ssbarnea) wrote :

I am asking this because I am trying to add support for py3 on elastic-recheck via https://review.openstack.org/#/c/616578/ which is currentl blocked by a long dependency chain:

elastic-recheck -> launchpadlib -> httplib2 -> lazr.restfulclient

None of mentioned dependencies have a github/travis presense which means that is very hard to make contributons to them.

PS. I am not a big fun of github/PRs as i preffer gerrit/CRs but I realise that is much easier to setup CI for github.

Revision history for this message
Colin Watson (cjwatson) wrote :

My personal view is that hosting a critical Launchpad-specific component not on Launchpad is just too silly.

What exactly is blocking you in terms of launchpadlib/lazr.restfulclient? The failure logs I could find from your link didn't seem to have much to do with launchpadlib, but I may be missing something.

Revision history for this message
Sorin Sbarnea (ssbarnea) wrote :

Is true, few minutes ago I managed to make it work under py36/py37 so I no longer need any other change.

I can see your concern about external to LP, while it can sort some problem it could create many more. Maybe switching from bzr to git in linger run would be a nice step, as i see it as supported https://help.launchpad.net/Code/Git#Converting_from_Bazaar_to_Git

And thanks for helping with that!

Revision history for this message
Christopher Hoskin (christopher-hoskin) wrote :

Please could the fix be baackported to bionic? It stops backportpackage from working:

```
backportpackage lazr.restfulclient -u ppa:christopher-hoskin/ppa -b
Traceback (most recent call last):
  File "/usr/bin/backportpackage", line 31, in <module>
    from ubuntutools.archive import (SourcePackage, DebianSourcePackage,
  File "/usr/lib/python2.7/dist-packages/ubuntutools/archive.py", line 51, in <module>
    from ubuntutools.lp.lpapicache import (Launchpad, Distribution,
  File "/usr/lib/python2.7/dist-packages/ubuntutools/lp/lpapicache.py", line 35, in <module>
    from launchpadlib.launchpad import Launchpad as LP
  File "/usr/lib/python2.7/dist-packages/launchpadlib/launchpad.py", line 38, in <module>
    from lazr.restfulclient.resource import (
  File "/usr/lib/python2.7/dist-packages/lazr/restfulclient/resource.py", line 68, in <module>
    from lazr.restfulclient._browser import Browser, RestfulHttp
  File "/usr/lib/python2.7/dist-packages/lazr/restfulclient/_browser.py", line 85, in <module>
    from httplib2 import _md5, re_url_scheme, re_slash
ImportError: cannot import name re_slash
```

Revision history for this message
Colin Watson (cjwatson) wrote :

@christopher-hoskin: bionic has httplib2 0.9.2, so doesn't suffer from this problem. Do you perhaps have a newer version of httplib2 installed, maybe via pip or something? Try this to find out where it might live:

  $ python
  >>> import httplib2
  >>> httplib2.__file__

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.