summaryrefslogtreecommitdiff
path: root/docs/gl_objects/packages.rst
blob: 3c1782b9093e0a492a9ff9801e76af117869549a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#######
Packages
#######

Packages allow you to utilize GitLab as a private repository for a variety
of common package managers.

Project Packages
=====================

Reference
---------

* v4 API:

  + :class:`gitlab.v4.objects.ProjectPackage`
  + :class:`gitlab.v4.objects.ProjectPackageManager`
  + :attr:`gitlab.v4.objects.Project.packages`

* GitLab API: https://docs.gitlab.com/ee/api/packages.html#within-a-project

Examples
--------

List the packages in a project::

    packages = project.packages.list()

Filter the results by ``package_type`` or ``package_name`` ::

    packages = project.packages.list(package_type='pypi')

Get a specific package of a project by id::

    package = project.packages.get(1)

Delete a package from a project::

    package.delete()
    # or
    project.packages.delete(package.id)


Group Packages
===================

Reference
---------

* v4 API:

  + :class:`gitlab.v4.objects.GroupPackage`
  + :class:`gitlab.v4.objects.GroupPackageManager`
  + :attr:`gitlab.v4.objects.Group.packages`

* GitLab API: https://docs.gitlab.com/ee/api/packages.html#within-a-group

Examples
--------

List the packages in a group::

    packages = group.packages.list()

Filter the results by ``package_type`` or ``package_name`` ::

    packages = group.packages.list(package_type='pypi')