Skip to main content

CLI tool and Python API wrapper for Gerrit Code Review.

Project description

[![PyPI](https://img.shields.io/pypi/v/python-gerritclient.svg)](https://pypi.python.org/pypi/python-gerritclient)
[![Build Status](https://travis-ci.org/tivaliy/python-gerritclient.svg?branch=master)](https://travis-ci.org/tivaliy/python-gerritclient)
[![Documentation Status](https://readthedocs.org/projects/python-gerritclient/badge/?version=latest)](http://python-gerritclient.readthedocs.io/en/latest/?badge=latest)

# python-gerritclient
CLI tool and Python API wrapper for Gerrit Code Review

## Quick Start

### Command Line Tool
1. Clone `python-gerritclient` repository: `git clone https://github.com/tivaliy/python-gerritclient.git`.
2. Configure `settings.yaml` file (in `gerritclient/settings.yaml`) to meet your requirements.

```yaml
url: http://review.example.com
auth_type: basic
username: admin
password: "1234567890aaWmmflSl+ZlOPs23Dffn"
```

* `url` can be specified according to the following format `<scheme>://<host>:<port>`, e.g. `https://review.openstack.org`
* `auth_type` specifies HTTP authentication scheme (`basic` or `digest`), can be omitted, then all requests will be anonymous with respective restrictions
* `username` and `password` - user credentials from Gerrit system (Settings &#8594; HTTP Password)

3. Create isolated Python environment `virtualenv gerritclient_venv` and activate it `source gerritclient_venv/bin/activate`.
4. Install `python-gerritclient` with all necessary dependencies: `pip install python-gerritclient/.`.
5. (Optional) Add gerrit command bash completion `gerrit complete | sudo tee /etc/bash_completion.d/gc.bash_completion > /dev/null`
6. Run `gerrit` command with required options, e.g. `gerrit plugin list`. To see all available commands run `gerrit --help`.

### Library
1. Clone `python-gerritclient` repository: `git clone https://github.com/tivaliy/python-gerritclient.git`.
2. Create isolated Python environment `virtualenv gerritclient_venv` and activate it `source gerritclient_venv/bin/activate`.
3. Install `python-gerritclient` with all necessary dependencies: `pip install python-gerritclient/.`.

```python
from gerritclient import client

connection = client.connect("review.openstack.org", auth_type="digest" username="user-name", password="password")
group_client = client.get_client('group', connection=connection)
members = group_client.get_group_members('swift-core') # or get_group_members(24)
print(', '.join(member['name'] for member in members))
```

Output result: `Alistair Coles, Christian Schwede, Clay Gerrard, Darrell Bishop, David Goetz, Greg Lange, Janie Richling, John Dickinson, Kota Tsuyuzaki, Mahati Chamarthy, Matthew Oliver, Michael Barton, Pete Zaitcev, Samuel Merritt, Thiago da Silva, Tim Burke`

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

python-gerritclient-0.1.0.linux-x86_64.tar.gz (106.5 kB view details)

Uploaded Source

Built Distribution

python_gerritclient-0.1.0-py2.py3-none-any.whl (75.3 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file python-gerritclient-0.1.0.linux-x86_64.tar.gz.

File metadata

File hashes

Hashes for python-gerritclient-0.1.0.linux-x86_64.tar.gz
Algorithm Hash digest
SHA256 1680c43816e8263619377a0da6da78ba3748305ad64e54bcc5f805e089566de3
MD5 43b31e1cfdae09862240c471df38966a
BLAKE2b-256 62f6b4c6534e0996191fdcc92964e322a2169bb7a1369c70c27112acbcbef62e

See more details on using hashes here.

File details

Details for the file python_gerritclient-0.1.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for python_gerritclient-0.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 70f64d4960f5ac9922ed7b7620d2507a361418e0c4bd7d71f96daee2900d0511
MD5 ce9a08c62b1062a93833b30c0dc06ff5
BLAKE2b-256 ea2aa24b38d5268d7cbdc14d42d5625b61bdabf4b0a50999b7f7d9f8965f0a8b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page