Closed nikitavbv closed 6 years ago
Well, I checked for libraries interfacing gerrit yesterday. The problem is that there are no good and well maintained libraries for that.
The most functional seems to be this one: https://github.com/sonyxperiadev/pygerrit However it is no longer maintained.
There is also a second version of this library available, which is currently in development: https://github.com/dpursehouse/pygerrit2
I am still not sure which of those libraries to use. By the way, it is a question if we need to use any library at all - as there aren't much api calls we will need to make and it shouldn't be difficult to implement this without using any external libraries.
What is your opinion on this?
Even though https://github.com/dpursehouse/pygerrit2 is experimental on Python 3, that should be OK. We can help them iron out any bugs. I am more concerned that they have dropped the SSH interface, and appear to be only using REST.
I suggest https://pypi.python.org/pypi/gerritlib ; openstack group will be good maintainers to work with.
https://github.com/tivaliy/python-gerritclient also looks like it going to be a good library.
Okay. Thank you! I will use one of those libraries and push updated code soon
Well I checked and tested all libraries. Here are the results.
https://github.com/tivaliy/python-gerritclient seems to offer more functionality. However there are problems with installing it with pip3
: the library itself is compatible with python3, however it has cliff
dependency (which is used only for cli by the way), which is not compatible with python3 and fails to install. Anyway, it is powerful and easy to use.
We may use https://pypi.python.org/pypi/gerritlib instead, however I checked its docs and source code and I am afraid it lacks functionality we need. It also doesn't work with REST API - it uses only SSH.
As for https://github.com/dpursehouse/pygerrit2 - it works fine. It has less functionality than python-gerritclient
, however it easy to extend. For example, it doesn't have a function to get project info, however we can achieve that by using get method directly: restClient.get("/projects/namespace%2Frepo")
Personally, I liked python-gerritclient
the most, however I am not sure if it is okay for us due to installation problems.
What's your opinion on this?
https://pypi.python.org/pypi/cliff and https://git.openstack.org/cgit/openstack/cliff/tree/setup.cfg#n15 says it supports Python 3.
Lets chat about this on gitter and maybe identity a bug which is missing from https://bugs.launchpad.net/python-cliff
Oops. 3 commits. I will rebase it now
Generally speaking about libraries, I chose to always use an interfacing library for the sake of only managing a python interface (so when it breaks, it breaks loudly and hard, and updating is handled using versions), and not an API interface.
And it's also for the greater good, as working on this project it made me get involved in python-gitlab, github3.py… and many other libraries for others to use.
about the review action, it'd be nice to think a bit on how to handle that use case in terms of CLI user experience. How do you see the interactions?
about the review action, it'd be nice to think a bit on how to handle that use case in terms of CLI user experience. How do you see the interactions?
Well, this may need some discussion and improvement.
Right now it works like this: user creates commit and after that runs git [gerrit service name] request create
. And it creates a new gerrit change. Unluckily, we don't show resulting change url (I am still thinking if we could do that - but due to some library limitations I don't see a clear way to do that). We also don't allow to set a custom topic or something like that.
I am still thinking on how we could improve that. I am open to any of your suggestions
Unluckily, we don't show resulting change url (I am still thinking if we could do that - but due to some library limitations I don't see a clear way to do that)
Good news: I found way to do that! Now we show resulting change urls.
I like third method too. I just implemented it. Could you check please if everything is okay with it?
damn! ☹ @Phantom-42 it's been a month since last time I checked around here, and it feels like it was yesterday… I do not forget about you, though, but I'm still totally snowed under at work ☹
No worries! I fully understand you. Just notify when you will have some free time and we will continue! By the way, I really like this tool and I use it on regular basis now. I would be happy to work on more features and pull requests in the future! :)
I had some trouble testing it, but it sounds more like issues with me being not familiar with the working of gerrithub than with your code.
If needed, please tell and I will be happy to help you with gerrithub, so you can test this better! Thank you for reviewing!
This introduces gerrit support requested in #19