An asynchronous GitLab API library.
This library is based on gidgethub from Brett Cannon, an async GitHub API library.
I liked the concept with the asynchronous and sans-I/O approach and decided to adapt it to the GitLab’s API. All credit to Brett Cannon for the initial library!
Quick start
Here is a complete example of a server that responds to webhooks which will greet the author and say thanks whenever an issue is opened:
from gidgetlab.aiohttp import GitLabBot
bot = GitLabBot("beenje")
@bot.router.register("Issue Hook", action="open")
async def issue_opened_event(event, gl, *args, **kwargs):
"""Whenever an issue is opened, greet the author and say thanks."""
url = f"/projects/{event.project_id}/issues/{event.object_attributes['iid']}/notes"
message = f"Thanks for the report @{event.data['user']['username']}! I will look into it ASAP! (I'm a bot)."
await gl.post(url, data={"body": message})
if __name__ == "__main__":
bot.run()
Installation
Gidgetlab is available on PyPI.
python3 -m pip install gidgetlab
To install web server support (e.g. for aiohttp or tornado), specify it as an extra dependency:
python3 -m pip install gidgetlab[aiohttp]
Note that the library is still in alpha development stage.
Goals
The key goal is the same as gidgethub (but for GitLab): to provide an async base library for the GitLab API which performs no I/O of its own (a sans-I/O library).
Another goal is to easily write GitLab bots: applications that run automation on GitLab, using GitLab WebHooks and API. This was inspired by Mariatta PyCon 2018 workshop: Build-a-GitHub-Bot Workshop.
Alternative libraries
If you think you want a different approach to the GitLab API, GitLab maintains a list of libraries.
Metadata
Release files for gidgetlab 2.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| gidgetlab-2.1.2.tar.gz | 34.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| gidgetlab-2.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 61.4 kB
Release files / gidgetlab-2.1.2.tar.gz
| Download URL | gidgetlab-2.1.2.tar.gz |
|---|---|
| Size | 34.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cdbb39aa1a344a4a3e40cb30ccd4e559794937664d59908e94d4850b1354be90
|
|
BLAKE2b-256 checksum How to use checksums |
e8c2e8cd6794cd3ac19d763c71e3679ea610980a75a6a2e8df23ac78912ee9ce
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.11
|
Release files / gidgetlab-2.1.2-py3-none-any.whl
| Download URL | gidgetlab-2.1.2-py3-none-any.whl |
|---|---|
| Size | 26.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
166950236ea4aa35f28f1b54ce26356a3ee0926bb92cb02cc03315ee536d88fe
|
|
BLAKE2b-256 checksum How to use checksums |
1999c585a1f4d30a42f8bf5d6ca8f0bba1e5de057e42e0fec20a6b3e2cbb0925
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.11
|