Skip to content

Releases: python-gitlab/python-gitlab

v4.6.0

28 May 00:46
Compare
Choose a tag to compare

v4.6.0 (2024-05-28)

Chore

  • chore(deps): update python-semantic-release/upload-to-gh-release digest to 673709c (1b550ac)

  • chore(deps): update all non-major dependencies (4c7014c)

  • chore: update commit reference in git-blame-ignore-revs (d0fd5ad)

  • chore(cli): add ability to not add _id_attr as an argument

In some cases we don't want to have _id_attr as an argument.

Add ability to have it not be added as an argument. (2037352)

  • chore: create a CustomAction dataclass (61d8679)

  • chore: add an initial .git-blame-ignore-revs

This adds the .git-blame-ignore-revs file which allows ignoring
certain commits when doing a git blame --ignore-revs

Ignore the commit that requires keyword arguments for
register_custom_action()

https://docs.github.com/en/repositories/working-with-files/using-files/viewing-a-file#ignore-commits-in-the-blame-view (74db84c)

  • chore: require keyword arguments for register_custom_action

This makes it more obvious when reading the code what each argument is
for. (7270523)

  • chore: remove typing-extensions from requirements.txt

We no longer support Python versions before 3.8. So it isn't needed
anymore. (d569128)

  • chore(deps): update dependency requests to v2.32.0 [security] (1bc788c)

  • chore(deps): update all non-major dependencies (ba1eec4)

  • chore(deps): update gitlab/gitlab-ee docker tag to v17 (5070d07)

  • chore(cli): on the CLI help show the API endpoint of resources

This makes it easier for people to map CLI command names to the API.

Looks like this:
$ gitlab --help
<snip>
The GitLab resource to manipulate.
application API endpoint: /applications
application-appearance
API endpoint: /application/appearance
application-settings
API endpoint: /application/settings
application-statistics
API endpoint: /application/statistics
<snip> (f1ef565)

  • chore(cli): add some simple help for the standard operations

Add help for the following standard operations:

  • list: List the GitLab resources
  • get: Get a GitLab resource
  • create: Create a GitLab resource
  • update: Update a GitLab resource
  • delete: Delete a GitLab resource

For example:
$ gitlab project-key --help
usage: gitlab project-key [-h] {list,get,create,update,delete,enable} ...

options:
-h, --help show this help message and exit

action:
list
get
create
update
delete
enable
Action to execute on the GitLab resource.
list List the GitLab resources
get Get a GitLab resource
create Create a GitLab resource
update Update a GitLab resource
delete Delete a GitLab resource (5a4a940)

  • chore: correct type-hint for job.trace()

Closes: #2808 (840572e)

  • chore: add type info for ProjectFile.content

Closes: #2821 (62fa271)

Feature

  • feat(api): add additional parameter to project/group iteration search (#2796)

Co-authored-by: Cristiano Casella <cristiano.casella@seacom.it>
Co-authored-by: Nejc Habjan <hab.nejc@gmail.com> (623dac9)

  • feat(api): add support for gitlab service account (#2851)

Co-authored-by: Nejc Habjan <hab.nejc@siemens.com> (b187dea)

  • feat: more usernames support for MR approvals

I don't think commit a2b8c8c went far enough to enable usernames
support. We create and edit a lot of approval rules based on an external
service (similar to CODE_OWNERS), but only have the usernames available,
and currently, have to look up each user to get their user ID to populate
user_ids for .set_approvers() calls. Would very much like to skip the
lookup and just send the usernames, which this change should allow.

See: https://docs.gitlab.com/ee/api/merge_request_approvals.html#create-project-level-rule

Signed-off-by: Jarod Wilson <jarod@redhat.com> (12d195a)

Fix

  • fix(deps): update minimum dependency versions in pyproject.toml

Update the minimum versions of the dependencies in the pyproject.toml
file.

This is related to PR #2878 (37b5a70)

  • fix(cli): don't require --id when enabling a deploy key

No longer require --id when doing:
gitlab project-key enable

Now only the --project-id and --key-id are required. (98fc578)

  • fix: don't raise RedirectError for redirected HEAD requests (8fc13b9)

  • fix: handle large number of approval rules

Use iterator=True when going through the list of current approval
rules. This allows it to handle more than the default of 20 approval
rules.

Closes: #2825 (ef8f0e1)

  • fix(projects): fix 'import_project' file argument type for typings

Signed-off-by: Adrian DC <radian.dc@gmail.com> (33fbc14)

v4.5.0

13 May 22:19
Compare
Choose a tag to compare

v4.5.0 (2024-05-13)

Build

  • build: Add "--no-cache-dir" to pip commands in Dockerfile

This would not leave cache files in the built docker image.

Additionally, also only build the wheel in the build phase.

On my machine, before this PR, size is 74845395; after this PR, size is
72617713. (4ef94c8)

Chore

  • chore(deps): update all non-major dependencies (4f338ae)

  • chore(deps): update gitlab/gitlab-ee docker tag to v16.11.2-ee.0 (9be48f0)

  • chore(deps): update dependency myst-parser to v3 (9289189)

  • chore(deps): update all non-major dependencies (65d0e65)

  • chore(deps): update dependency jinja2 to v3.1.4 [security] (8ea10c3)

  • chore(deps): update all non-major dependencies (1f0343c)

  • chore(deps): update gitlab/gitlab-ee docker tag to v16.11.1-ee.0 (1ed8d6c)

  • chore(deps): update all non-major dependencies (0e9f4da)

  • chore(deps): update gitlab/gitlab-ee docker tag to v16 (ea8c4c2)

  • chore(deps): update all non-major dependencies (d5b5fb0)

  • chore(deps): update dependency pytest-cov to v5 (db32000)

  • chore: update mypy to 1.9.0 and resolve one issue

mypy 1.9.0 flagged one issue in the code. Resolve the issue. Current
unit tests already check that a None value returns text/plain. So
function is still working as expected. (dd00bfc)

  • chore(deps): update dependency black to v24.3.0 [security] (f6e8692)

  • chore(deps): update all non-major dependencies (14a3ffe)

  • chore(deps): update all non-major dependencies (3c4dcca)

  • chore(deps): update all non-major dependencies (04c569a)

  • chore: add tox labels to enable running groups of environments

tox now has a feature of labels which allows running groups of
environments using the command tox -m LABEL_NAME. For example
tox -m lint which has been setup to run the linters.

Bumped the minimum required version of tox to be 4.0, which was
released over a year ago. (d7235c7)

  • chore: add py312 & py313 to tox environment list

Even though there isn't a Python 3.13 at this time, this is done for
the future. tox is already configured to just warn about missing
Python versions, but not fail if they don't exist. (679ddc7)

  • chore(deps): update python-semantic-release/python-semantic-release action to v9 (e11d889)

  • chore(deps): update all non-major dependencies (3c4b27e)

  • chore(deps): update dependency furo to v2024 (f6fd02d)

  • chore(deps): update dependency pytest to v8 (253babb)

  • chore(deps): update dependency pytest-docker to v3 (35d2aec)

  • chore: update version of black for pre-commit

The version of black needs to be updated to be in sync with what is
in requirements-lint.txt (3501716)

  • chore(deps): update all non-major dependencies (7dc2fa6)

  • chore(deps): update codecov/codecov-action action to v4 (d2be1f7)

  • chore: adapt style for black v24 (4e68d32)

  • chore(deps): update dependency black to v24 (f59aee3)

  • chore(deps): update all non-major dependencies (48726fd)

Documentation

  • docs: add FAQ about conflicting parameters

We have received multiple issues lately about this. Add it to the FAQ. (683ce72)

  • docs(README): tweak GitLab CI usage docs (d9aaa99)

  • docs: how to run smoke tests

Signed-off-by: Tim Knight <tim.knight1@engineering.digital.dwp.gov.uk> (2d1f487)

  • docs(objects): minor rst formatting typo

To correctly format a code block have to use :: (57dfd17)

  • docs: correct rotate token example

Rotate token returns a dict. Change example to print the entire dict.

Closes: #2836 (c53e695)

  • docs: Note how to use the Docker image from within GitLab CI

Ref: #2823 (6d4bffb)

  • docs(artifacts): Fix argument indentation (c631eeb)

Feature

  • feat(job_token_scope): support Groups in job token allowlist API (#2816)

  • feat(job_token_scope): support job token access allowlist API

Signed-off-by: Tim Knight <tim.knight1@engineering.digital.dwp.gov.uk>
l.dwp.gov.uk>
Co-authored-by: Nejc Habjan <nejc.habjan@siemens.com> (2d1b749)

  • feat(cli): allow skipping initial auth calls (001e596)

  • feat(api): allow updating protected branches (#2771)

  • feat(api): allow updating protected branches

Closes #2390 (a867c48)

Fix

  • fix: Consider scope an ArrayAttribute in PipelineJobManager

List query params like 'scope' were not being handled correctly for
pipeline/jobs endpoint.
This change ensures multiple values are appended with '[]', resulting in
the correct URL structure.

Signed-off-by: Guilherme Gallo <guilherme.gallo@collabora.com>


Background:
If one queries for pipeline jobs with scope=[&#34;failed&#34;, &#34;success&#34;]

One gets:
GET /api/v4/projects/176/pipelines/1113028/jobs?scope=success&scope=failed

But it is supposed to get:
GET /api/v4/projects/176/pipelines/1113028/jobs?scope[]=success&scope[]=failed

The current version only considers the last element of the list argument.

Signed-off-by: Guilherme Gallo <guilherme.gallo@collabora.com> (c5d0404)

  • fix(test): use different ids for merge request, approval rule, project

The original bug was that the merge request identifier was used instead of the
approval rule identifier. The test didn't notice that because it used 1 for
all identifiers. Make these identifiers different so that a mixup will become
apparent. (c23e6bd)

  • fix(api): fix saving merge request approval rules

Closes #2548 (b8b3849)

  • fix: user.warn() to show correct filename of issue

Previously would only go to the 2nd level of the stack for determining
the offending filename and line number. When it should be showing the
first filename outside of the python-gitlab source code. As we want it
to show the warning for the user of the libraries code.
...

Read more

v4.4.0

15 Jan 08:15
Compare
Choose a tag to compare

v4.4.0 (2024-01-15)

Chore

  • chore(deps): update all non-major dependencies (550f935)

  • chore(deps): update pre-commit hook pycqa/flake8 to v7 (9a199b6)

  • chore(deps): update dependency jinja2 to v3.1.3 [security] (880913b)

  • chore(deps): update dependency flake8 to v7 (20243c5)

  • chore(deps): update all non-major dependencies (cbc13a6)

  • chore(ci): align upload and download action versions (dcca59d)

  • chore(deps): update actions/upload-artifact action to v4 (7114af3)

  • chore(ci): add Python 3.13 development CI job

Add a job to test the development versions of Python 3.13. (ff0c11b)

  • chore(deps): update all non-major dependencies (369a595)

Feature

  • feat(api): add reviewer_details manager for mergrequest to get reviewers of merge request

Those changes implements 'GET /projects/:id/merge_requests/:merge_request_iid/reviewers' gitlab API call.
Naming for call is not reviewers because reviewers atribute already presen in merge request response (adbd90c)

  • feat(api): support access token rotate API (b13971d)

  • feat(api): support single resource access token get API (dae9e52)

Fix

  • fix(cli): support binary files with @ notation

Support binary files being used in the CLI with arguments using the
@ notation. For example --avatar @/path/to/avatar.png

Also explicitly catch the common OSError exception, which is the
parent exception for things like: FileNotFoundError, PermissionError
and more exceptions.

Remove the bare exception handling. We would rather have the full
traceback of any exceptions that we don't know about and add them
later if needed.

Closes: #2752 (57749d4)

v4.3.0

28 Dec 00:37
Compare
Choose a tag to compare

v4.3.0 (2023-12-28)

Chore

  • chore(deps): update all non-major dependencies (d7bdb02)

  • chore(deps): update actions/stale action to v9 (c01988b)

  • chore(deps): update all non-major dependencies (9e067e5)

  • chore(deps): update actions/setup-python action to v5 (fad1441)

  • chore(deps): update all non-major dependencies (bb2af7b)

  • chore(deps): update all non-major dependencies (5ef1b4a)

  • chore(deps): update dependency types-setuptools to v69 (de11192)

Documentation

  • docs: fix rst link typo in CONTRIBUTING.rst (2b6da6e)

Feature

  • feat(api): add support for the Draft notes API (#2728)

  • feat(api): add support for the Draft notes API

  • fix(client): handle empty 204 reponses in PUT requests (ebf9d82)

Fix

  • fix(cli): add ability to disable SSL verification

Add a --no-ssl-verify option to disable SSL verification

Closes: #2714 (3fe9fa6)

v4.2.0

28 Nov 00:38
Compare
Choose a tag to compare

v4.2.0 (2023-11-28)

Chore

  • chore(deps): update all non-major dependencies (8aeb853)

  • chore(deps): update dessant/lock-threads action to v5 (f4ce867)

  • chore(deps): update all non-major dependencies (9fe2335)

  • chore(deps): update all non-major dependencies (91e66e9)

  • chore(deps): update all non-major dependencies (d0546e0)

Feature

  • feat: add pipeline status as Enum

https://docs.gitlab.com/ee/api/pipelines.html (4954bbc)

  • feat(api): add support for wiki attachments (#2722)

Added UploadMixin in mixin module
Added UploadMixin dependency for Project, ProjectWiki, GroupWiki
Added api tests for wiki upload
Added unit test for mixin
Added docs sections to wikis.rst (7b864b8)

v4.1.1

03 Nov 16:13
Compare
Choose a tag to compare

v4.1.1 (2023-11-03)

Chore

  • chore(ci): add release id to workflow step (9270e10)

  • chore(deps): update all non-major dependencies (32954fb)

Documentation

  • docs(users): add missing comma in v4 API create runner examples

The examples which show usage of new runner registration api endpoint
are missing commas. This change adds the missing commas. (b1b2edf)

Fix

  • fix(build): include py.typed in dists (b928639)

v4.1.0

28 Oct 00:35
Compare
Choose a tag to compare

Feature

  • add Merge Request merge_status and detailed_merge_status values as constants (e18a424)

v4.0.0

17 Oct 16:39
Compare
Choose a tag to compare

Feature

  • client: mask tokens by default when logging (1611d78)
  • api: add ProjectPackagePipeline
  • feat: officially support Python 3.12 (2a69c0e)
  • packages: Allow uploading bytes and files
  • feat: Use requests AuthBase classes (5f46cfd)
  • api: add support for job token scope settings (59d6a88)
  • api: support project remote mirror deletion (d900910)
  • api: add optional GET attrs for /projects/:id/ci/lint (40a102d)
  • api: add support for new runner creation API (#2635)
  • releases: Add support for direct_asset_path
  • feat: Added iteration to issue and group filters (8d2d297)

Fix

  • cli: add _from_parent_attrs to user-project manager (#2558) (016d90c)
  • cli: fix action display in --help when there are few actions
  • client: support empty 204 responses in http_patch (e15349c)
  • snippets: allow passing list of files (31c3c5e)

Documentation

  • correct error with back-ticks (#2653)
  • access_token: adopt token docs to 16.1
  • files: fix minor typo in variable declaration (118ce42)

Breaking

  • python-gitlab now explicitly passes auth to requests, meaning
    it will only read netrc credentials if no token is provided, fixing a bug where
    netrc credentials took precedence over OAuth tokens. This also affects the CLI,
    where all environment variables now take precedence over netrc files. (45b8930)
  • python-gitlab now stores metadata in pyproject.toml
    as per PEP 621, with setup.py removed. pip version v21.1 or higher is
    required if you want to perform an editable install. (71fca8c)
  • Constants defined in gitlab.const can no longer be imported globally from gitlab.
    Import them from gitlab.const instead. (e4a1f6e)
  • Support for the deprecated as_list argument in
    list() calls has been removed. Use iterator instead. (9b6d89e)
  • The deprecated lint() method is no longer available.
    Use ci_lint.create() instead. (0b17a2d)
  • The deprecated project.artifact() method is no longer available.
    Use project.artifacts.raw() instead. (90134c9)
  • The deprecated project.artifacts() method is no longer available.
    Use project.artifacts.download() instead. (42639f3)
  • The deprecated group.add_ldap_group_link() and group.delete_ldap_group_link()
    methods are no longer available. Use group.ldap_group_links.create() and group.ldap_group_links.delete()
    instead. (5c8b7c1)
  • The deprecated project.transfer_project() method is no longer available.
    Use project.transfer() instead. (27ed490)
  • The --all option is no longer available in the CLI. Use --get-all instead. (e9d48cf)
  • As of python-gitlab 4.0.0, Python 3.7 is no longer
    supported. Python 3.8 or higher is required. (058d5a5)

v3.15.0

09 Jun 09:51
Compare
Choose a tag to compare

Feature

  • Add support for select="package_file" in package upload (3a49f09)
  • api: Add support for events scope parameter (348f56e)
  • Usernames support for MR approvals (a2b8c8c)

Documentation

  • Remove exclusive EE about issue links (e0f6f18)

v3.14.0

11 Apr 12:27
Compare
Choose a tag to compare

Feature

  • projects: Allow importing additional items from GitHub (ce84f2e)
  • objects: Support fetching PATs via id or self endpoint (19b38bd)
  • Add resource_weight_event for ProjectIssue (6e5ef55)
  • backends: Use PEP544 protocols for structural subtyping (#2442) (4afeaff)
  • client: Add http_patch method (#2471) (f711d9e)
  • cli: Add setting of allow_force_push for protected branch (929e07d)

Fix

  • cli: Warn user when no fields are displayed (8bf53c8)
  • client: Properly parse content-type when charset is present (76063c3)
  • Support int for parent_id in import_group (90f96ac)
  • cli: Add ability to escape at-prefixed parameter (#2513) (4f7c784)
  • cli: Display items when iterator is returned (33a04e7)
  • Typo fixed in docs (ee5f444)

Documentation

  • objects: Fix typo in pipeline schedules (3057f45)
  • advanced: Clarify netrc, proxy behavior with requests (1da7c53)
  • Fix update badge behaviour (3d7ca1c)
  • advanced: Fix typo in Gitlab examples (1992790)