|
1 |
| -python-gitlab |
2 |
| -============= |
3 |
| - |
4 |
| -.. image:: https://github.com/python-gitlab/python-gitlab/workflows/Test/badge.svg |
5 |
| - :target: https://github.com/python-gitlab/python-gitlab/actions |
6 |
| - |
7 |
| -.. image:: https://badge.fury.io/py/python-gitlab.svg |
8 |
| - :target: https://badge.fury.io/py/python-gitlab |
9 |
| - |
10 |
| -.. image:: https://readthedocs.org/projects/python-gitlab/badge/?version=latest |
11 |
| - :target: https://python-gitlab.readthedocs.org/en/latest/?badge=latest |
12 |
| - |
13 |
| -.. image:: https://codecov.io/github/python-gitlab/python-gitlab/coverage.svg?branch=main |
14 |
| - :target: https://codecov.io/github/python-gitlab/python-gitlab?branch=main |
15 |
| - |
16 |
| -.. image:: https://img.shields.io/pypi/pyversions/python-gitlab.svg |
17 |
| - :target: https://pypi.python.org/pypi/python-gitlab |
18 |
| - |
19 |
| -.. image:: https://img.shields.io/gitter/room/python-gitlab/Lobby.svg |
20 |
| - :target: https://gitter.im/python-gitlab/Lobby |
21 |
| - |
22 |
| -.. image:: https://img.shields.io/badge/code%20style-black-000000.svg |
23 |
| - :target: https://github.com/python/black |
24 |
| - |
25 |
| -.. image:: https://img.shields.io/github/license/python-gitlab/python-gitlab |
26 |
| - :target: https://github.com/python-gitlab/python-gitlab/blob/main/COPYING |
27 |
| - |
28 |
| -``python-gitlab`` is a Python package providing access to the GitLab APIs. |
29 |
| - |
30 |
| -It includes a client for GitLab's v4 REST API, synchronous and asynchronous GraphQL API |
31 |
| -clients, as well as a CLI tool (``gitlab``) wrapping REST API endpoints. |
32 |
| - |
33 |
| -.. _features: |
34 |
| - |
35 |
| -Features |
36 |
| --------- |
37 |
| - |
38 |
| -``python-gitlab`` enables you to: |
39 |
| - |
40 |
| -* write Pythonic code to manage your GitLab resources. |
41 |
| -* pass arbitrary parameters to the GitLab API. Simply follow GitLab's docs |
42 |
| - on what parameters are available. |
43 |
| -* use a synchronous or asynchronous client when using the GraphQL API. |
44 |
| -* access arbitrary endpoints as soon as they are available on GitLab, by using |
45 |
| - lower-level API methods. |
46 |
| -* use persistent requests sessions for authentication, proxy and certificate handling. |
47 |
| -* handle smart retries on network and server errors, with rate-limit handling. |
48 |
| -* flexible handling of paginated responses, including lazy iterators. |
49 |
| -* automatically URL-encode paths and parameters where needed. |
50 |
| -* automatically convert some complex data structures to API attribute types |
51 |
| -* merge configuration from config files, environment variables and arguments. |
52 |
| - |
53 |
| -Installation |
54 |
| ------------- |
55 |
| - |
56 |
| -As of 5.0.0, ``python-gitlab`` is compatible with Python 3.9+. |
57 |
| - |
58 |
| -Use ``pip`` to install the latest stable version of ``python-gitlab``: |
59 |
| - |
60 |
| -.. code-block:: console |
61 |
| -
|
62 |
| - $ pip install --upgrade python-gitlab |
63 |
| -
|
64 |
| -The current development version is available on both `GitHub.com |
65 |
| -<https://github.com/python-gitlab/python-gitlab>`__ and `GitLab.com |
66 |
| -<https://gitlab.com/python-gitlab/python-gitlab>`__, and can be |
67 |
| -installed directly from the git repository: |
68 |
| - |
69 |
| -.. code-block:: console |
70 |
| -
|
71 |
| - $ pip install git+https://github.com/python-gitlab/python-gitlab.git |
72 |
| -
|
73 |
| -From GitLab: |
74 |
| - |
75 |
| -.. code-block:: console |
76 |
| -
|
77 |
| - $ pip install git+https://gitlab.com/python-gitlab/python-gitlab.git |
78 |
| -
|
79 |
| -Using the docker images |
80 |
| ------------------------ |
81 |
| - |
82 |
| -``python-gitlab`` provides Docker images in two flavors, based on the Alpine and Debian slim |
83 |
| -python `base images <https://hub.docker.com/_/python>`__. The default tag is ``alpine``, |
84 |
| -but you can explicitly use the alias (see below). |
85 |
| - |
86 |
| -The alpine image is smaller, but you may want to use the Debian-based slim tag (currently |
87 |
| -based on ``-slim-bullseye``) if you are running into issues or need a more complete environment |
88 |
| -with a bash shell, such as in CI jobs. |
89 |
| - |
90 |
| -The images are published on the GitLab registry, for example: |
91 |
| - |
92 |
| -* ``registry.gitlab.com/python-gitlab/python-gitlab:latest`` (latest, alpine alias) |
93 |
| -* ``registry.gitlab.com/python-gitlab/python-gitlab:alpine`` (latest alpine) |
94 |
| -* ``registry.gitlab.com/python-gitlab/python-gitlab:slim-bullseye`` (latest slim-bullseye) |
95 |
| -* ``registry.gitlab.com/python-gitlab/python-gitlab:v3.2.0`` (alpine alias) |
96 |
| -* ``registry.gitlab.com/python-gitlab/python-gitlab:v3.2.0-alpine`` |
97 |
| -* ``registry.gitlab.com/python-gitlab/python-gitlab:v3.2.0-slim-bullseye`` |
98 |
| - |
99 |
| -You can run the Docker image directly from the GitLab registry: |
100 |
| - |
101 |
| -.. code-block:: console |
102 |
| -
|
103 |
| - $ docker run -it --rm registry.gitlab.com/python-gitlab/python-gitlab:latest <command> ... |
104 |
| -
|
105 |
| -For example, to get a project on GitLab.com (without authentication): |
106 |
| - |
107 |
| -.. code-block:: console |
108 |
| -
|
109 |
| - $ docker run -it --rm registry.gitlab.com/python-gitlab/python-gitlab:latest project get --id gitlab-org/gitlab |
110 |
| -
|
111 |
| -You can also mount your own config file: |
112 |
| - |
113 |
| -.. code-block:: console |
114 |
| -
|
115 |
| - $ docker run -it --rm -v /path/to/python-gitlab.cfg:/etc/python-gitlab.cfg registry.gitlab.com/python-gitlab/python-gitlab:latest <command> ... |
116 |
| -
|
117 |
| -Usage inside GitLab CI |
118 |
| -~~~~~~~~~~~~~~~~~~~~~~ |
119 |
| - |
120 |
| -If you want to use the Docker image directly inside your GitLab CI as an ``image``, you will need to override |
121 |
| -the ``entrypoint``, `as noted in the official GitLab documentation <https://docs.gitlab.com/ee/ci/docker/using_docker_images.html#override-the-entrypoint-of-an-image>`__: |
122 |
| - |
123 |
| -.. code-block:: yaml |
124 |
| -
|
125 |
| - Job Name: |
126 |
| - image: |
127 |
| - name: registry.gitlab.com/python-gitlab/python-gitlab:latest |
128 |
| - entrypoint: [""] |
129 |
| - before_script: |
130 |
| - gitlab --version |
131 |
| - script: |
132 |
| - gitlab <command> |
133 |
| -
|
134 |
| -Building the image |
135 |
| -~~~~~~~~~~~~~~~~~~ |
136 |
| - |
137 |
| -To build your own image from this repository, run: |
138 |
| - |
139 |
| -.. code-block:: console |
140 |
| -
|
141 |
| - $ docker build -t python-gitlab:latest . |
142 |
| -
|
143 |
| -Run your own image: |
144 |
| - |
145 |
| -.. code-block:: console |
146 |
| -
|
147 |
| - $ docker run -it --rm python-gitlab:latest <command> ... |
148 |
| -
|
149 |
| -Build a Debian slim-based image: |
150 |
| - |
151 |
| -.. code-block:: console |
152 |
| -
|
153 |
| - $ docker build -t python-gitlab:latest --build-arg PYTHON_FLAVOR=slim-bullseye . |
154 |
| -
|
155 |
| -Bug reports |
156 |
| ------------ |
157 |
| - |
158 |
| -Please report bugs and feature requests at |
159 |
| -https://github.com/python-gitlab/python-gitlab/issues. |
160 |
| - |
161 |
| -Gitter Community Chat |
162 |
| ---------------------- |
163 |
| - |
164 |
| -We have a `gitter <https://gitter.im/python-gitlab/Lobby>`_ community chat |
165 |
| -available at https://gitter.im/python-gitlab/Lobby, which you can also |
166 |
| -directly access via the Open Chat button below. |
167 |
| - |
168 |
| -If you have a simple question, the community might be able to help already, |
169 |
| -without you opening an issue. If you regularly use python-gitlab, we also |
170 |
| -encourage you to join and participate. You might discover new ideas and |
171 |
| -use cases yourself! |
172 |
| - |
173 |
| -Documentation |
174 |
| -------------- |
175 |
| - |
176 |
| -The full documentation for CLI and API is available on `readthedocs |
177 |
| -<http://python-gitlab.readthedocs.org/en/stable/>`_. |
178 |
| - |
179 |
| -Build the docs |
180 |
| -~~~~~~~~~~~~~~ |
181 |
| - |
182 |
| -We use ``tox`` to manage our environment and build the documentation:: |
183 |
| - |
184 |
| - pip install tox |
185 |
| - tox -e docs |
186 |
| - |
187 |
| -Contributing |
188 |
| ------------- |
189 |
| - |
190 |
| -For guidelines for contributing to ``python-gitlab``, refer to `CONTRIBUTING.rst <https://github.com/python-gitlab/python-gitlab/blob/main/CONTRIBUTING.rst>`_. |
| 1 | +AI Generated fork |
0 commit comments