gidgetlab


Namegidgetlab JSON
Version 1.1.0 PyPI version JSON
download
home_pagehttps://gitlab.com/beenje/gidgetlab
SummaryAn async GitLab API library
upload_time2023-10-23 11:11:03
maintainer
docs_urlNone
authorBenjamin Bertrand
requires_python>=3.6.0
licenseApache
keywords gitlab sans-io async
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            gidgetlab
=========

.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
    :target: https://github.com/ambv/black

.. image:: https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white
    :target: https://github.com/pre-commit/pre-commit
    :alt: pre-commit

.. image:: https://readthedocs.org/projects/gidgetlab/badge/?version=latest
    :target: https://gidgetlab.readthedocs.io/en/latest/?badge=latest
    :alt: Documentation Status

.. image:: https://gitlab.com/beenje/gidgetlab/badges/master/pipeline.svg

.. image:: https://gitlab.com/beenje/gidgetlab/badges/master/coverage.svg

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 <https://github.com/brettcannon/>`_ 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 <https://pypi.org/project/gidgetlab/>`_.

::

  python3 -m pip install gidgetlab

To install web server support (e.g. for ``aiohttp``, ``treq``, 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 <https://github.com/Mariatta>`_ PyCon 2018 workshop:
`Build-a-GitHub-Bot Workshop <http://github-bot-tutorial.readthedocs.io/en/latest/index.html>`_.


Alternative libraries
---------------------

If you think you want a different approach to the GitLab API,
`GitLab maintains a list of libraries <https://about.gitlab.com/applications/#api-clients/>`_.

.. _gidgethub: https://github.com/brettcannon/gidgethub
.. _`GitLab API`: https://docs.gitlab.com/ce/api/
.. _`sans-I/O`: https://sans-io.readthedocs.io/

            

Raw data

            {
    "_id": null,
    "home_page": "https://gitlab.com/beenje/gidgetlab",
    "name": "gidgetlab",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6.0",
    "maintainer_email": "",
    "keywords": "gitlab sans-io async",
    "author": "Benjamin Bertrand",
    "author_email": "beenje@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/e0/98/deefad2c559934017c4417c5b47259155bc3e0262b4110ae7f760e88fb0e/gidgetlab-1.1.0.tar.gz",
    "platform": null,
    "description": "gidgetlab\n=========\n\n.. image:: https://img.shields.io/badge/code%20style-black-000000.svg\n    :target: https://github.com/ambv/black\n\n.. image:: https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white\n    :target: https://github.com/pre-commit/pre-commit\n    :alt: pre-commit\n\n.. image:: https://readthedocs.org/projects/gidgetlab/badge/?version=latest\n    :target: https://gidgetlab.readthedocs.io/en/latest/?badge=latest\n    :alt: Documentation Status\n\n.. image:: https://gitlab.com/beenje/gidgetlab/badges/master/pipeline.svg\n\n.. image:: https://gitlab.com/beenje/gidgetlab/badges/master/coverage.svg\n\nAn asynchronous `GitLab API`_ library.\n\nThis library is based on gidgethub_ from Brett Cannon,\nan async GitHub API library.\n\nI liked the concept with the asynchronous and `sans-I/O`_\napproach and decided to adapt it to the GitLab's API.\nAll credit to `Brett Cannon <https://github.com/brettcannon/>`_ for the initial library!\n\nQuick start\n-----------\n\nHere is a complete example of a server that responds to\nwebhooks which will greet the author and say thanks\nwhenever an issue is opened::\n\n    from gidgetlab.aiohttp import GitLabBot\n\n    bot = GitLabBot(\"beenje\")\n\n\n    @bot.router.register(\"Issue Hook\", action=\"open\")\n    async def issue_opened_event(event, gl, *args, **kwargs):\n        \"\"\"Whenever an issue is opened, greet the author and say thanks.\"\"\"\n        url = f\"/projects/{event.project_id}/issues/{event.object_attributes['iid']}/notes\"\n        message = f\"Thanks for the report @{event.data['user']['username']}! I will look into it ASAP! (I'm a bot).\"\n        await gl.post(url, data={\"body\": message})\n\n\n    if __name__ == \"__main__\":\n        bot.run()\n\nInstallation\n------------\n\nGidgetlab is `available on PyPI <https://pypi.org/project/gidgetlab/>`_.\n\n::\n\n  python3 -m pip install gidgetlab\n\nTo install web server support (e.g. for ``aiohttp``, ``treq``, or ``tornado``), specify it as an extra dependency:\n\n::\n\n  python3 -m pip install gidgetlab[aiohttp]\n\nNote that the library is still in alpha development stage.\n\nGoals\n-----\n\nThe key goal is the same as gidgethub_ (but for GitLab):\nto provide an async base library for the `GitLab API`_\nwhich performs no I/O of its own (a `sans-I/O`_ library).\n\nAnother goal is to easily write GitLab bots: applications that\nrun automation on GitLab, using GitLab WebHooks and API.\nThis was inspired by `Mariatta <https://github.com/Mariatta>`_ PyCon 2018 workshop:\n`Build-a-GitHub-Bot Workshop <http://github-bot-tutorial.readthedocs.io/en/latest/index.html>`_.\n\n\nAlternative libraries\n---------------------\n\nIf you think you want a different approach to the GitLab API,\n`GitLab maintains a list of libraries <https://about.gitlab.com/applications/#api-clients/>`_.\n\n.. _gidgethub: https://github.com/brettcannon/gidgethub\n.. _`GitLab API`: https://docs.gitlab.com/ce/api/\n.. _`sans-I/O`: https://sans-io.readthedocs.io/\n",
    "bugtrack_url": null,
    "license": "Apache",
    "summary": "An async GitLab API library",
    "version": "1.1.0",
    "project_urls": {
        "Homepage": "https://gitlab.com/beenje/gidgetlab"
    },
    "split_keywords": [
        "gitlab",
        "sans-io",
        "async"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d35bba74da3bfd3b52ea3c8b2b1015025cf4684992d79d1295e186e35bebe82e",
                "md5": "7ecc6aaf810f3c7208099ef1930f94cc",
                "sha256": "56f23d7cc8241bfc2b3703aaf5783877f5b6c101db623c6fbfb0e7c6f006ad1a"
            },
            "downloads": -1,
            "filename": "gidgetlab-1.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7ecc6aaf810f3c7208099ef1930f94cc",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6.0",
            "size": 23325,
            "upload_time": "2023-10-23T11:11:02",
            "upload_time_iso_8601": "2023-10-23T11:11:02.521142Z",
            "url": "https://files.pythonhosted.org/packages/d3/5b/ba74da3bfd3b52ea3c8b2b1015025cf4684992d79d1295e186e35bebe82e/gidgetlab-1.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e098deefad2c559934017c4417c5b47259155bc3e0262b4110ae7f760e88fb0e",
                "md5": "2917cbb696db7ecd1db1594eddcb628d",
                "sha256": "314ec2cddc898317ec45d99068665dbf33c0fee1f52df6671f28ad35bb51f902"
            },
            "downloads": -1,
            "filename": "gidgetlab-1.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "2917cbb696db7ecd1db1594eddcb628d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6.0",
            "size": 28768,
            "upload_time": "2023-10-23T11:11:03",
            "upload_time_iso_8601": "2023-10-23T11:11:03.764278Z",
            "url": "https://files.pythonhosted.org/packages/e0/98/deefad2c559934017c4417c5b47259155bc3e0262b4110ae7f760e88fb0e/gidgetlab-1.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-10-23 11:11:03",
    "github": false,
    "gitlab": true,
    "bitbucket": false,
    "codeberg": false,
    "gitlab_user": "beenje",
    "gitlab_project": "gidgetlab",
    "lcname": "gidgetlab"
}
        
Elapsed time: 0.14733s