CHANGELOG

v5.1.0 (2024-11-28)

Chores

  • deps: Update all non-major dependencies (9061647)

  • deps: Update gitlab/gitlab-ee docker tag to v17.6.0-ee.0 (#3044, 79113d9)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

  • deps: Update all non-major dependencies (62da12a)

  • deps: Update gitlab/gitlab-ee docker tag to v17.5.2-ee.0 (#3041, d39129b)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

  • deps: Update pre-commit hook maxbrunet/pre-commit-renovate to v39 (11458e0)

  • deps: Update all non-major dependencies (7e62136)

  • deps: Update dependency pytest-cov to v6 (ffa88b3)

  • deps: Update all non-major dependencies (d4b52e7)

  • deps: Update all non-major dependencies (541a7e3)

  • deps: Update gitlab/gitlab-ee docker tag to v17.5.1-ee.0 (8111f49)

Features

  • api: Get single project approval rule (029695d)

  • cli: Enable token rotation via CLI (0cb8171)

  • const: Add new Planner role to access levels (bdc8852)

  • api: Support list and delete for group service accounts (#2963, 499243b)

  • files: Add support for more optional flags (f51cd52)

GitLab’s Repository Files API supports additional flags that weren’t implemented before. Notably, the “start_branch” flag is particularly useful, as previously one had to use the “project-branch” command alongside “project-file” to add a file on a separate branch.

[1] https://docs.gitlab.com/ee/api/repository_files.html

v5.0.0 (2024-10-28)

Bug Fixes

  • api: Set _repr_attr for project approval rules to name attr (#3011, 1a68f1c)

Co-authored-by: Patrick Evans patrick.evans@gehealthcare.com

Chores

  • Add testing of Python 3.14 (14d2a82)

Also fix annotations not working in Python 3.14 by using the annotation on the ‘class’ instead of on the ‘instance’

Closes: #3013

  • deps: Update dependency ubuntu to v24 (6fda15d)

  • deps: Update all non-major dependencies (1e4326b)

  • deps: Update gitlab/gitlab-ee docker tag to v17.5.0-ee.0 (c02a392)

  • Add Python 3.13 as supported (#3012, b565e78)

Mark that Python 3.13 is supported.

Use Python 3.13 for the Mac and Windows tests.

Also remove the ‘py38’ tox environment. We no longer support Python 3.8.

  • Remove “v3” question from issue template (#3017, 482f2fe)

python-gitlab hasn’t supported the GitLab v3 API since 2018. The last version of python-gitlab to support it was v1.4

Support was removed in:

commit fe89b949922c028830dd49095432ba627d330186 Author: Gauvain Pocentek gauvain@pocentek.net Date: Sat May 19 17:10:08 2018 +0200

Drop API v3 support

Drop the code, the tests, and update the documentation.

  • deps: Update all non-major dependencies (b3834dc)

  • deps: Update gitlab/gitlab-ee docker tag to v17.4.2-ee.0 (1cdfe40)

Documentation

Features

  • Remove support for Python 3.8, require 3.9 or higher (#3005, 9734ad4)

Python 3.8 is End-of-Life (EOL) as of 2024-10 as stated in https://devguide.python.org/versions/ and https://peps.python.org/pep-0569/#lifespan

By dropping support for Python 3.8 and requiring Python 3.9 or higher it allows python-gitlab to take advantage of new features in Python 3.9, which are documented at: https://docs.python.org/3/whatsnew/3.9.html

Closes: #2968

BREAKING CHANGE: As of python-gitlab 5.0.0, Python 3.8 is no longer supported. Python 3.9 or higher is required.

Testing

  • Add test for to_json() method (f4bfe19)

This should get us to 100% test coverage on gitlab/base.py

v4.13.0 (2024-10-08)

Chores

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

  • deps: Update all non-major dependencies (c3efb37)

Features

  • api: Add support for project Pages API (0ee0e02)

v4.12.2 (2024-10-01)

Bug Fixes

  • Raise GitlabHeadError in project.files.head() method (#3006, 9bf26df)

When an error occurs, raise GitlabHeadError in project.files.head() method.

Closes: #3004

v4.12.1 (2024-09-30)

Bug Fixes

  • ci: Do not rely on GitLab.com runner arch variables (#3003, c848d12)

  • files: Correctly raise GitlabGetError in get method (190ec89)

Chores

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

  • deps: Update gitlab/gitlab-ee docker tag to v17.4.1-ee.0 (64eed5d)

v4.12.0 (2024-09-28)

Bug Fixes

  • api: Head requests for projectfilemanager (#2977, 96a18b0)

  • fix(api): head requests for projectfilemanager


Co-authored-by: Patrick Evans patrick.evans@gehealthcare.com Co-authored-by: Nejc Habjan hab.nejc@gmail.com

Chores

  • deps: Update all non-major dependencies (ae132e7)

  • Update pylint to 3.3.1 and resolve issues (#2997, a0729b8)

pylint 3.3.1 appears to have added “too-many-positional-arguments” check with a value of 5.

I don’t disagree with this, but we have many functions which exceed this value. We might think about converting some of positional arguments over to keyword arguments in the future. But that is for another time.

For now disable the check across the project.

  • deps: Update dependency types-setuptools to v75 (a2ab54c)

  • deps: Update gitlab/gitlab-ee docker tag to v17.4.0-ee.0 (8601808)

  • deps: Update all non-major dependencies (10ee58a)

  • deps: Update gitlab/gitlab-ee docker tag to v17.3.2-ee.0 (5cd1ab2)

Features

v4.11.1 (2024-09-13)

Bug Fixes

  • client: Ensure type evaluations are postponed (b41b2de)

v4.11.0 (2024-09-13)

Chores

  • pre-commit: Add deps (fe5e608)

  • deps: Update all non-major dependencies (fac8bf9)

  • deps: Update dependency types-setuptools to v74 (bdfaddb)

  • deps: Update all non-major dependencies (88c7529)

Documentation

  • objects: Fix typo in get latest pipeline (b9f5c12)

Features

  • client: Make retries configurable in GraphQL (145870e)

  • client: Add retry handling to GraphQL client (8898c38)

  • api: Add exclusive GET attrs for /projects/:id/members (e637808)

  • Add a minimal GraphQL client (d6b1b0a)

  • api: Add exclusive GET attrs for /groups/:id/members (d44ddd2)

Refactoring

  • client: Move retry logic into utility (3235c48)

v4.10.0 (2024-08-28)

Chores

  • release: Track tags for renovate (d600444)

  • deps: Update python-semantic-release/upload-to-gh-release digest to 17c75b7 (12caaa4)

  • deps: Update dependency types-setuptools to v73 (d55c045)

  • deps: Update all non-major dependencies (2ade0d9)

  • deps: Update gitlab/gitlab-ee docker tag to v17.3.1-ee.0 (3fdd130)

  • deps: Update all non-major dependencies (0578bf0)

  • deps: Update gitlab/gitlab-ee docker tag to v17.3.0-ee.0 (e5a46f5)

  • deps: Update dependency myst-parser to v4 (930d4a2)

  • deps: Update dependency sphinx to v8 (cb65ffb)

  • deps: Update gitlab/gitlab-ee docker tag to v17.2.2-ee.0 (b2275f7)

  • deps: Update all non-major dependencies (31786a6)

Documentation

  • faq: Correct the attribute fetching example (43a16ac)

There is an example about object attributes in the FAQ. It shows how to properly fetch all attributes of all projects, by using list() followed by a get(id) call.

Unfortunately this example used a wrong variable name, which caused it not to work and which could have made it slightly confusing to readers. This commit fixes that, by changing the variable name.

Now the example uses one variable for two Python objects. As they correspond to the same GitLab object and the intended behavior is to obtain that very object, just with all attributes, this is fine and is probably what readers will find most useful in this context.

Features

  • api: Project/group hook test triggering (9353f54)

Add the ability to trigger tests of project and group hooks.

Fixes #2924

Testing

  • cli: Allow up to 30 seconds for a project export (bdc155b)

Before we allowed a maximum of around 15 seconds for the project-export. Often times the CI was failing with this value.

Change it to a maximum of around 30 seconds.

v4.9.0 (2024-08-06)

Chores

  • deps: Update pre-commit hook maxbrunet/pre-commit-renovate to v38 (f13968b)

  • deps: Update all non-major dependencies (f95ca26)

  • deps: Update dependency types-setuptools to v71 (d6a7dba)

  • deps: Update python-semantic-release/upload-to-gh-release digest to 0dcddac (eb5c6f7)

  • deps: Update gitlab/gitlab-ee docker tag to v17.2.1-ee.0 (d13a656)

  • deps: Update all non-major dependencies (7adc86b)

  • deps: Update python-semantic-release/upload-to-gh-release digest to e2355e1 (eb18552)

  • deps: Update all non-major dependencies (e820db0)

  • ci: Make pre-commit check happy (67370d8)

pre-commit incorrectly wants double back-quotes inside the code section. Rather than fight it, just use single quotes.

Features

  • snippets: Add support for listing all instance snippets (64ae61e)

v4.8.0 (2024-07-16)

Bug Fixes

  • Issues closed_by()/related_merge_requests() use http_list (de2e4dd)

The closed_by() and related_merge_requests() API calls return lists. So use the http_list() method.

This will also warn the user if only a subset of the data is returned.

  • Have participants() method use http_list() (d065275)

Previously it was using http_get() but the participants API returns a list of participants. Also by using this then we will warn if only a subset of the participants are returned.

Closes: #2913

  • files: Cr: add explicit comparison to None (51d8f88)

Co-authored-by: Nejc Habjan hab.nejc@gmail.com

  • files: Make ref parameter optional in get raw file api (00640ac)

The ref parameter was made optional in gitlab v13.11.0.

  • cli: Generate UserWarning if list does not return all entries (e5a4379)

Previously in the CLI, calls to list() would have get_all=False by default. Therefore hiding the fact that not all items are being returned if there were more than 20 items.

Added --no-get-all option to list actions. Along with the already existing --get-all.

Closes: #2900

Chores

  • deps: Update gitlab/gitlab-ee docker tag to v17.1.2-ee.0 (6fedfa5)

  • deps: Update all non-major dependencies (4a2b213)

  • ci: Specify name of “stale” label (44f62c4)

Saw the following error in the log: [#2618] Removing the label “Stale” from this issue… ##[error][#2618] Error when removing the label: “Label does not exist”

My theory is that the case doesn’t match (“Stale” != “stale”) and that is why it failed. Our label is “stale” so update this to match. Thought of changing the label name on GitHub but then would also require a change here to the “any-of-labels”. So it seemed simpler to just change it here.

It is confusing though that it detected the label “stale”, but then couldn’t delete it.

  • ci: Stale: allow issues/PRs that have stale label to be closed (2ab88b2)

If a stale label is manually applied, allow the issue or PR to be closed by the stale job.

Previously it would require the stale label and to also have one of ‘need info’ or ‘Waiting for response’ labels added.

  • ci: Use codecov token when available (b74a6fb)

  • deps: Update python-semantic-release/upload-to-gh-release digest to fe6cc89 (3f3ad80)

  • deps: Update all non-major dependencies (0f59069)

  • Add show_caller argument to utils.warn() (7d04315)

This allows us to not add the caller’s location to the UserWarning message.

  • Use correct type-hint for die() (9358640)

  • deps: Update gitlab/gitlab-ee docker tag to v17.1.1-ee.0 (5e98510)

  • deps: Update python-semantic-release/upload-to-gh-release digest to c7c3b69 (23393fa)

  • deps: Update all non-major dependencies (cf87226)

Documentation

  • Document how to use sudo if modifying an object (d509da6)

Add a warning about using sudo when saving.

Give an example of how to get an object, modify it, and then save it using sudo

Closes: #532

  • Variables: add note about filter for updating (c378817)

Add a note about using filter when updating a variable.

Closes: #2835 Closes: #1387 Closes: #1125

Features

  • api: Add support for project cluster agents (32dbc6f)

  • api: Add support for container registry protection rules (6d31649)

  • api: Add support for package protection rules (6b37811)

  • api: Add support for commit sequence (1f97be2)

Refactoring

  • package_protection_rules: Add missing attributes (c307dd2)

Testing

  • registry: Disable functional tests for unavailable endpoints (ee393a1)

  • files: Test with and without ref parameter in test case (f316b46)

  • files: Omit optional ref parameter in test case (9cb3396)

  • fixtures: Remove deprecated config option (2156949)

v4.7.0 (2024-06-28)

Bug Fixes

  • Add ability to add help to custom_actions (9acd2d2)

Now when registering a custom_action can add help text if desired.

Also delete the VerticalHelpFormatter as no longer needed. When the help value is set to None or some other value, the actions will get printed vertically. Before when the help value was not set the actions would all get put onto one line.

Chores

  • deps: Update all non-major dependencies (88de2f0)

  • deps: Update all non-major dependencies (a510f43)

  • deps: Update gitlab/gitlab-ee docker tag to v17.0.2-ee.0 (51779c6)

  • deps: Update python-semantic-release/upload-to-gh-release digest to 6b7558f (fd0f0b0)

  • deps: Update all non-major dependencies (d4fdf90)

  • deps: Update dependency types-setuptools to v70 (7767514)

  • deps: Update gitlab/gitlab-ee docker tag to v17.0.1-ee.0 (df0ff4c)

  • deps: Update python-semantic-release/upload-to-gh-release digest to 477a404 (02a551d)

  • deps: Update all non-major dependencies (d5de288)

  • Add a help message for gitlab project-key enable (1291dbb)

Add some help text for gitlab project-key enable. This both adds help text and shows how to use the new help feature.

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 enable Enable a deploy key for the project

  • Sort CLI behavior-related args to remove (9b4b0ef)

Sort the list of CLI behavior-related args that are to be removed.

Features

  • api: Add support for latest pipeline (635f5a7)

  • Add --no-mask-credentials CLI argument (18aa1fc)

This gives the ability to not mask credentials when using the --debug argument.

v4.6.0 (2024-05-28)

Bug Fixes

  • deps: Update minimum dependency versions in pyproject.toml (37b5a70)

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

This is related to PR #2878

  • cli: Don’t require --id when enabling a deploy key (98fc578)

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

Now only the –project-id and –key-id are required.

  • Don’t raise RedirectError for redirected HEAD requests (8fc13b9)

  • Handle large number of approval rules (ef8f0e1)

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

  • projects: Fix ‘import_project’ file argument type for typings (33fbc14)

Signed-off-by: Adrian DC radian.dc@gmail.com

Chores

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

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

  • Update commit reference in git-blame-ignore-revs (d0fd5ad)

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

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.

  • Create a CustomAction dataclass (61d8679)

  • Add an initial .git-blame-ignore-revs (74db84c)

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

  • Require keyword arguments for register_custom_action (7270523)

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

  • Remove typing-extensions from requirements.txt (d569128)

We no longer support Python versions before 3.8. So it isn’t needed anymore.

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

  • deps: Update all non-major dependencies (ba1eec4)

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

  • cli: On the CLI help show the API endpoint of resources (f1ef565)

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

Looks like this: $ gitlab –help 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

  • cli: Add some simple help for the standard operations (5a4a940)

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

  • Correct type-hint for job.trace() (840572e)

Closes: #2808

  • Add type info for ProjectFile.content (62fa271)

Closes: #2821

Features

  • api: Add additional parameter to project/group iteration search (#2796, 623dac9)

Co-authored-by: Cristiano Casella cristiano.casella@seacom.it Co-authored-by: Nejc Habjan hab.nejc@gmail.com

  • api: Add support for gitlab service account (#2851, b187dea)

Co-authored-by: Nejc Habjan hab.nejc@siemens.com

  • More usernames support for MR approvals (12d195a)

I don’t think commit a2b8c8ccfb5d 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

v4.5.0 (2024-05-13)

Bug Fixes

  • Consider scope an ArrayAttribute in PipelineJobManager (c5d0404)

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=["failed", "success"]

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

  • test: Use different ids for merge request, approval rule, project (c23e6bd)

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.

  • api: Fix saving merge request approval rules (b8b3849)

Closes #2548

  • User.warn() to show correct filename of issue (529f1fa)

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.

Update test to show it works as expected.

  • api: Update manual job status when playing it (9440a32)

  • cli: Allow exclusive arguments as optional (#2770, 7ec3189)

  • fix(cli): allow exclusive arguments as optional

The CLI takes its arguments from the RequiredOptional, which has three fields: required, optional, and exclusive. In practice, the exclusive options are not defined as either required or optional, and would not be allowed in the CLI. This changes that, so that exclusive options are also added to the argument parser.

  • fix(cli): inform argument parser that options are mutually exclusive

  • fix(cli): use correct exclusive options, add unit test

Closes #2769

Build System

  • Add “–no-cache-dir” to pip commands in Dockerfile (4ef94c8)

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.

Chores

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

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

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

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

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

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

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

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

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

  • deps: Update all non-major dependencies (d5b5fb0)

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

  • Update mypy to 1.9.0 and resolve one issue (dd00bfc)

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.

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

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

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

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

  • Add tox labels to enable running groups of environments (d7235c7)

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.

  • Add py312 & py313 to tox environment list (679ddc7)

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.

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

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

  • deps: Update dependency furo to v2024 (f6fd02d)

  • deps: Update dependency pytest to v8 (253babb)

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

  • Update version of black for pre-commit (3501716)

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

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

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

  • Adapt style for black v24 (4e68d32)

  • deps: Update dependency black to v24 (f59aee3)

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

Documentation

  • Add FAQ about conflicting parameters (683ce72)

We have received multiple issues lately about this. Add it to the FAQ.

  • README: Tweak GitLab CI usage docs (d9aaa99)

  • How to run smoke tests (2d1f487)

Signed-off-by: Tim Knight tim.knight1@engineering.digital.dwp.gov.uk

  • objects: Minor rst formatting typo (57dfd17)

To correctly format a code block have to use ::

  • Correct rotate token example (c53e695)

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

Closes: #2836

  • Note how to use the Docker image from within GitLab CI (6d4bffb)

Ref: #2823

  • artifacts: Fix argument indentation (c631eeb)

Features

  • job_token_scope: Support Groups in job token allowlist API (#2816, 2d1b749)

  • 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

  • cli: Allow skipping initial auth calls (001e596)

  • api: Allow updating protected branches (#2771, a867c48)

  • feat(api): allow updating protected branches

Closes #2390

Testing

Signed-off-by: Tim Knight tim.knight1@engineering.digital.dwp.gov.uk

  • Tidy up functional tests (06266ea)

Signed-off-by: Tim Knight tim.knight1@engineering.digital.dwp.gov.uk

  • Update api tests for GL 16.10 (4bef473)

  • Make sure we’re testing python-gitlab functionality, make sure we’re not awaiting on Gitlab Async functions - Decouple and improve test stability

Signed-off-by: Tim Knight tim.knight1@engineering.digital.dwp.gov.uk

  • functional: Enable bulk import feature flag before test (b81da2e)

  • Don’t use weak passwords (c64d126)

Newer versions of GitLab will refuse to create a user with a weak password. In order for us to move to a newer GitLab version in testing use a stronger password for the tests that create a user.

  • Update tests for gitlab 16.8 functionality (f8283ae)

  • use programmatic dates for expires_at in tokens tests - set PAT for 16.8 into tests

Signed-off-by: Tim Knight tim.knight1@engineering.digital.dwp.gov.uk

  • smoke: Normalize all dist titles for smoke tests (ee013fe)

v4.4.0 (2024-01-15)

Bug Fixes

  • cli: Support binary files with @ notation (57749d4)

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

Chores

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

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

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

  • deps: Update dependency flake8 to v7 (20243c5)

  • deps: Update all non-major dependencies (cbc13a6)

  • ci: Align upload and download action versions (dcca59d)

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

  • ci: Add Python 3.13 development CI job (ff0c11b)

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

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

Features

  • api: Add reviewer_details manager for mergrequest to get reviewers of merge request (adbd90c)

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

  • api: Support access token rotate API (b13971d)

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

v4.3.0 (2023-12-28)

Bug Fixes

  • cli: Add ability to disable SSL verification (3fe9fa6)

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

Closes: #2714

Chores

  • deps: Update all non-major dependencies (d7bdb02)

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

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

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

  • deps: Update all non-major dependencies (bb2af7b)

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

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

Documentation

  • Fix rst link typo in CONTRIBUTING.rst (2b6da6e)

Features

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

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

v4.2.0 (2023-11-28)

Chores

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

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

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

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

  • deps: Update all non-major dependencies (d0546e0)

Features

  • Add pipeline status as Enum (4954bbc)

https://docs.gitlab.com/ee/api/pipelines.html

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

v4.1.1 (2023-11-03)

Bug Fixes

  • build: Include py.typed in dists (b928639)

Chores

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

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

Documentation

  • users: Add missing comma in v4 API create runner examples (b1b2edf)

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

v4.1.0 (2023-10-28)

Bug Fixes

  • Remove depricated MergeStatus (c6c012b)

Chores

  • deps: Update all non-major dependencies (bf68485)

  • CHANGELOG: Re-add v4.0.0 changes using old format (258a751)

  • CHANGELOG: Revert python-semantic-release format change (b5517e0)

  • Add source label to container image (7b19278)

  • rtd: Revert to python 3.11 (#2694, 1113742)

Continuous Integration

  • Remove unneeded GitLab auth (fd7bbfc)

Features

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

v4.0.0 (2023-10-17)

Bug Fixes

  • cli: Add _from_parent_attrs to user-project manager (#2558, 016d90c)

  • cli: Fix action display in –help when there are few actions (b22d662)

fixes #2656

  • client: Support empty 204 responses in http_patch (e15349c)

  • snippets: Allow passing list of files (31c3c5e)

  • cli: Remove deprecated --all option in favor of --get-all (e9d48cf)

BREAKING CHANGE: The --all option is no longer available in the CLI. Use --get-all instead.

Chores

  • ci: Follow upstream config for release build_command (3e20a76)

  • ci: Update release build for python-semantic-release v8 (#2692, bf050d1)

  • deps: Update pre-commit hook pycqa/pylint to v3 (0f4a346)

  • deps: Update all non-major dependencies (1348a04)

  • Add package pipelines API link (2a2404f)

  • ci: Fix pre-commit deps and python version (1e7f257)

  • ci: Remove Python 3.13 dev job (e8c50f2)

  • helpers: Fix previously undetected flake8 issue (bf8bd73)

  • Fix test names (f1654b8)

  • Make linters happy (3b83d5d)

  • Change _update_uses to _update_method and use an Enum (7073a2d)

Change the name of the _update_uses attribute to _update_method and store an Enum in the attribute to indicate which type of HTTP method to use. At the moment it supports POST and PUT. But can in the future support PATCH.

  • deps: Update all non-major dependencies (ff45124)

  • deps: Update dependency pylint to v3 (491350c)

  • deps: Update pre-commit hook maxbrunet/pre-commit-renovate to v37 (b4951cd)

  • deps: Update all non-major dependencies (0d49164)

  • deps: Update dependency commitizen to v3.10.0 (becd8e2)

  • deps: Update pre-commit hook commitizen-tools/commitizen to v3.10.0 (626c2f8)

  • deps: Update all non-major dependencies (6093dbc)

  • deps: Update all non-major dependencies (bb728b1)

  • deps: Update all non-major dependencies to v23.9.1 (a16b732)

  • deps: Update actions/checkout action to v4 (af13914)

  • deps: Update all non-major dependencies (9083787)

  • deps: Update dependency build to v1 (2e856f2)

  • deps: Update all non-major dependencies (b6a3db1)

  • rtd: Use readthedocs v2 syntax (6ce2149)

  • rtd: Fix docs build on readthedocs.io (#2654, 3d7139b)

  • ci: Adapt release workflow and config for v8 (827fefe)

  • deps: Update relekang/python-semantic-release action to v8 (c57c85d)

  • deps: Update all non-major dependencies (16f2d34)

  • deps: Update all non-major dependencies (5b33ade)

  • deps: Update pre-commit hook maxbrunet/pre-commit-renovate to v36 (db58cca)

  • deps: Update dependency ubuntu to v22 (8865552)

  • deps: Update all non-major dependencies (3732841)

  • deps: Update dependency pytest-docker to v2 (b87bb0d)

  • Switch to docker-compose v2 (713b5ca)

Closes: #2625

Fixes issue with CI having error: AttributeError: cython_sources

Closes: #2624

  • deps: Update all non-major dependencies (511f45c)

  • deps: Update all non-major dependencies (d4a7410)

  • deps: Update all non-major dependencies (12846cf)

  • deps: Update all non-major dependencies (33d2aa2)

  • deps: Update dependency types-setuptools to v68 (bdd4eb6)

  • deps: Update actions/upload-artifact action to v3 (b78d6bf)

  • deps: Update dependency setuptools to v68 (0f06082)

  • deps: Bring myst-parser up to date with sphinx 7 (da03e9c)

  • deps: Bring furo up to date with sphinx (a15c927)

  • deps: Update dependency sphinx to v7 (2918dfd)

  • deps: Update actions/checkout action to v3 (e2af1e8)

  • deps: Update actions/setup-python action to v4 (e0d6783)

  • deps: Update all non-major dependencies (5ff56d8)

  • deps: Pin pytest-console-scripts for 3.7 (6d06630)

  • deps: Update all non-major dependencies (7586a5c)

Documentation

  • advanced: Document new netrc behavior (45b8930)

BREAKING CHANGE: 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.

New linting package update detected the issue.

  • access_token: Adopt token docs to 16.1 (fe7a971)

expires_at is now required Upstream MR: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/124964

  • files: Fix minor typo in variable declaration (118ce42)

Features

  • client: Mask tokens by default when logging (1611d78)

  • api: Add ProjectPackagePipeline (5b4addd)

Add ProjectPackagePipeline, which is scheduled to be included in GitLab 16.0

  • Officially support Python 3.12 (2a69c0e)

  • packages: Allow uploading bytes and files (61e0fae)

This commit adds a keyword argument to GenericPackageManager.upload() to allow uploading bytes and file-like objects to the generic package registry. That necessitates changing file path to be a keyword argument as well, which then cascades into a whole slew of checks to not allow passing both and to not allow uploading file-like objects as JSON data.

Closes https://github.com/python-gitlab/python-gitlab/issues/1815

  • 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, 4abcd17)

Co-authored-by: Nejc Habjan hab.nejc@gmail.com

  • releases: Add support for direct_asset_path (d054917)

This commit adds support for the “new” alias for filepath: direct_asset_path (added in 15.10) in release links API.

  • Remove support for Python 3.7, require 3.8 or higher (058d5a5)

Python 3.8 is End-of-Life (EOL) as of 2023-06-27 as stated in https://devguide.python.org/versions/ and https://peps.python.org/pep-0537/

By dropping support for Python 3.7 and requiring Python 3.8 or higher it allows python-gitlab to take advantage of new features in Python 3.8, which are documented at: https://docs.python.org/3/whatsnew/3.8.html

BREAKING CHANGE: As of python-gitlab 4.0.0, Python 3.7 is no longer supported. Python 3.8 or higher is required.

  • Added iteration to issue and group filters (8d2d297)

Refactoring

  • build: Build project using PEP 621 (71fca8c)

BREAKING CHANGE: 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.

  • const: Remove deprecated global constant import (e4a1f6e)

BREAKING CHANGE: Constants defined in gitlab.const can no longer be imported globally from gitlab. Import them from gitlab.const instead.

  • list: as_list support is removed. (9b6d89e)

In list() calls support for the as_list argument has been removed. as_list was previously deprecated and now the use of iterator will be required if wanting to have same functionality as using as_list

BREAKING CHANGE: Support for the deprecated as_list argument in list() calls has been removed. Use iterator instead.

  • lint: Remove deprecated lint()in favor of ci_lint.create() (0b17a2d)

BREAKING CHANGE: The deprecated lint() method is no longer available. Use ci_lint.create() instead.

  • artifacts: Remove deprecated artifact()in favor of artifacts.raw() (90134c9)

BREAKING CHANGE: The deprecated project.artifact() method is no longer available. Use project.artifacts.raw() instead.

  • artifacts: Remove deprecated artifacts()in favor of artifacts.download() (42639f3)

BREAKING CHANGE: The deprecated project.artifacts() method is no longer available. Use project.artifacts.download() instead.

  • groups: Remove deprecated LDAP group link add/delete methods (5c8b7c1)

BREAKING CHANGE: 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.

  • projects: Remove deprecated project.transfer_project() in favor of project.transfer() (27ed490)

BREAKING CHANGE: The deprecated project.transfer_project() method is no longer available. Use project.transfer() instead.

Testing

  • Add tests for token masking (163bfcf)

  • cli: Add test for user-project list (a788cff)

  • Correct calls to script_runner.run() (cd04315)

Warnings were being raised. Resolve those warnings.

  • Fix failing tests that use 204 (No Content) plus content (3074f52)

urllib3>=2 now checks for expected content length. Also codes 204 and 304 are set to expect a content length of 0 [1]

So in the unit tests stop setting content to return in these situations.

[1] https://github.com/urllib3/urllib3/blob/88a707290b655394aade060a8b7eaee83152dc8b/src/urllib3/response.py#L691-L693

v3.15.0 (2023-06-09)

Chores

  • deps: Update pre-commit hook maxbrunet/pre-commit-renovate to v35 (8202e3f)

  • Update sphinx from 5.3.0 to 6.2.1 (c44a290)

  • Update copyright year to include 2023 (511c6e5)

  • deps: Update all non-major dependencies (e3de6ba)

  • deps: Update pre-commit hook commitizen-tools/commitizen to v3 (1591e33)

  • deps: Update dependency types-setuptools to v67 (c562424)

  • deps: Update dependency requests-toolbelt to v1 (86eba06)

  • deps: Update dependency myst-parser to v1 (9c39848)

  • deps: Update dependency commitizen to v3 (784d59e)

  • ci: Use OIDC trusted publishing for pypi.org (#2559, 7be09e5)

  • chore(ci): use OIDC trusted publishing for pypi.org

  • chore(ci): explicitly install setuptools in tests

Documentation

  • Remove exclusive EE about issue links (e0f6f18)

Features

  • Add support for select="package_file" in package upload (3a49f09)

Add ability to use select="package_file" when uploading a generic package as described in: https://docs.gitlab.com/ee/user/packages/generic_packages/index.html

Closes: #2557

  • api: Add support for events scope parameter (348f56e)

  • Usernames support for MR approvals (a2b8c8c)

This can be used instead of ‘user_ids’

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

v3.14.0 (2023-04-11)

Bug Fixes

  • 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)

This will also fix other use cases where an integer is passed in to MultipartEncoder.

Added unit tests to show it works.

Closes: #2506

  • cli: Add ability to escape at-prefixed parameter (#2513, 4f7c784)

  • fix(cli): Add ability to escape at-prefixed parameter (#2511)


Co-authored-by: Nejc Habjan hab.nejc@gmail.com

  • cli: Display items when iterator is returned (33a04e7)

Chores

  • ci: Wait for all coverage reports in CI status (511764d)

  • setup: Depend on typing-extensions for 3.7 until EOL (3abc557)

  • Add Contributor Covenant 2.1 as Code of Conduct (fe334c9)

See https://www.contributor-covenant.org/version/2/1/code_of_conduct/

  • deps: Update all non-major dependencies (8b692e8)

  • deps: Update dependency furo to v2023 (7a1545d)

  • deps: Update actions/stale action to v8 (7ac4b86)

  • pre-commit: Bumping versions (e973729)

  • .github: Actually make PR template the default (7a8a862)

  • Use a dataclass to return values from prepare_send_data (f2b5e4f)

I found the tuple of three values confusing. So instead use a dataclass to return the three values. It is still confusing but a little bit less so.

Also add some unit tests

  • contributing: Refresh development docs (d387d91)

  • github: Add default pull request template (bf46c67)

  • deps: Update all non-major dependencies (#2493, 07d03dc)

  • chore(deps): update all non-major dependencies * chore(fixtures): downgrade GitLab for now * chore(deps): ungroup typing deps, group gitlab instead * chore(deps): downgrade argcomplete for now


Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Nejc Habjan nejc.habjan@siemens.com

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

  • renovate: Swith to gitlab-ee (8da48ee)

  • renovate: Bring back custom requirements pattern (ae0b21c)

  • deps: Update mypy (1.0.0) and responses (0.22.0) (9c24657)

Update the requirements-* files.

In order to update mypy==1.0.0 we need to also update responses==0.22.0

Fix one issue found by mypy

Leaving updates for precommit to be done in a separate commit by someone.

  • renovate: Do not ignore tests dir (5b8744e)

  • deps: Update all non-major dependencies (2f06999)

  • deps: Update pre-commit hook psf/black to v23 (217a787)

  • deps: Update black (23.1.0) and commitizen (2.40.0) (#2479, 44786ef)

Update the dependency versions: black: 23.1.0 commitizen: 2.40.0

They needed to be updated together as just updating black caused a dependency conflict.

Updated files by running black and committing the changes.

For users who use tox having pre-commit as part of the default environment list is redundant as it will run the same tests again that are being run in other environments. For example: black, flake8, pylint, and more.

  • Add Python 3.12 testing (0867564)

Add a unit test for Python 3.12. This will use the latest version of Python 3.12 that is available from https://github.com/actions/python-versions/

At this time it is 3.12.0-alpha.4 but will move forward over time until the final 3.12 release and updates. So 3.12.0, 3.12.1, … will be matched.

Documentation

  • objects: Fix typo in pipeline schedules (3057f45)

  • advanced: Clarify netrc, proxy behavior with requests (1da7c53)

  • Fix update badge behaviour (3d7ca1c)

docs: fix update badge behaviour

Earlier: badge.image_link = new_link

Now: badge.image_url = new_image_url badge.link_url = new_link_url

  • advanced: Fix typo in Gitlab examples (1992790)

Features

  • 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)

The purpose of this change is to track API changes described in https://github.com/python-gitlab/python-gitlab/blob/main/docs/api-levels.rst, for example, for package versioning and breaking change announcements in case of protocol changes.

This is MVP implementation to be used by #2435.

In order to support some new API calls we need to support the HTTP PATCH method.

Closes: #2469

  • cli: Add setting of allow_force_push for protected branch (929e07d)

For the CLI: add allow_force_push as an optional argument for creating a protected branch.

API reference: https://docs.gitlab.com/ee/api/protected_branches.html#protect-repository-branches

Closes: #2466

Refactoring

  • client: Let mypy know http_password is set (2dd177b)

Testing

  • unit: Increase V4 CLI coverage (5748d37)

  • unit: Split the last remaining unittest-based classes into modules” (14e0f65)

  • unit: Remove redundant package (4a9e3ee)

  • unit: Consistently use inline fixtures (1bc56d1)

  • meta: Move meta suite into unit tests (847004b)

They’re always run with it anyway, so it makes no difference.

  • functional: Clarify MR fixture factory name (d8fd1a8)

v3.13.0 (2023-01-30)

Bug Fixes

  • client: Regression - do not automatically get_next if page=# and (585e3a8)

  • Change return value to “None” in case getattr returns None to prevent error (3f86d36)

  • deps: Bump requests-toolbelt to fix deprecation warning (faf842e)

  • Typo fixed in docs (ee5f444)

  • Use the ProjectIterationManager within the Project object (44f05dc)

The Project object was previously using the GroupIterationManager resulting in the incorrect API endpoint being used. Utilize the correct ProjectIterationManager instead.

Resolves #2403

  • api: Make description optional for releases (5579750)

Chores

  • Make backends private (1e629af)

  • deps: Update all non-major dependencies (ea7010b)

  • Add a UserWarning if both iterator=True and page=X are used (#2462, 8e85791)

If a caller calls a list() method with both iterator=True (or as_list=False) and page=X then emit a UserWarning as the options are mutually exclusive.

  • Remove tox envdir values (3c7c7fc)

tox > 4 no longer will re-use the tox directory :( What this means is that with the previous config if you ran: $ tox -e mypy; tox -e isort; tox -e mypy It would recreate the tox environment each time :(

By removing the envdir values it will have the tox environments in separate directories and not recreate them.

The have an FAQ entry about this: https://tox.wiki/en/latest/upgrading.html#re-use-of-environments

  • Update attributes for create and update projects (aa44f2a)

  • deps: Update all non-major dependencies (122988c)

  • deps: Update all non-major dependencies (49c0233)

  • deps: Update all non-major dependencies (10c4f31)

  • deps: Update all non-major dependencies (bbd01e8)

  • deps: Update actions/stale action to v7 (76eb024)

  • ci: Complete all unit tests even if one has failed (#2438, 069c6c3)

  • Add test, docs, and helper for 409 retries (3e1c625)

  • deps: Update all non-major dependencies (6682808)

  • deps: Update all non-major dependencies (1816107)

  • deps: Update pre-commit hook pycqa/flake8 to v6 (82c61e1)

  • Add docs for schedule pipelines (9a9a6a9)

  • tox: Ensure test envs have all dependencies (63cf4e4)

  • deps: Update pre-commit hook maxbrunet/pre-commit-renovate to v34.48.4 (985b971)

  • deps: Update dessant/lock-threads action to v4 (337b25c)

  • Use SPDX license expression in project metadata (acb3a4a)

  • deps: Update actions/download-artifact action to v3 (64ca597)

  • deps: Update all non-major dependencies (21e767d)

Documentation

  • faq: Describe and group common errors (4c9a072)

Features

  • group: Add support for group restore API (9322db6)

  • client: Automatically retry on HTTP 409 Resource lock (dced76a)

Fixes: #2325

  • api: Add support for bulk imports API (043de2d)

  • api: Add support for resource groups (5f8b8f5)

  • api: Support listing pipelines triggered by pipeline schedules (865fa41)

  • Allow filtering pipelines by source (b6c0872)

See: https://docs.gitlab.com/ee/api/pipelines.html#list-project-pipelines Added in GitLab 14.3

  • client: Bootstrap the http backends concept (#2391, 91a665f)

  • Add resource iteration events (see https://docs.gitlab.com/ee/api/resource_iteration_events.html) (ef5feb4)

  • Allow passing kwargs to Gitlab class when instantiating with from_config (#2392, e88d34e)

  • Add keep_base_url when getting configuration from file (50a0301)

Refactoring

  • Add reason property to RequestsResponse (#2439, b59b7bd)

  • Remove unneeded requests.utils import (#2426, 6fca651)

  • Migrate MultipartEncoder to RequestsBackend (#2421, 43b369f)

  • Move Response object to backends (#2420, 7d9ce0d)

  • Move the request call to the backend (#2413, 283e7cc)

  • Moving RETRYABLE_TRANSIENT_ERROR_CODES to const (887852d)

Testing

  • functional: Do not require config file (43c2dda)

  • unit: Expand tests for pipeline schedules (c7cf0d1)

v3.12.0 (2022-11-28)

Bug Fixes

  • cli: Enable debug before doing auth (65abb85)

Authentication issues are currently hard to debug since --debug only has effect after gl.auth() has been called.

For example, a 401 error is printed without any details about the actual HTTP request being sent:

$ gitlab –debug –server-url https://gitlab.com current-user get 401: 401 Unauthorized

By moving the call to gl.enable_debug() the usual debug logs get printed before the final error message.

Signed-off-by: Emanuele Aina emanuele.aina@collabora.com

  • cli: Expose missing mr_default_target_self project attribute (12aea32)

Example::

gitlab project update –id 616 –mr-default-target-self 1

References:

  • https://gitlab.com/gitlab-org/gitlab/-/merge_requests/58093 * https://gitlab.com/gitlab-org/gitlab/-/blob/v13.11.0-ee/doc/user/project/merge_requests/creating_merge_requests.md#new-merge-request-from-a-fork

    • https://gitlab.com/gitlab-org/gitlab/-/blob/v14.7.0-ee/doc/api/projects.md#get-single-project

  • Use POST method and return dict in cancel_merge_when_pipeline_succeeds() (#2350, bd82d74)

  • Call was incorrectly using a PUT method when should have used a POST method. * Changed return type to a dict as GitLab only returns {‘status’: ‘success’} on success. Since the function didn’t work previously, this should not impact anyone. * Updated the test fixture merge_request to add ability to create a pipeline. * Added functional test for mr.cancel_merge_when_pipeline_succeeds()

Fixes: #2349

Chores

  • Validate httpx package is not installed by default (0ecf3bb)

  • deps: Update all non-major dependencies (d8a657b)

  • deps: Update pre-commit hook maxbrunet/pre-commit-renovate to v34.24.0 (a0553c2)

  • Correct website for pylint (fcd72fe)

Use https://github.com/PyCQA/pylint as the website for pylint.

  • deps: Update pre-commit hook maxbrunet/pre-commit-renovate to v34.20.0 (e6f1bd6)

  • deps: Update all non-major dependencies (b2c6d77)

  • deps: Update pre-commit hook maxbrunet/pre-commit-renovate to v34 (623e768)

Documentation

  • Use the term “log file” for getting a job log file (9d2b1ad)

The GitLab docs refer to it as a log file: https://docs.gitlab.com/ee/api/jobs.html#get-a-log-file

“trace” is the endpoint name but not a common term people will think of for a “log file”

  • groups: Describe GitLab.com group creation limitation (9bd433a)

  • api: Pushrules remove saying None is returned when not found (c3600b4)

In groups.pushrules.get(), GitLab does not return None when no rules are found. GitLab returns a 404.

Update docs to not say it will return None

Also update docs in project.pushrules.get() to be consistent. Not 100% sure if it returns None or returns a 404, but we don’t need to document that.

Closes: #2368

Features

  • Add support for SAML group links (#2367, 1020ce9)

  • groups: Add LDAP link manager and deprecate old API endpoints (3a61f60)

  • groups: Add support for listing ldap_group_links (#2371, ad7c8fa)

  • Implement secure files API (d0a0348)

  • ci: Re-run Tests on PR Comment workflow (034cde3)

  • api: Add support for getting a project’s pull mirror details (060cfe1)

Add the ability to get a project’s pull mirror details. This was added in GitLab 15.5 and is a PREMIUM feature.

https://docs.gitlab.com/ee/api/projects.html#get-a-projects-pull-mirror-details

  • api: Add support for remote project import from AWS S3 (#2357, 892281e)

  • api: Add support for remote project import (#2348, e5dc72d)

  • api: Add application statistics (6fcf3b6)

Refactoring

  • Explicitly use ProjectSecureFile (0c98b2d)

Testing

  • api: Fix flaky test test_cancel_merge_when_pipeline_succeeds (6525c17)

This is an attempt to fix the flaky test test_cancel_merge_when_pipeline_succeeds. Were seeing a: 405 Method Not Allowed error when setting the MR to merge_when_pipeline_succeeds.

Closes: #2383

v3.11.0 (2022-10-28)

Bug Fixes

  • Remove project.approvals.set_approvals() method (91f08f0)

The project.approvals.set_approvals() method used the /projects/:id/approvers end point. That end point was removed from GitLab in the 13.11 release, on 2-Apr-2021 in commit 27dc2f2fe81249bbdc25f7bd8fe799752aac05e6 via merge commit e482597a8cf1bae8e27abd6774b684fb90491835. It was deprecated on 19-Aug-2019.

See merge request: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/57473

  • Use epic id instead of iid for epic notes (97cae38)

  • cli: Handle list response for json/yaml output (9b88132)

Handle the case with the CLI where a list response is returned from GitLab and json/yaml output is requested.

Add a functional CLI test to validate it works.

Closes: #2287

  • Intermittent failure in test_merge_request_reset_approvals (3dde36e)

Have been seeing intermittent failures in the test: tests/functional/api/test_merge_requests.py::test_merge_request_reset_approvals

Also saw a failure in: tests/functional/cli/test_cli_v4.py::test_accept_request_merge[subprocess]

Add a call to wait_for_sidekiq() to hopefully resolve the issues.

Chores

  • Add responses to pre-commit deps (4b8ddc7)

  • Add basic type checks to functional/api tests (5b642a5)

  • Add basic typing to functional tests (ee143c9)

  • Narrow type hints for license API (50731c1)

  • Add basic type checks to meta tests (545d6d6)

  • Add basic typing to smoke tests (64e8c31)

  • Add basic typing to test root (0b2f6bc)

  • deps: Update pre-commit hook maxbrunet/pre-commit-renovate to v33 (932bbde)

  • deps: Update all non-major dependencies (dde3642)

  • Add not-callable to pylint ignore list (f0c02a5)

The not-callable error started showing up. Ignore this error as it is invalid. Also mypy tests for these issues.

Closes: #2334

This reverts commit f825d70e25feae8cd9da84e768ec6075edbc2200.

  • deps: Update all non-major dependencies (2966234)

  • Use kwargs for http_request docs (124abab)

  • deps: Pin GitHub Actions (8dbaa5c)

  • deps: Group non-major upgrades to reduce noise (37d14bd)

  • deps: Pin and clean up test dependencies (60b9197)

  • deps: Pin dependencies (953f38d)

  • Topic functional tests (d542eba)

  • Renovate and precommit cleanup (153d373)

  • deps: Update black to v22.10.0 (531ee05)

  • deps: Update dependency types-requests to v2.28.11.2 (d47c0f0)

  • Fix flaky test (fdd4114)

  • Update the issue templates (c15bd33)

  • Have an option to go to the discussions * Have an option to go to the Gitter chat * Move the bug/issue template into the .github/ISSUE_TEMPLATE/ directory

  • Simplify wait_for_sidekiq usage (196538b)

Simplify usage of wait_for_sidekiq by putting the assert if it timed out inside the function rather than after calling it.

  • deps: Update dependency pylint to v2.15.3 (6627a60)

  • deps: Update dependency mypy to v0.981 (da48849)

  • deps: Update dependency commitizen to v2.35.0 (4ce9559)

  • deps: Update typing dependencies (81285fa)

Documentation

  • advanced: Add hint on type narrowing (a404152)

  • Add minimal docs about the enable_debug() method (b4e9ab7)

Add some minimal documentation about the enable_debug() method.

  • commits: Fix commit create example for binary content (bcc1eb4)

  • readme: Add a basic feature list (b4d53f1)

  • api: Describe use of lower-level methods (b7a6874)

  • api: Describe the list() and all() runners’ functions (b6cc3f2)

  • api: Update merge_requests.rst: mr_id to mr_iid (b32234d)

Typo: Author probably meant mr_iid (i.e. project-specific MR ID) and not mr_id (i.e. server-wide MR ID)

Closes: https://github.com/python-gitlab/python-gitlab/issues/2295

Signed-off-by: Stavros Ntentos 133706+stdedos@users.noreply.github.com

Features

  • build: Officially support Python 3.11 (74f66c7)

  • api: Add support for topics merge API (9a6d197)

Refactoring

  • Pre-commit trigger from tox (6e59c12)

  • Migrate legacy EE tests to pytest (88c2505)

  • Pytest-docker fixtures (3e4781a)

  • deps: Drop compose v1 dependency in favor of v2 (f825d70)

Testing

  • Fix test_project_push_rules test (8779cf6)

Make the test_project_push_rules test work.

  • Enable skipping tests per GitLab plan (01d5f68)

  • Use false instead of /usr/bin/false (51964b3)

On Debian systems false is located at /bin/false (coreutils package). This fixes unit test failure on Debian system:

FileNotFoundError: [Errno 2] No such file or directory: ‘/usr/bin/false’ /usr/lib/python3.10/subprocess.py:1845: FileNotFoundError

v3.10.0 (2022-09-28)

Bug Fixes

  • cli: Add missing attributes for creating MRs (1714d0a)

  • cli: Add missing attribute for MR changes (20c46a0)

Chores

  • Bump GitLab docker image to 15.4.0-ee.0 (b87a2bc)

  • Use settings.delayed_group_deletion=False as that is the recommended method to turn off the delayed group deletion now. * Change test to look for default as pages is not mentioned in the docs[1]

[1] https://docs.gitlab.com/ee/api/sidekiq_metrics.html#get-the-current-queue-metrics

  • deps: Update black to v22.8.0 (86b0e40)

  • deps: Update dependency types-requests to v2.28.10 (5dde7d4)

  • deps: Update dependency pytest to v7.1.3 (ec7f26c)

  • deps: Update dependency commitizen to v2.32.5 (e180f14)

  • deps: Update dependency commitizen to v2.32.2 (31aea28)

  • deps: Update pre-commit hook commitizen-tools/commitizen to v2.32.2 (31ba64f)

Features

  • Add reset_approvals api (88693ff)

Added the newly added reset_approvals merge request api.

Signed-off-by: Lucas Zampieri lzampier@redhat.com

  • Add support for deployment approval endpoint (9c9eeb9)

Add support for the deployment approval endpoint[1]

[1] https://docs.gitlab.com/ee/api/deployments.html#approve-or-reject-a-blocked-deployment Closes: #2253

v3.9.0 (2022-08-28)

Chores

  • Only check for our UserWarning (bd4dfb4)

The GitHub CI is showing a ResourceWarning, causing our test to fail.

Update test to only look for our UserWarning which should not appear.

What was seen when debugging the GitHub CI: {message: ResourceWarning( “unclosed <socket.socket fd=12, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=(‘127.0.0.1’, 50862), raddr=(‘127.0.0.1’, 8080)>” ), category: ‘ResourceWarning’, filename: ‘/home/runner/work/python-gitlab/python-gitlab/.tox/api_func_v4/lib/python3.10/site-packages/urllib3/poolmanager.py’, lineno: 271, line: None }

  • Fix issue if only run test_gitlab.py func test (98f1956)

Make it so can run just the test_gitlab.py functional test.

For example: $ tox -e api_func_v4 – -k test_gitlab.py

  • ci: Make pytest annotations work (f67514e)

  • deps: Update pre-commit hook commitizen-tools/commitizen to v2.32.1 (cdd6efe)

  • deps: Update dependency commitizen to v2.32.1 (9787c5c)

  • deps: Update dependency types-requests to v2.28.9 (be932f6)

  • deps: Update pre-commit hook pycqa/flake8 to v5 (835d884)

  • deps: Update pre-commit hook commitizen-tools/commitizen to v2.31.0 (71d37d9)

  • deps: Update dependency commitizen to v2.31.0 (4ff0894)

  • deps: Update dependency types-setuptools to v64 (4c97f26)

  • deps: Update dependency types-requests to v2.28.8 (8e5b86f)

Features

  • Add support for merge_base API (dd4fbd5)

v3.8.1 (2022-08-10)

Bug Fixes

  • client: Do not assume user attrs returned for auth() (a07547c)

This is mostly relevant for people mocking the API in tests.

Chores

  • deps: Update dependency commitizen to v2.29.5 (181390a)

  • deps: Update dependency flake8 to v5.0.4 (50a4fec)

  • deps: Update dependency sphinx to v5 (3f3396e)

  • Remove broad Exception catching from config.py (0abc90b)

Change “except Exception:” catching to more granular exceptions.

A step in enabling the “broad-except” check in pylint.

  • Add license badge to readme (9aecc9e)

  • Consolidate license and authors (366665e)

v3.8.0 (2022-08-04)

Bug Fixes

  • client: Ensure encoded query params are never duplicated (1398426)

  • Optionally keep user-provided base URL for pagination (#2149, e2ea8b8)

Chores

  • Use urlunparse instead of string replace (6d1b62d)

Use the urlunparse() function to reconstruct the URL without the query parameters.

  • ci: Bump semantic-release for fixed commit parser (1e063ae)

  • Enable mypy check disallow_any_generics (24d17b4)

  • deps: Update pre-commit hook commitizen-tools/commitizen to v2.29.2 (4988c02)

  • Enable mypy check no_implicit_optional (64b208e)

  • deps: Update dependency flake8 to v5 (cdc384b)

  • deps: Update dependency types-requests to v2.28.6 (54dd4c3)

  • deps: Update dependency commitizen to v2.29.2 (30274ea)

  • Change _repr_attr for Project to be path_with_namespace (7cccefe)

Previously _repr_attr was path but that only gives the basename of the path. So https://gitlab.com/gitlab-org/gitlab would only show “gitlab”. Using path_with_namespace it will now show “gitlab-org/gitlab”

  • Enable mypy check warn_return_any (76ec4b4)

Update code so that the warn_return_any check passes.

  • Make code PEP597 compliant (433dba0)

Use encoding="utf-8" in open() and open-like functions.

https://peps.python.org/pep-0597/

  • clusters: Deprecate clusters support (b46b379)

Cluster support was deprecated in GitLab 14.5 [1]. And disabled by default in GitLab 15.0 [2]

  • Update docs to mark clusters as deprecated * Remove testing of clusters

[1] https://docs.gitlab.com/ee/api/project_clusters.html [2] https://gitlab.com/groups/gitlab-org/configure/-/epics/8

  • topics: ‘title’ is required when creating a topic (271f688)

In GitLab >= 15.0 title is required when creating a topic.

Documentation

  • Describe self-revoking personal access tokens (5ea48fc)

Features

  • client: Warn user on misconfigured URL in auth() (0040b43)

  • Support downloading archive subpaths (cadb0e5)

Refactoring

  • client: Factor out URL check into a helper (af21a18)

  • client: Remove handling for incorrect link header (77c04b1)

This was a quirk only present in GitLab 13.0 and fixed with 13.1. See https://gitlab.com/gitlab-org/gitlab/-/merge_requests/33714 and https://gitlab.com/gitlab-org/gitlab/-/issues/218504 for more context.

Testing

  • unit: Reproduce duplicate encoded query params (6f71c66)

  • Attempt to make functional test startup more reliable (67508e8)

The functional tests have been erratic. Current theory is that we are starting the tests before the GitLab container is fully up and running.

  • Add checking of the Health Check[1] endpoints. * Add a 20 second delay after we believe it is up and running. * Increase timeout from 300 to 400 seconds

[1] https://docs.gitlab.com/ee/user/admin_area/monitoring/health_check.html

  • functional: Bump GitLab docker image to 15.2.0-ee.0 (69014e9)

Use the GitLab docker image 15.2.0-ee.0 in the functional testing.

v3.7.0 (2022-07-28)

Bug Fixes

  • Support array types for most resources (d9126cd)

  • Use the [] after key names for array variables in params (1af44ce)

  1. If a value is of type ArrayAttribute then append ‘[]’ to the name of the value for query parameters (params).

This is step 3 in a series of steps of our goal to add full support for the GitLab API data types[1]: * array * hash * array of hashes

Step one was: commit 5127b1594c00c7364e9af15e42d2e2f2d909449b Step two was: commit a57334f1930752c70ea15847a39324fa94042460

Fixes: #1698

[1] https://docs.gitlab.com/ee/api/#encoding-api-parameters-of-array-and-hash-types

  • runners: Fix listing for /runners/all (c6dd57c)

  • config: Raise error when gitlab id provided but no config section found (1ef7018)

  • config: Raise error when gitlab id provided but no config file found (ac46c1c)

  • Add get_all param (and --get-all) to allow passing all to API (7c71d5d)

  • Results returned by attributes property to show updates (e5affc8)

Previously the attributes method would show the original values in a Gitlab Object even if they had been updated. Correct this so that the updated value will be returned.

Also use copy.deepcopy() to ensure that modifying the dictionary returned can not also modify the object.

Add the notes attribute to GroupEpic

  • cli: Remove irrelevant MR approval rule list filters (0daec5f)

  • Ensure path elements are escaped (5d9c198)

Ensure the path elements that are passed to the server are escaped. For example a “/” will be changed to “%2F”

Closes: #2116

Chores

  • Revert “test(functional): simplify token creation” (4b798fc)

This reverts commit 67ab24fe5ae10a9f8cc9122b1a08848e8927635d.

  • Enable using GitLab EE in functional tests (17c01ea)

Enable using GitLab Enterprise Edition (EE) in the functional tests. This will allow us to add functional tests for EE only features in the functional tests.

  • deps: Update pre-commit hook commitizen-tools/commitizen to v2.29.0 (ad8d62a)

  • deps: Update dependency commitizen to v2.29.0 (c365be1)

  • deps: Update dependency mypy to v0.971 (7481d27)

  • deps: Update typing dependencies (f2209a0)

  • authors: Fix email and do the ABC (9833632)

  • Make reset_gitlab() better (d87d6b1)

Saw issues in the CI where reset_gitlab() would fail. It would fail to delete the group that is created when GitLab starts up. Extending the timeout didn’t fix the issue.

Changed the code to use the new helpers.safe_delete() function. Which will delete the resource and then make sure it is deleted before returning.

Also added some logging functionality that can be seen if logging is turned on in pytest.

  • Fixtures: after delete() wait to verify deleted (1f73b6b)

In our fixtures that create: - groups - project merge requests - projects - users

They delete the created objects after use. Now wait to ensure the objects are deleted before continuing as having unexpected objects existing can impact some of our tests.

  • Add a lazy boolean attribute to RESTObject (a7e8cfb)

This can be used to tell if a RESTObject was created using lazy=True.

Add a message to the AttributeError if attribute access fails for an instance created with lazy=True.

  • Enable mypy check strict_equality (a29cd6c)

Enable the mypy strict_equality check.

  • Change name of API functional test to api_func_v4 (8cf5cd9)

The CLI test is cli_func_v4 and using api_func_v4 matches with that naming convention.

  • deps: Update typing dependencies (e772248)

  • deps: Update pre-commit hook pycqa/pylint to v2.14.5 (c75a1d8)

  • deps: Update dependency pylint to v2.14.5 (e153636)

  • deps: Update pre-commit hook commitizen-tools/commitizen to v2.28.0 (d238e1b)

  • deps: Update dependency commitizen to v2.28.0 (8703dd3)

  • deps: Update black to v22.6.0 (82bd596)

  • deps: Update pre-commit hook pycqa/pylint to v2.14.4 (5cd39be)

  • ci_lint: Add create attributes (6e1342f)

  • Simplify multi-nested try blocks (e734470)

Instead of have a multi-nested series of try blocks. Convert it to a more readable series of if statements.

  • deps: Update dependency requests to v2.28.1 (be33245)

  • deps: Update dependency pylint to v2.14.4 (2cee2d4)

  • Fix misspelling (2d08fc8)

  • docs: Convert tabs to spaces (9ea5520)

Some tabs snuck into the documentation. Convert them to 4-spaces.

Documentation

  • cli: Showcase use of token scopes (4a6f8d6)

  • projects: Document export with upload to URL (03f5484)

  • Describe fetching existing export status (9c5b8d5)

  • authors: Add John (e2afb84)

  • Document CI Lint usage (d5de4b1)

  • users: Add docs about listing a user’s projects (065a1a5)

Add docs about listing a user’s projects.

Update docs on the membership API to update the URL to the upstream docs and also add a note that it requires Administrator access to use.

  • Update return type of pushrules (53cbecc)

Update the return type of pushrules to surround None with back-ticks to make it code-formatted.

  • Describe ROPC flow in place of password authentication (91c17b7)

  • readme: Remove redundant -v that breaks the command (c523e18)

Features

  • Allow sort/ordering for project releases (b1dd284)

See: https://docs.gitlab.com/ee/api/releases/#list-releases

  • cli: Add a custom help formatter (005ba93)

Add a custom argparse help formatter that overrides the output format to list items vertically.

The formatter is derived from argparse.HelpFormatter with minimal changes.

Co-authored-by: John Villalovos john@sodarock.com Co-authored-by: Nejc Habjan nejc.habjan@siemens.com

  • Add support for iterations API (194ee01)

  • groups: Add support for shared projects API (66461ba)

  • issues: Add support for issue reorder API (8703324)

  • namespaces: Add support for namespace existence API (4882cb2)

  • Add support for group and project invitations API (7afd340)

  • projects: Add support for project restore API (4794ecc)

  • Add support for filtering jobs by scope (0e1c0dd)

See: ‘scope’ here: https://docs.gitlab.com/ee/api/jobs.html#list-project-jobs

  • Add asdict() and to_json() methods to Gitlab Objects (08ac071)

Add an asdict() method that returns a dictionary representation copy of the Gitlab Object. This is a copy and changes made to it will have no impact on the Gitlab Object.

The asdict() method name was chosen as both the dataclasses and attrs libraries have an asdict() function which has the similar purpose of creating a dictionary represenation of an object.

Also add a to_json() method that returns a JSON string representation of the object.

Closes: #1116

  • api: Add support for instance-level registry repositories (284d739)

  • groups: Add support for group-level registry repositories (70148c6)

  • Add ‘merge_pipelines_enabled’ project attribute (fc33c93)

Boolean. Enable or disable merge pipelines.

See: https://docs.gitlab.com/ee/api/projects.html#edit-project https://docs.gitlab.com/ee/ci/pipelines/merged_results_pipelines.html

  • Support validating CI lint results (3b1ede4)

  • cli: Add support for global CI lint (3f67c4b)

  • objects: Add Project CI Lint support (b213dd3)

Add support for validating a project’s CI configuration [1]

[1] https://docs.gitlab.com/ee/api/lint.html

  • Add support for group push rules (b5cdc09)

Add the GroupPushRules and GroupPushRulesManager classes.

Closes: #1259

  • api: Add support for get for a MR approval rule (89c18c6)

In GitLab 14.10 they added support to get a single merge request approval rule [1]

Add support for it to ProjectMergeRequestApprovalRuleManager

[1] https://docs.gitlab.com/ee/api/merge_request_approvals.html#get-a-single-merge-request-level-rule

Refactoring

  • Migrate services to integrations (a428051)

  • objects: Move ci lint to separate file (6491f1b)

  • test-projects: Apply suggestions and use fixtures (a51f848)

  • test-projects: Remove test_restore_project (9be0875)

Testing

  • cli: Add tests for token scopes (263fe3d)

  • Add test to show issue fixed (75bec7d)

https://github.com/python-gitlab/python-gitlab/issues/1698 has been fixed. Add test to show that.

  • Always ensure clean config environment (8d4f13b)

  • ee: Add an EE specific test (10987b3)

  • functional: Simplify token creation (67ab24f)

  • Fix broken test if user had config files (864fc12)

Use monkeypatch to ensure that no config files are reported for the test.

Closes: #2172

  • Allow podman users to run functional tests (ff215b7)

Users of podman will likely have DOCKER_HOST set to something like unix:///run/user/1000/podman/podman.sock

Pass this environment variable so that it will be used during the functional tests.

  • api_func_v4: Catch deprecation warning for gl.lint() (95fe924)

Catch the deprecation warning for the call to gl.lint(), so it won’t show up in the log.

  • functional: Use both get_all and all in list() tests (201298d)

  • Add more tests for container registries (f6b6e18)

  • functional: Replace len() calls with list membership checks (97e0eb9)

  • projects: Add unit tests for projects (67942f0)

v3.6.0 (2022-06-28)

Bug Fixes

  • base: Do not fail repr() on lazy objects (1efb123)

  • cli: Project-merge-request-approval-rule (15a242c)

Using the CLI the command: gitlab project-merge-request-approval-rule list –mr-iid 1 –project-id foo/bar

Would raise an exception. This was due to the fact that _id_attr and _repr_attr were set for keys which are not returned in the response.

Add a unit test which shows the repr function now works. Before it did not.

This is an EE feature so we can’t functional test it.

Closes: #2065

  • cli: Fix project export download for CLI (5d14867)

Since ac1c619cae6481833f5df91862624bf0380fef67 we delete parent arg keys from the args dict so this has been trying to access the wrong attribute.

Chores

  • deps: Ignore python-semantic-release updates (f185b17)

  • workflows: Explicitly use python-version (eb14475)

  • deps: Update actions/setup-python action to v4 (77c1f03)

  • deps: Update typing dependencies (acc5c39)

  • deps: Update pre-commit hook pycqa/pylint to v2.14.3 (d1fe838)

  • ci: Increase timeout for docker container to come online (bda020b)

Have been seeing timeout issues more and more. Increase timeout from 200 seconds to 300 seconds (5 minutes).

  • docs: Ignore nitpicky warnings (1c3efb5)

  • Patch sphinx for explicit re-exports (06871ee)

  • Bump mypy pre-commit hook (0bbcad7)

  • gitlab: Fix implicit re-exports for mpypy (981b844)

  • Add link to Commitizen in Github workflow (d08d07d)

Add a link to the Commitizen website in the Github workflow. Hopefully this will help people when their job fails.

  • deps: Update dependency pylint to v2.14.3 (9a16bb1)

  • Fix issue found with pylint==2.14.3 (eeab035)

A new error was reported when running pylint==2.14.3: gitlab/client.py:488:0: W1404: Implicit string concatenation found in call (implicit-str-concat)

Fixed this issue.

  • deps: Update pre-commit hook commitizen-tools/commitizen to v2.27.1 (22c5db4)

  • deps: Update dependency requests to v2.28.0 (d361f4b)

  • deps: Update dependency mypy to v0.961 (f117b2f)

  • deps: Update typing dependencies (aebf9c8)

  • deps: Update dependency mypy to v0.960 (8c016c7)

  • cli: Rename “object” to “GitLab resource” (62e64a6)

Make the parser name more user friendly by renaming from generic “object” to “GitLab resource”

  • Use multiple processors when running PyLint (7f2240f)

Use multiple processors when running PyLint. On my system it took about 10.3 seconds to run PyLint before this change. After this change it takes about 5.8 seconds to run PyLint.

  • Enable pylint check: “redefined-outer-name”, (1324ce1)

Enable the pylint check “redefined-outer-name” and fix the errors detected.

  • Enable pylint check: “no-self-use” (80aadaf)

Enable the pylint check “no-self-use” and fix the errors detected.

  • Enable pylint check: “no-else-return” (d0b0811)

Enable the pylint check “no-else-return” and fix the errors detected.

  • Enable pylint check: “attribute-defined-outside-init” (d6870a9)

Enable the pylint check: “attribute-defined-outside-init” and fix errors detected.

  • Enable pylint check “raise-missing-from” (1a2781e)

Enable the pylint check “raise-missing-from” and fix errors detected.

  • Enable pylint checks which require no changes (50fdbc4)

Enabled the pylint checks that don’t require any code changes. Previously these checks were disabled.

Enable the pylint checks: * unnecessary-pass * unspecified-encoding

Update code to resolve errors found

  • Rename whaction and action to resource_action in CLI (fb3f28a)

Rename the variables whaction and action to resource_action to improve code-readability.

  • Rename what to gitlab_resource (c86e471)

Naming a variable what makes it difficult to understand what it is used for.

Rename it to gitlab_resource as that is what is being stored.

The Gitlab documentation talks about them being resources: https://docs.gitlab.com/ee/api/api_resources.html

This will improve code readability.

  • Rename __call__() to run() in GitlabCLI (6189437)

Less confusing to have it be a normal method.

  • Enable ‘consider-using-sys-exit’ pylint check (0afcc3e)

Enable the ‘consider-using-sys-exit’ pylint check and fix errors raised.

We previously converted all string formatting to use f-strings. Enable pylint check to enforce this.

  • ci: Pin 3.11 to beta.1 (7119f2d)

  • cli: Ignore coverage on exceptions triggering cli.die (98ccc3c)

  • Move utils._validate_attrs inside types.RequiredOptional (9d629bb)

Move the validate_attrs function to be inside the RequiredOptional class. It makes sense for it to be part of the class as it is working on data related to the class.

  • Remove use of ‘%’ string formatter in gitlab/utils.py (0c5a121)

Replace usage with f-string

  • Have EncodedId creation always return EncodedId (a1a246f)

There is no reason to return an int as we can always return a str version of the int

Change EncodedId to always return an EncodedId. This removes the need to have mypy ignore the error raised.

  • Move RequiredOptional to the gitlab.types module (7d26530)

By having RequiredOptional in the gitlab.base module it makes it difficult with circular imports. Move it to the gitlab.types module which has no dependencies on any other gitlab module.

  • Update type-hints return signature for GetWithoutIdMixin methods (aa972d4)

Commit f0152dc3cc9a42aa4dc3c0014b4c29381e9b39d6 removed situation where get() in a GetWithoutIdMixin based class could return None

Update the type-hints to no longer return Optional AKA None

  • Correct ModuleNotFoundError() arguments (0b7933c)

Previously in commit 233b79ed442aac66faf9eb4b0087ea126d6dffc5 I had used the name argument for ModuleNotFoundError(). This basically is the equivalent of not passing any message to ModuleNotFoundError(). So when the exception was raised it wasn’t very helpful.

Correct that and add a unit-test that shows we get the message we expect.

  • deps: Update typing dependencies (f3f79c1)

  • deps: Update dependency commitizen to v2.27.1 (456f9f1)

  • mixins: Remove None check as http_get always returns value (f0152dc)

Documentation

  • api: Add separate section for advanced usage (22ae101)

  • api: Document usage of head() methods (f555bfb)

  • projects: Provide more detailed import examples (8f8611a)

  • projects: Document 404 gotcha with unactivated integrations (522ecff)

  • variables: Instruct users to follow GitLab rules for values (194b6be)

  • api: Stop linking to python-requests.org (49c7e83)

  • api: Fix incorrect docs for merge_request_approvals (#2094, 5583eaa)

  • docs(api): fix incorrect docs for merge_request_approvals

The set_approvers() method is on the ProjectApprovalManager class. It is not part of the ProjectApproval class.

The docs were previously showing to call set_approvers using a ProjectApproval instance, which would fail. Correct the documentation.

This was pointed out by a question on the Gitter channel.

Co-authored-by: Nejc Habjan nejc.habjan@siemens.com

  • api-usage: Add import os in example (2194a44)

  • Drop deprecated setuptools build_sphinx (048d66a)

  • usage: Refer to upsteam docs instead of custom attributes (ae7d3b0)

  • ext: Fix rendering for RequiredOptional dataclass (4d431e5)

  • Documentation updates to reflect addition of mutually exclusive attributes (24b720e)

  • Use as_list=False or all=True in Getting started (de8c6e8)

In the “Getting started with the API” section of the documentation, use either as_list=False or all=True in the example usages of the list() method.

Also add a warning about the fact that list() by default does not return all items.

Features

  • downloads: Allow streaming downloads access to response iterator (#1956, b644721)

  • feat(downloads): allow streaming downloads access to response iterator

Allow access to the underlying response iterator when downloading in streaming mode by specifying iterator=True.

Update type annotations to support this change.

  • docs(api-docs): add iterator example to artifact download

Document the usage of the iterator=True option when downloading artifacts

  • test(packages): add tests for streaming downloads

  • users: Add approve and reject methods to User (f57139d)

As requested in #1604.

Co-authored-by: John Villalovos john@sodarock.com

  • api: Support head() method for get and list endpoints (ce9216c)

  • api: Implement HEAD method (90635a7)

  • api: Convert gitlab.const to Enums (c3c6086)

This allows accessing the elements by value, i.e.:

import gitlab.const gitlab.const.AccessLevel(20)

  • Add support for Protected Environments (1dc9d0f)

  • https://docs.gitlab.com/ee/api/protected_environments.html - https://github.com/python-gitlab/python-gitlab/issues/1130

no write operation are implemented yet as I have no use case right now and am not sure how it should be done

  • users: Add ban and unban methods (0d44b11)

  • docker: Provide a Debian-based slim image (384031c)

  • Support mutually exclusive attributes and consolidate validation to fix board lists (#2037, 3fa330c)

add exclusive tuple to RequiredOptional data class to support for mutually exclusive attributes

consolidate _check_missing_create_attrs and _check_missing_update_attrs from mixins.py into _validate_attrs in utils.py

change _create_attrs in board list manager classes from required=(‘label_ld’,) to exclusive=(‘label_id’,’asignee_id’,’milestone_id’)

closes https://github.com/python-gitlab/python-gitlab/issues/1897

  • client: Introduce iterator=True and deprecate as_list=False in list() (cdc6605)

as_list=False is confusing as it doesn’t explain what is being returned. Replace it with iterator=True which more clearly explains to the user that an iterator/generator will be returned.

This maintains backward compatibility with as_list but does issue a DeprecationWarning if as_list is set.

Refactoring

  • Do not recommend plain gitlab.const constants (d652133)

  • Avoid possible breaking change in iterator (#2107, 212ddfc)

Commit b6447211754e126f64e12fc735ad74fe557b7fb4 inadvertently introduced a possible breaking change as it added a new argument iterator and added it in between existing (potentially positional) arguments.

This moves the iterator argument to the end of the argument list and requires it to be a keyword-only argument.

  • Remove no-op id argument in GetWithoutIdMixin (0f2a602)

  • mixins: Extract custom type transforms into utils (09b3b22)

Testing

  • Add tests and clean up usage for new enums (323ab3c)

  • pylint: Enable pylint “unused-argument” check (23feae9)

Enable the pylint “unused-argument” check and resolve issues it found.

  • Quite a few functions were accepting **kwargs but not then passing them on through to the next level. Now pass **kwargs to next level. * Other functions had no reason to accept **kwargs, so remove it * And a few other fixes.

  • api: Add tests for HEAD method (b0f02fa)

  • Add more tests for RequiredOptional (ce40fde)

  • Move back to using latest Python 3.11 version (8c34781)

  • Increase client coverage (00aec96)

  • cli: Improve coverage for custom actions (7327f78)

  • gitlab: Increase unit test coverage (df072e1)

v3.5.0 (2022-05-28)

Bug Fixes

  • cli: Changed default allow_abbrev value to fix arguments collision problem (#2013, d68cacf)

fix(cli): change default allow_abbrev value to fix argument collision

  • Duplicate subparsers being added to argparse (f553fd3)

Python 3.11 added an additional check in the argparse libary which detected duplicate subparsers being added. We had duplicate subparsers being added.

Make sure we don’t add duplicate subparsers.

Closes: #2015

Chores

  • ci: Fix prefix for action version (1c02189)

  • ci: Pin semantic-release version (0ea61cc)

  • deps: Update pre-commit hook pycqa/pylint to v2.13.9 (1e22790)

  • deps: Update dependency pylint to v2.13.9 (4224950)

  • Run the pylint check by default in tox (55ace1d)

Since we require pylint to pass in the CI. Let’s run it by default in tox.

  • Rename the test which runs flake8 to be flake8 (78b4f99)

Previously the test was called pep8. The test only runs flake8 so call it flake8 to be more precise.

  • deps: Update pre-commit hook pycqa/pylint to v2.13.8 (1835593)

  • deps: Update dependency pylint to v2.13.8 (b235bb0)

  • Exclude build/ directory from mypy check (989a12b)

The build/ directory is created by the tox environment twine-check. When the build/ directory exists mypy will have an error.

  • Add cz to default tox environment list and skip_missing_interpreters (ba8c052)

Add the cz (comittizen) check by default.

Set skip_missing_interpreters = True so that when a user runs tox and doesn’t have a specific version of Python it doesn’t mark it as an error.

  • deps: Update dependency types-requests to v2.27.25 (d6ea47a)

  • ci: Replace commitlint with commitizen (b8d15fe)

  • renovate: Set schedule to reduce noise (882fe7a)

  • deps: Update dependency types-requests to v2.27.24 (f88e3a6)

  • deps: Update dependency types-requests to v2.27.23 (a6fed8b)

Documentation

  • Update issue example and extend API usage docs (aad71d2)

  • CONTRIBUTING.rst: Fix link to conventional-changelog commit format documentation (2373a4f)

  • Add missing Admin access const value (3e0d4d9)

As shown here, Admin access is set to 60: https://docs.gitlab.com/ee/api/protected_branches.html#protected-branches-api

  • merge_requests: Add new possible merge request state and link to the upstream docs (e660fa8)

The actual documentation do not mention the locked state for a merge request

Features

  • objects: Support get project storage endpoint (8867ee5)

  • Display human-readable attribute in repr() if present (6b47c26)

  • ux: Display project.name_with_namespace on project repr (e598762)

This change the repr from:

$ gitlab.projects.get(id=some_id)

To:

$ gitlab.projects.get(id=some_id) <Project id:some_id name_with_namespace:”group_name / project_name”>

This is especially useful when working on random projects or listing of projects since users generally don’t remember projects ids.

Testing

  • projects: Add tests for list project methods (fa47829)

v3.4.0 (2022-04-28)

Bug Fixes

  • Avoid passing redundant arguments to API (3431887)

  • Add ChunkedEncodingError to list of retryable exceptions (7beb20f)

  • cli: Add missing filters for project commit list (149d244)

  • Add 52x range to retry transient failures and tests (c3ef1b5)

  • Also retry HTTP-based transient errors (3b49e4d)

Chores

  • deps: Update dependency mypy to v0.950 (241e626)

  • deps: Update dependency types-requests to v2.27.22 (22263e2)

  • deps: Update dependency types-requests to v2.27.21 (0fb0955)

  • deps: Update dependency pytest to v7.1.2 (fd3fa23)

  • deps: Update typing dependencies (c12466a)

  • deps: Update pre-commit hook pycqa/pylint to v2.13.7 (1396221)

  • deps: Update dependency pylint to v2.13.7 (5fb2234)

  • deps: Update typing dependencies (d27cc6a)

  • deps: Update pre-commit hook pycqa/pylint to v2.13.5 (17d5c6c)

  • deps: Update dependency pylint to v2.13.5 (5709675)

  • deps: Update codecov/codecov-action action to v3 (292e91b)

  • deps: Update dependency types-setuptools to v57.4.12 (6551353)

  • client: Remove duplicate code (5cbbf26)

  • deps: Update dependency types-requests to v2.27.16 (ad799fc)

  • deps: Upgrade gitlab-ce to 14.9.2-ce.0 (d508b18)

  • deps: Update pre-commit hook pycqa/pylint to v2.13.4 (9d0b252)

  • deps: Update dependency pylint to v2.13.4 (a9a9392)

  • deps: Update pre-commit hook pycqa/pylint to v2.13.3 (8f0a3af)

  • deps: Update dependency pylint to v2.13.3 (0ae3d20)

  • deps: Update black to v22.3.0 (8d48224)

Documentation

  • api-docs: Docs fix for application scopes (e1ad93d)

Features

  • objects: Support getting project/group deploy tokens by id (fcd37fe)

  • user: Support getting user SSH key by id (6f93c05)

  • Emit a warning when using a list() method returns max (1339d64)

A common cause of issues filed and questions raised is that a user will call a list() method and only get 20 items. As this is the default maximum of items that will be returned from a list() method.

To help with this we now emit a warning when the result from a list() method is greater-than or equal to 20 (or the specified per_page value) and the user is not using either all=True, all=False, as_list=False, or page=X.

  • api: Re-add topic delete endpoint (d1d96bd)

This reverts commit e3035a799a484f8d6c460f57e57d4b59217cd6de.

v3.3.0 (2022-03-28)

Bug Fixes

  • Support RateLimit-Reset header (4060146)

Some endpoints are not returning the Retry-After header when rate-limiting occurrs. In those cases use the RateLimit-Reset [1] header, if available.

Closes: #1889

[1] https://docs.gitlab.com/ee/user/admin_area/settings/user_and_ip_rate_limits.html#response-headers

Chores

  • deps: Update dependency sphinx to v4.5.0 (36ab769)

  • deps: Update pre-commit hook pycqa/pylint to v2.13.2 (14d367d)

  • deps: Update dependency pylint to v2.13.2 (10f15a6)

  • deps: Update dependency types-requests to v2.27.15 (2e8ecf5)

  • deps: Update pre-commit hook pycqa/pylint to v2.13.1 (1d0c6d4)

  • deps: Update dependency types-requests to v2.27.14 (be6b54c)

  • deps: Update dependency pylint to v2.13.1 (eefd724)

  • deps: Update pre-commit hook pycqa/pylint to v2.13.0 (9fe60f7)

  • deps: Update dependency pylint to v2.13.0 (5fa403b)

  • deps: Update dependency mypy to v0.942 (8ba0f8c)

  • deps: Update dependency pytest-console-scripts to v1.3.1 (da392e3)

  • deps: Update dependency pytest to v7.1.1 (e31f2ef)

  • deps: Update typing dependencies (21e7c37)

  • deps: Update dependency mypy to v0.941 (3a9d4f1)

  • deps: Update dependency pytest to v7.1.0 (27c7e33)

  • deps: Update dependency types-requests to v2.27.12 (8cd668e)

  • deps: Update dependency mypy to v0.940 (dd11084)

  • deps: Update black to v22 (3f84f1b)

  • deps: Update pre-commit hook alessandrojcm/commitlint-pre-commit-hook to v8 (5440780)

  • deps: Update dependency types-setuptools to v57.4.10 (b37fc41)

  • deps: Update dependency pytest to v7 (ae8d70d)

  • deps: Update actions/upload-artifact action to v3 (18a0eae)

  • deps: Update actions/stale action to v5 (d841185)

  • deps: Update actions/setup-python action to v3 (7f845f7)

  • deps: Update dependency sphinx to v4.4.0 (425d161)

  • deps: Update actions/checkout action to v3 (7333cbb)

  • deps: Update dependency pytest-console-scripts to v1.3 (9c202dd)

  • deps: Update dependency mypy to v0.931 (33646c1)

  • deps: Update typing dependencies (37a7c40)

  • deps: Update dependency requests to v2.27.1 (95dad55)

Code Style

Documentation

  • chore: Include docs .js files in sdist (3010b40)

  • Fix typo and incorrect style (2828b10)

  • Add pipeline test report summary support (d78afb3)

Features

  • object: Add pipeline test report summary support (a97e0cf)

v3.2.0 (2022-02-28)

Bug Fixes

  • services: Use slug for id_attr instead of custom methods (e30f39d)

  • Remove custom delete method for labels (0841a2a)

The usage of deleting was incorrect according to the current API. Remove custom delete() method as not needed.

Add tests to show it works with labels needing to be encoded.

Also enable the test_group_labels() test function. Previously it was disabled.

Add ability to do a get() for group labels.

Closes: #1867

Chores

  • Create a custom warnings.warn wrapper (6ca9aa2)

Create a custom warnings.warn wrapper that will walk the stack trace to find the first frame outside of the gitlab/ path to print the warning against. This will make it easier for users to find where in their code the error is generated from

  • Correct type-hints for per_page attrbute (e825653)

There are occasions where a GitLab list() call does not return the x-per-page header. For example the listing of custom attributes.

Update the type-hints to reflect that.

  • Require kwargs for utils.copy_dict() (7cf35b2)

The non-keyword arguments were a tiny bit confusing as the destination was first and the source was second.

Change the order and require key-word only arguments to ensure we don’t silently break anyone.

  • Create new ArrayAttribute class (a57334f)

Create a new ArrayAttribute class. This is to indicate types which are sent to the GitLab server as arrays https://docs.gitlab.com/ee/api/#array

At this stage it is identical to the CommaSeparatedListAttribute class but will be used later to support the array types sent to GitLab.

This is the second step in a series of steps of our goal to add full support for the GitLab API data types[1]: * array * hash * array of hashes

Step one was: commit 5127b1594c00c7364e9af15e42d2e2f2d909449b

[1] https://docs.gitlab.com/ee/api/#encoding-api-parameters-of-array-and-hash-types

Related: #1698

  • ci: Do not run release workflow in forks (2b6edb9)

Code Style

  • objects: Add spacing to docstrings (700d25d)

Documentation

  • Enable gitter chat directly in docs (bd1ecdd)

  • Add delete methods for runners and project artifacts (5e711fd)

  • Add retry_transient infos (bb1f054)

Co-authored-by: Nejc Habjan hab.nejc@gmail.com

  • Add transient errors retry info (b7a1266)

  • artifacts: Deprecate artifacts() and artifact() methods (64d01ef)

  • Revert “chore: add temporary banner for v3” (#1864, 7a13b9b)

This reverts commit a349793307e3a975bb51f864b48e5e9825f70182.

Co-authored-by: Wadim Klincov wadim.klincov@siemens.com

Features

  • merge_request_approvals: Add support for deleting MR approval rules (85a734f)

  • artifacts: Add support for project artifacts delete API (c01c034)

  • mixins: Allow deleting resources without IDs (0717517)

  • objects: Add a complete artifacts manager (c8c2fa7)

Testing

  • unit: Clean up MR approvals fixtures (0eb4f7f)

  • runners: Add test for deleting runners by auth token (14b88a1)

  • functional: Fix GitLab configuration to support pagination (5b7d00d)

When pagination occurs python-gitlab uses the URL provided by the GitLab server to use for the next request.

We had previously set the GitLab server configuraiton to say its URL was http://gitlab.test which is not in DNS. Set the hostname in the URL to http://127.0.0.1:8080 which is the correct URL for the GitLab server to be accessed while doing functional tests.

Closes: #1877

  • services: Add functional tests for services (2fea2e6)

  • objects: Add tests for project artifacts (8ce0336)

v3.1.1 (2022-01-28)

Bug Fixes

  • cli: Make ‘per_page’ and ‘page’ type explicit (d493a5e)

  • cli: Make ‘timeout’ type explicit (bbb7df5)

  • cli: Allow custom methods in managers (8dfed0c)

  • objects: Make resource access tokens and repos available in CLI (e0a3a41)

Chores

  • Use dataclass for RequiredOptional (30117a3)

  • Remove redundant list comprehension (271cfd3)

  • Consistently use open() encoding and file descriptor (dc32d54)

  • Don’t explicitly pass args to super() (618267c)

  • Always use context manager for file IO (e8031f4)

  • Remove old-style classes (ae2a015)

  • Rename types.ListAttribute to types.CommaSeparatedListAttribute (5127b15)

This name more accurately describes what the type is. Also this is the first step in a series of steps of our goal to add full support for the GitLab API data types[1]: * array * hash * array of hashes

[1] https://docs.gitlab.com/ee/api/#encoding-api-parameters-of-array-and-hash-types

  • Rename gitlab/__version__.py -> gitlab/_version.py (b981ce7)

It is confusing to have a gitlab/__version__.py because we also create a variable gitlab.__version__ which can conflict with gitlab/__version__.py.

For example in gitlab/const.py we have to know that gitlab.__version__ is a module and not the variable due to the ordering of imports. But in most other usage gitlab.__version__ is a version string.

To reduce confusion make the name of the version file gitlab/_version.py.

  • Create return type-hints for get_id() & encoded_id (0c3a1d1)

Create return type-hints for RESTObject.get_id() and RESTObject.encoded_id. Previously was saying they return Any. Be more precise in saying they can return either: None, str, or int.

  • tests: Use method projects.transfer() (e5af2a7)

When doing the functional tests use the new function projects.transfer instead of the deprecated function projects.transfer_project()

Code Style

  • Use f-strings where applicable (cfed622)

  • Use literals to declare data structures (019a40f)

Documentation

  • Enhance release docs for CI_JOB_TOKEN usage (5d973de)

  • changelog: Add missing changelog items (01755fb)

Testing

  • Add a meta test to make sure that v4/objects/ files are imported (9c8c804)

Add a test to make sure that all of the gitlab/v4/objects/ files are imported in gitlab/v4/objects/__init__.py

  • Convert usage of match_querystring to match (d16e41b)

In the responses library the usage of match_querystring is deprecated. Convert to using match

  • Remove usage of httpmock library (5254f19)

Convert all usage of the httpmock library to using the responses library.

  • Use ‘responses’ in test_mixins_methods.py (208da04)

Convert from httmock to responses in test_mixins_methods.py

This leaves only one file left to convert

v3.1.0 (2022-01-14)

Bug Fixes

  • Use url-encoded ID in all paths (12435d7)

Make sure all usage of the ID in the URL path is encoded. Normally it isn’t an issue as most IDs are integers or strings which don’t contain a slash (‘/’). But when the ID is a string with a slash character it will break things.

Add a test case that shows this fixes wikis issue with subpages which use the slash character.

Closes: #1079

  • members: Use new *All objects for *AllManager managers (755e0a3)

Change it so that:

GroupMemberAllManager uses GroupMemberAll object ProjectMemberAllManager uses ProjectMemberAll object

Create GroupMemberAll and ProjectMemberAll objects that do not support any Mixin type methods. Previously we were using GroupMember and ProjectMember which support the save() and delete() methods but those methods will not work with objects retrieved using the /members/all/ API calls.

list() API calls: [1] GET /groups/:id/members/all GET /projects/:id/members/all

get() API calls: [2] GET /groups/:id/members/all/:user_id GET /projects/:id/members/all/:user_id

Closes: #1825 Closes: #848

[1] https://docs.gitlab.com/ee/api/members.html#list-all-members-of-a-group-or-project-including-inherited-and-invited-members [2] https://docs.gitlab.com/ee/api/members.html#get-a-member-of-a-group-or-project-including-inherited-and-invited-members

  • cli: Add missing list filters for environments (6f64d40)

  • api: Services: add missing lazy parameter (888f332)

Commit 8da0b758c589f608a6ae4eeb74b3f306609ba36d added the lazy parameter to the services get() method but missed then using the lazy parameter when it called super(...).get(...)

Closes: #1828

  • Broken URL for FAQ about attribute-error-list (1863f30)

The URL was missing a ‘v’ before the version number and thus the page did not exist.

Previously the URL for python-gitlab 3.0.0 was: https://python-gitlab.readthedocs.io/en/3.0.0/faq.html#attribute-error-list

Which does not exist.

Change it to: https://python-gitlab.readthedocs.io/en/v3.0.0/faq.html#attribute-error-list add the ‘v’ ————————–^

  • Remove custom URL encoding (3d49e5e)

We were using str.replace() calls to take care of URL encoding issues.

Switch them to use our utils._url_encode() function which itself uses urllib.parse.quote()

Closes: #1356

  • Remove default arguments for mergerequests.merge() (8e589c4)

The arguments should_remove_source_branch and merge_when_pipeline_succeeds are optional arguments. We should not be setting any default value for them.

https://docs.gitlab.com/ee/api/merge_requests.html#accept-mr

Closes: #1750

  • cli: Url-encode path components of the URL (ac1c619)

In the CLI we need to make sure the components put into the path portion of the URL are url-encoded. Otherwise they will be interpreted as part of the path. For example can specify the project ID as a path, but in the URL it must be url-encoded or it doesn’t work.

Also stop adding the components of the path as query parameters in the URL.

Closes: #783 Closes: #1498

  • Change to http_list for some ProjectCommit methods (497e860)

Fix the type-hints and use http_list() for the ProjectCommits methods: - diff() - merge_requests()

  • refs()

This will enable using the pagination support we have for lists.

Closes: #1805 Closes: #1231

Chores

  • groups: Use encoded_id for group path (868f243)

  • objects: Use self.encoded_id where applicable (75758bf)

Updated a few remaining usages of self.id to use self.encoded_id as for the most part we shouldn’t be using self.id

There are now only a few (4 lines of code) remaining uses of self.id, most of which seem that they should stay that way.

  • objects: Use self.encoded_id where could be a string (c3c3a91)

Updated a few remaining usages of self.id to use self.encoded_id where it could be a string value.

  • projects: Fix typing for transfer method (0788fe6)

Co-authored-by: John Villalovos john@sodarock.com

  • Ignore intermediate coverage artifacts (110ae91)

  • Replace usage of utils._url_encode() with utils.EncodedId() (b07eece)

utils.EncodedId() has basically the same functionalityy of using utils._url_encode(). So remove utils._url_encode() as we don’t need it.

  • Add EncodedId string class to use to hold URL-encoded paths (a2e7c38)

Add EncodedId string class. This class returns a URL-encoded string but ensures it will only URL-encode it once even if recursively called.

Also added some functional tests of ‘lazy’ objects to make sure they work.

  • Add pprint() and pformat() methods to RESTObject (d69ba04)

This is useful in debugging and testing. As can easily print out the values from an instance in a more human-readable form.

  • Add logging to tests/functional/conftest.py (a1ac9ae)

I have found trying to debug issues in the functional tests can be difficult. Especially when trying to figure out failures in the CI running on Github.

Add logging to tests/functional/conftest.py to have a better understanding of what is happening during a test run which is useful when trying to troubleshoot issues in the CI.

  • Fix functional test failure if config present (c9ed3dd)

Previously c8256a5933d745f70c7eea0a7d6230b51bac0fbc was done to fix this but it missed two other failures.

  • docs: Use admonitions consistently (55c67d1)

  • dist: Add docs *.md files to sdist (d9457d8)

build_sphinx to fail due to setup.cfg warning-is-error

There was a missing comma which meant the strings were concatenated instead of being two separate strings.

Use the stale action to close issues and pull-requests with no activity.

Issues: It will mark them as stale after 60 days and then close them once they have been stale for 15 days.

Pull-Requests: It will mark pull-requests as stale after 90 days and then close them once they have been stale for 15 days.

https://github.com/actions/stale

Closes: #1649

  • Add functional test of mergerequest.get() (a92b55b)

Add a functional test of test mergerequest.get() and mergerequest.get(…, lazy=True)

Closes: #1425

  • Add temporary banner for v3 (a349793)

Continuous Integration

  • Don’t fail CI if unable to upload the code coverage data (d5b3744)

If a CI job can’t upload coverage results to codecov.com it causes the CI to fail and code can’t be merged.

Documentation

  • Update project access token API reference link (73ae955)

  • cli: Make examples more easily navigable by generating TOC (f33c523)

Features

  • Add support for Groups API method transfer() (0007006)

  • api: Add project.transfer() and deprecate transfer_project() (259668a)

  • api: Return result from SaveMixin.save() (e6258a4)

Return the new object data when calling SaveMixin.save().

Also remove check for None value when calling self.manager.update() as that method only returns a dictionary.

Closes: #1081

  • Add support for Group Access Token API (c01b7c4)

See https://docs.gitlab.com/ee/api/group_access_tokens.html

Testing

  • groups: Enable group transfer tests (57bb67a)

v3.0.0 (2022-01-05)

Bug Fixes

  • Handle situation where GitLab does not return values (cb824a4)

If a query returns more than 10,000 records than the following values are NOT returned: x.total_pages x.total

Modify the code to allow no value to be set for these values. If there is not a value returned the functions will now return None.

Update unit test so no longer xfail

https://docs.gitlab.com/ee/user/gitlab_com/index.html#pagination-response-headers

Closes #1686

  • Stop encoding ‘.’ to ‘%2E’ (702e41d)

Forcing the encoding of ‘.’ to ‘%2E’ causes issues. It also goes against the RFC: https://datatracker.ietf.org/doc/html/rfc3986.html#section-2.3

From the RFC: For consistency, percent-encoded octets in the ranges of ALPHA (%41-%5A and %61-%7A), DIGIT (%30-%39), hyphen (%2D), period (%2E), underscore (%5F), or tilde (%7E) should not be created by URI producers…

Closes #1006 Related #1356 Related #1561

BREAKING CHANGE: stop encoding ‘.’ to ‘%2E’. This could potentially be a breaking change for users who have incorrectly configured GitLab servers which don’t handle period ‘.’ characters correctly.

  • build: Do not include docs in wheel package (68a97ce)

  • api: Delete invalid ‘project-runner get’ command (#1628, 905781b)

  • fix(api): delete ‘group-runner get’ and ‘group-runner delete’ commands

Co-authored-by: Léo GATELLIER git@leogatellier.fr

  • api: Replace deprecated attribute in delete_in_bulk() (#1536, c59fbdb)

BREAKING CHANGE: The deprecated name_regex attribute has been removed in favor of name_regex_delete. (see https://gitlab.com/gitlab-org/gitlab/-/commit/ce99813cf54)

  • objects: Rename confusing to_project_id argument (ce4bc0d)

BREAKING CHANGE: rename confusing to_project_id argument in transfer_project to project_id (--project-id in CLI). This is used for the source project, not for the target namespace.

  • Raise error if there is a 301/302 redirection (d56a434)

Before we raised an error if there was a 301, 302 redirect but only from an http URL to an https URL. But we didn’t raise an error for any other redirects.

This caused two problems:

  1. PUT requests that are redirected get changed to GET requests which don’t perform the desired action but raise no error. This is because the GET response succeeds but since it wasn’t a PUT it doesn’t update. See issue: https://github.com/python-gitlab/python-gitlab/issues/1432 2. POST requests that are redirected also got changed to GET requests. They also caused hard to debug tracebacks for the user. See issue: https://github.com/python-gitlab/python-gitlab/issues/1477

Correct this by always raising a RedirectError exception and improve the exception message to let them know what was redirected.

Closes: #1485 Closes: #1432 Closes: #1477

  • build: Do not package tests in wheel (969dccc)

Chores

  • Fix typo in MR documentation (2254222)

  • deps: Update dependency argcomplete to v2 (c6d7e9a)

  • deps: Update dependency requests to v2.27.0 (f8c3d00)

  • Add test case to show branch name with period works (ea97d7a)

Add a test case to show that a branch name with a period can be fetched with a get()

Closes: #1715

  • deps: Update typing dependencies (1f95613)

  • deps: Update dependency mypy to v0.930 (ccf8190)

  • deps: Upgrade mypy pre-commit hook (e19e4d7)

  • Fix functional test failure if config present (c8256a5)

Fix functional test failure if config present and configured with token.

Closes: #1791

  • Ensure reset_gitlab() succeeds (0aa0b27)

Ensure reset_gitlab() succeeds by waiting to make sure everything has been deleted as expected. If the timeout is exceeded fail the test.

Not using wait_for_sidekiq as it didn’t work. During testing I didn’t see any sidekiq processes as being busy even though not everything was deleted.

  • Skip a functional test if not using >= py3.9 (ac9b595)

One of the tests requires Python 3.9 or higher to run. Mark the test to be skipped if running Python less than 3.9.

  • Update version in docker-compose.yml (79321aa)

When running with docker-compose on Ubuntu 20.04 I got the error:

$ docker-compose up ERROR: The Compose file ‘./docker-compose.yml’ is invalid because: networks.gitlab-network value Additional properties are not allowed (‘name’ was unexpected)

Changing the version in the docker-compose.yml file fro ‘3’ to ‘3.5’ resolved the issue.

  • Generate artifacts for the docs build in the CI (85b43ae)

When building the docs store the created documentation as an artifact so that it can be viewed.

This will create a html-docs.zip file which can be downloaded containing the contents of the build/sphinx/html/ directory. It can be downloaded, extracted, and then viewed. This can be useful in reviewing changes to the documentation.

See https://github.com/actions/upload-artifact for more information on how this works.

  • Add and document optional parameters for get MR (bfa3dbe)

Add and document (some of the) optional parameters that can be done for a project.merge_requests.get()

Closes #1775

  • deps: Update pre-commit hook alessandrojcm/commitlint-pre-commit-hook to v6 (fb9110b)

  • Remove ‘# type: ignore’ for new mypy version (34a5f22)

mypy 0.920 now understands the type of ‘http.client.HTTPConnection.debuglevel’ so we remove the ‘type: ignore’ comment to make mypy pass

  • deps: Update dependency mypy to v0.920 (a519b2f)

  • deps: Update pre-commit hook pycqa/flake8 to v4 (98a5592)

  • deps: Update pre-commit hook psf/black to v21 (b86e819)

  • deps: Update pre-commit hook pycqa/isort to v5.10.1 (8ac4f4a)

  • ci: Enable renovate for pre-commit (1ac4329)

  • Fix unit test if config file exists locally (c80b3b7)

Closes #1764

  • Add .env as a file that search tools should not ignore (c9318a9)

The .env file was not set as a file that should not be ignored by search tools. We want to have the search tools search any .env files.

  • deps: Update dependency sphinx to v4.3.2 (2210e56)

  • deps: Update dependency types-requests to v2.26.2 (ac7e329)

  • Add Python 3.11 testing (b5ec192)

Add a unit test for Python 3.11. This will use the latest version of Python 3.11 that is available from https://github.com/actions/python-versions/

At this time it is 3.11.0-alpha.2 but will move forward over time until the final 3.11 release and updates. So 3.11.0, 3.11.1, … will be matched.

  • api: Temporarily remove topic delete endpoint (e3035a7)

It is not yet available upstream.

  • Fix renovate setup for gitlab docker image (49af15b)

  • Add get() methods for GetWithoutIdMixin based classes (d27c50a)

Add the get() methods for the GetWithoutIdMixin based classes.

Update the tests/meta/test_ensure_type_hints.py tests to check to ensure that the get methods are defined with the correct return type.

  • Github workflow: cancel prior running jobs on new push (fd81569)

If new new push is done to a pull-request, then cancel any already running github workflow jobs in order to conserve resources.

  • Add running unit tests on windows/macos (ad5d60c)

Add running the unit tests on windows-latest and macos-latest with Python 3.10.

  • Fix pylint error “expression-not-assigned” (a90eb23)

Fix pylint error “expression-not-assigned” and remove check from the disabled list.

And I personally think it is much more readable now and is less lines of code.

  • Set pre-commit mypy args to empty list (b67a6ad)

https://github.com/pre-commit/mirrors-mypy/blob/master/.pre-commit-hooks.yaml

Sets some default args which seem to be interfering with things. Plus we set all of our args in the pyproject.toml file.

  • Run pre-commit on changes to the config file (5f10b3b)

If .pre-commit-config.yaml or .github/workflows/pre_commit.yml are updated then run pre-commit.

  • Add initial pylint check (041091f)

Initial pylint check is added. A LONG list of disabled checks is also added. In the future we should work through the list and resolve the errors or disable them on a more granular level.

  • Enable ‘warn_redundant_casts’ for mypy (f40e9b3)

Enable ‘warn_redundant_casts’for mypy and resolve one issue.

  • Enable subset of the ‘mypy –strict’ options that work (a86d049)

Enable the subset of the ‘mypy –strict’ options that work with no changes to the code.

  • deps: Update dependency black to v21.12b0 (ab841b8)

  • docs: Link to main, not master (af0cb4d)

  • docs: Use builtin autodoc hints (5e9c943)

  • docs: Load autodoc-typehints module (bd366ab)

  • Attempt to be more informative for missing attributes (1839c9e)

A commonly reported issue from users on Gitter is that they get an AttributeError for an attribute that should be present. This is often caused due to the fact that they used the list() method to retrieve the object and objects retrieved this way often only have a subset of the full data.

Add more details in the AttributeError message that explains the situation to users. This will hopefully allow them to resolve the issue.

Update the FAQ in the docs to add a section discussing the issue.

Closes #1138

  • Use constants from gitlab.const module (6b8067e)

Have code use constants from the gitlab.const module instead of from the top-level gitlab module.

  • tests: Apply review suggestions (381c748)

  • deps: Update dependency sphinx to v4.3.1 (93a3893)

  • Remove pytest-console-scripts specific config (e80dcb1)

Remove the pytest-console-scripts specific config from the global ‘[pytest]’ config section.

Use the command line option --script-launch-mode=subprocess

Closes #1713

  • deps: Update typing dependencies (8d4c953)

  • Remove duplicate/no-op tests from meta/test_ensure_type_hints (a2f59f4)

Before we were generating 725 tests for the meta/test_ensure_type_hints.py tests. Which isn’t a huge concern as it was fairly fast. But when we had a failure we would usually get two failures for each problem as the same test was being run multiple times.

Changed it so that: 1. Don’t add tests that are not for *Manager classes 2. Use a set so that we don’t have duplicate tests.

After doing that our generated test count in meta/test_ensure_type_hints.py went from 725 to 178 tests.

Additionally removed the parsing of pyproject.toml to generate files to ignore as we have finished adding type-hints to all files in gitlab/v4/objects/. This also means we no longer use the toml library so remove installation of types-toml.

To determine the test count the following command was run: $ tox -e py39 – -k test_ensure_type_hints

  • Add type-hints to gitlab/v4/objects/files.py (0c22bd9)

  • Add type-hints to gitlab/v4/objects/labels.py (d04e557)

  • Add type-hints to gitlab/v4/objects/sidekiq.py (a91a303)

  • Add type-hints to gitlab/v4/objects/services.py (8da0b75)

  • Add type-hints to gitlab/v4/objects/repositories.py (00d7b20)

  • Add type-hints to gitlab/v4/objects/pipelines.py (cb3ad6c)

  • Add type-hints to gitlab/v4/objects/milestones.py (8b6078f)

  • Add type-hints to gitlab/v4/objects/jobs.py (e8884f2)

  • Add type-hints to gitlab/v4/objects/issues.py (93e39a2)

  • Add type-hints to gitlab/v4/objects/geo_nodes.py (13243b7)

  • Add type-hints to gitlab/v4/objects/epics.py (d4adf8d)

  • Fix issue with adding type-hints to ‘manager’ attribute (9a451a8)

When attempting to add type-hints to the the ‘manager’ attribute into a RESTObject derived class it would break things.

This was because our auto-manager creation code would automatically add the specified annotated manager to the ‘manager’ attribute. This breaks things.

Now check in our auto-manager creation if our attribute is called ‘manager’. If so we ignore it.

  • deps: Update dependency types-setuptools to v57.4.3 (ec2c68b)

  • deps: Update dependency black to v21 (5bca87c)

  • Enable mypy for tests/meta/* (ba7707f)

  • Have renovate upgrade black version (#1700, 21228cd)

renovate is not upgrading the black package. There is an open issue[1] about this.

Also change .commitlintrc.json to allow 200 character footer lines in the commit message. Otherwise would be forced to split the URL across multiple lines making it un-clickable :(

Use suggested work-arounds from: https://github.com/renovatebot/renovate/issues/7167#issuecomment-904106838 https://github.com/scop/bash-completion/blob/e7497f6ee8232065ec11450a52a1f244f345e2c6/renovate.json#L34-L38

[1] https://github.com/renovatebot/renovate/issues/7167

  • Correct test_groups.py test (9c878a4)

The test was checking twice if the same group3 was not in the returned list. Should have been checking for group3 and group4.

Also added a test that only skipped one group and checked that the group was not in the returned list and a non-skipped group was in the list.

  • Add type-hints to gitlab/v4/objects/merge_request_approvals.py (cf3a99a)

  • Check setup.py with mypy (77cb7a8)

Prior commit 06184daafd5010ba40bb39a0768540b7e98bd171 fixed the type-hints for setup.py. But missed removing ‘setup’ from the exclude list in pyproject.toml for mypy checks.

Remove ‘setup’ from the exclude list in pyproject.toml from mypy checks.

  • Ensure get() methods have correct type-hints (46773a8)

Fix classes which don’t have correct ‘get()’ methods for classes derived from GetMixin.

Add a unit test which verifies that classes have the correct return type in their ‘get()’ method.

  • Create a ‘tests/meta/’ directory and put test_mro.py in it (94feb8a)

The ‘test_mro.py’ file is not really a unit test but more of a ‘meta’ check on the validity of the code base.

  • Add type-hints to setup.py and check with mypy (06184da)

  • Add type-hints to gitlab/v4/objects/snippets.py (f256d4f)

  • deps: Update dependency types-pyyaml to v6.0.1 (a544cd5)

  • deps: Update dependency sphinx to v4.3.0 (57283fc)

  • deps: Update dependency types-requests to v2.26.0 (7528d84)

  • deps: Update dependency isort to v5.10.1 (2012975)

  • deps: Update dependency types-requests to v2.25.12 (205ad5f)

  • Enforce type-hints on most files in gitlab/v4/objects/ (7828ba2)

  • Add type-hints to some of the files in gitlab/v4/objects/ * Fix issues detected when adding type-hints * Changed mypy exclusion to explicitly list the 13 files that have not yet had type-hints added.

  • Add type hints for gitlab/v4/objects/commits.py (dc096a2)

  • ci: Add workflow to lock old issues (a7d64fe)

  • Add type-hints to multiple files in gitlab/v4/objects/ (8b75a77)

Add and/or check type-hints for the following files gitlab.v4.objects.access_requests gitlab.v4.objects.applications gitlab.v4.objects.broadcast_messages gitlab.v4.objects.deployments gitlab.v4.objects.keys gitlab.v4.objects.merge_trains gitlab.v4.objects.namespaces gitlab.v4.objects.pages gitlab.v4.objects.personal_access_tokens gitlab.v4.objects.project_access_tokens gitlab.v4.objects.tags gitlab.v4.objects.templates gitlab.v4.objects.triggers

Add a ‘get’ method with the correct type for Managers derived from GetMixin.

  • Add type-hints to gitlab/v4/objects/groups.py (94dcb06)

  • Add type-hints to gitlab/v4/objects/groups.py * Have share() function update object attributes. * Add ‘get()’ method so that type-checkers will understand that getting a group is of type Group.

  • Add type-hints to gitlab/v4/objects/merge_requests.py (f9c0ad9)

  • Add type-hints to gitlab/v4/objects/merge_requests.py * Add return value to cancel_merge_when_pipeline_succeeds() function as GitLab docs show it returns a value. * Add return value to approve() function as GitLab docs show it returns a value. * Add ‘get()’ method so that type-checkers will understand that getting a project merge request is of type ProjectMergeRequest.

  • deps: Update dependency isort to v5.10.0 (ae62468)

  • ci: Wait for all coverage jobs before posting comment (c7fdad4)

  • deps: Update dependency types-pyyaml to v6 (0b53c0a)

  • deps: Update typing dependencies (4170dbe)

  • deps: Update dependency flake8 to v4 (79785f0)

  • deps: Update typing dependencies (4eb8ec8)

  • Rename master branch to main (545f8ed)

BREAKING CHANGE: As of python-gitlab 3.0.0, the default branch for development has changed from master to main.

  • deps: Upgrade gitlab-ce to 14.3.2-ce.0 (5a1678f)

  • objects: Remove non-existing trigger ownership method (8dc7f40)

  • Add type-hints to gitlab/v4/objects/users.py (88988e3)

Adding type-hints to gitlab/v4/objects/users.py

  • deps: Update dependency types-requests to v2.25.9 (e3912ca)

  • Fix type-check issue shown by new requests-types (0ee9aa4)

types-requests==2.25.9 changed a type-hint. Update code to handle this change.

  • deps: Update python docker tag to v3.10 (b3d6d91)

  • deps: Update dependency sphinx to v4 (73745f7)

  • Clean up install docs (a5d8b7f)

  • Attempt to fix flaky functional test (487b9a8)

Add an additional check to attempt to solve the flakiness of the test_merge_request_should_remove_source_branch() test.

  • Convert to using type-annotations for managers (d8de4dc)

Convert our manager usage to be done via type annotations.

Now to define a manager to be used in a RESTObject subclass can simply do: class ExampleClass(CRUDMixin, RESTObject): my_manager: MyManager

Any type-annotation that annotates it to be of type *Manager (with the exception of RESTManager) will cause the manager to be created on the object.

  • Improve type-hinting for managers (c9b5d3b)

The ‘managers’ are dynamically created. This unfortunately means that we don’t have any type-hints for them and so editors which understand type-hints won’t know that they are valid attributes.

  • Add the type-hints for the managers we define. * Add a unit test that makes sure that the type-hints and the ‘_managers’ attribute are kept in sync with each other. * Add unit test that makes sure specified managers in ‘_managers’ have a name ending in ‘Managers’ to keep with current convention. * Make RESTObject._managers always present with a default value of None. * Fix a type-issue revealed now that mypy knows what the type is

  • deps: Update dependency types-pyyaml to v5.4.10 (bdb6cb9)

Documentation

  • Switch to Furo and refresh introduction pages (ee6b024)

  • Correct documentation for updating discussion note (ee66f4a)

Closes #1777

  • Rename documentation files to match names of code files (ee3f865)

Rename the merge request related documentation files to match the code files. This will make it easier to find the documentation quickly.

Rename: docs/gl_objects/mrs.rst -> docs/gl_objects/merge_requests.rst   docs/gl_objects/mr_approvals.rst -> docs/gl_objects/merge_request_approvals.rst

  • project: Remove redundant encoding parameter (fed613f)

  • Use annotations for return types (79e785e)

  • Only use type annotations for documentation (b7dde0d)

  • Update docs to use gitlab.const for constants (b3b0b5f)

Update the docs to use gitlab.const to access constants.

  • Add links to the GitLab API docs (e3b5d27)

Add links to the GitLab API docs for merge_requests.py as it contains code which spans two different API documentation pages.

  • Fix API delete key example (b31bb05)

  • pipelines: Document take_ownership method (69461f6)

  • api: Document the update method for project variables (7992911)

  • api: Clarify job token usage with auth() (3f423ef)

See issue #1620

There are small typos in: - docs/gl_objects/deploy_tokens.rst - gitlab/base.py - gitlab/mixins.py - gitlab/v4/objects/features.py - gitlab/v4/objects/groups.py - gitlab/v4/objects/packages.py - gitlab/v4/objects/projects.py - gitlab/v4/objects/sidekiq.py - gitlab/v4/objects/todos.py

Fixes: - Should read treatment rather than reatment. - Should read transferred rather than transfered. - Should read registered rather than registred. - Should read occurred rather than occured. - Should read overridden rather than overriden. - Should read marked rather than maked. - Should read instantiate rather than instanciate. - Should read function rather than fonction.

  • Consolidate changelogs and remove v3 API docs (90da8ba)

  • Correct documented return type (acabf63)

repository_archive() returns ‘bytes’ not ‘str’

https://docs.gitlab.com/ee/api/repositories.html#get-file-archive

Fixes: #1584

Features

  • docker: Remove custom entrypoint from image (80754a1)

This is no longer needed as all of the configuration is handled by the CLI and can be passed as arguments.

  • cli: Allow options from args and environment variables (ca58008)

BREAKING-CHANGE: The gitlab CLI will now accept CLI arguments and environment variables for its global options in addition to configuration file options. This may change behavior for some workflows such as running inside GitLab CI and with certain environment variables configured.

  • api: Support file format for repository archive (83dcabf)

  • Add support for squash_option in Projects (a246ce8)

There is an optional squash_option parameter which can be used when creating Projects and UserProjects.

Closes #1744

  • cli: Do not require config file to run CLI (92a893b)

BREAKING CHANGE: A config file is no longer needed to run the CLI. python-gitlab will default to https://gitlab.com with no authentication if there is no config file provided. python-gitlab will now also only look for configuration in the provided PYTHON_GITLAB_CFG path, instead of merging it with user- and system-wide config files. If the environment variable is defined and the file cannot be opened, python-gitlab will now explicitly fail.

  • api: Add support for Topics API (e7559bf)

  • Add delete on package_file object (124667b)

  • api: Add support for epic notes (7f4edb5)

Added support for notes on group epics

Signed-off-by: Raimund Hook raimund.hook@exfo.com

  • Add support for projects.groups.list() (68ff595)

Add support for projects.groups.list() endpoint.

Closes #1717

  • Remove support for Python 3.6, require 3.7 or higher (414009d)

Python 3.6 is End-of-Life (EOL) as of 2021-12 as stated in https://www.python.org/dev/peps/pep-0494/

By dropping support for Python 3.6 and requiring Python 3.7 or higher it allows python-gitlab to take advantage of new features in Python 3.7, which are documented at: https://docs.python.org/3/whatsnew/3.7.html

Some of these new features that may be useful to python-gitlab are: * PEP 563, postponed evaluation of type annotations. * dataclasses: PEP 557 – Data Classes * importlib.resources * PEP 562, customization of access to module attributes. * PEP 560, core support for typing module and generic types. * PEP 565, improved DeprecationWarning handling

BREAKING CHANGE: As of python-gitlab 3.0.0, Python 3.6 is no longer supported. Python 3.7 or higher is required.

Add support for merge trains

  • api: Add project milestone promotion (f068520)

Adds promotion to Project Milestones

Signed-off-by: Raimund Hook raimund.hook@exfo.com

  • api: Add merge request approval state (f41b093)

Add support for merge request approval state

  • api: Add project label promotion (6d7c88a)

Adds a mixin that allows the /promote endpoint to be called.

Signed-off-by: Raimund Hook raimund.hook@exfo.com

  • objects: Support delete package files API (4518046)

  • objects: List starred projects of a user (47a5606)

  • build: Officially support and test python 3.10 (c042ddc)

  • objects: Support Create and Revoke personal access token API (e19314d)

  • Default to gitlab.com if no URL given (8236281)

BREAKING CHANGE: python-gitlab will now default to gitlab.com if no URL is given

  • Allow global retry_transient_errors setup (3b1d3a4)

retry_transient_errors can now be set through the Gitlab instance and global configuration

Documentation for API usage has been updated and missing tests have been added.

Refactoring

  • Deprecate accessing constants from top-level namespace (c0aa0e1)

We are planning on adding enumerated constants into gitlab/const.py, but if we do that than they will end up being added to the top-level gitlab namespace. We really want to get users to start using gitlab.const. to access the constant values in the future.

Add the currently defined constants to a list that should not change. Use a module level getattr function so that we can deprecate access to the top-level constants.

Add a unit test which verifies we generate a warning when accessing the top-level constants.

  • Use new-style formatting for named placeholders (c0d8810)

  • Use f-strings for string formatting (7925c90)

  • objects: Remove deprecated branch protect methods (9656a16)

BREAKING CHANGE: remove deprecated branch protect methods in favor of the more complete protected branches API.

  • objects: Remove deprecated constants defined in objects (3f320af)

BREAKING CHANGE: remove deprecated constants defined in gitlab.v4.objects, and use only gitlab.const module

  • objects: Remove deprecated tag release API (2b8a94a)

BREAKING CHANGE: remove deprecated tag release API. This was removed in GitLab 14.0

  • objects: Remove deprecated project.issuesstatistics (ca7777e)

BREAKING CHANGE: remove deprecated project.issuesstatistics in favor of project.issues_statistics

  • objects: Remove deprecated members.all() method (4d7b848)

BREAKING CHANGE: remove deprecated members.all() method in favor of members_all.list()

  • objects: Remove deprecated pipelines() method (c4f5ec6)

BREAKING CHANGE: remove deprecated pipelines() methods in favor of pipelines.list()

Testing

  • Reproduce missing pagination headers in tests (501f9a1)

  • Drop httmock dependency in test_gitlab.py (c764bee)

  • api: Fix current user mail count in newer gitlab (af33aff)

  • cli: Improve basic CLI coverage (6b892e3)

  • build: Add smoke tests for sdist & wheel package (b8a47ba)

v2.10.1 (2021-08-28)

Bug Fixes

  • mixins: Improve deprecation warning (57e0187)

Also note what should be changed

  • deps: Upgrade requests to 2.25.0 (see CVE-2021-33503) (ce995b2)

Chores

  • deps: Update dependency types-pyyaml to v5.4.8 (2ae1dd7)

  • deps: Update dependency types-pyyaml to v5.4.7 (ec8be67)

  • deps: Update codecov/codecov-action action to v2 (44f4fb7)

  • deps: Update typing dependencies (34fc210)

  • Define root dir in mypy, not tox (7a64e67)

  • deps: Group typing requirements with mypy additional_dependencies (38597e7)

  • Fix mypy pre-commit hook (bd50df6)

  • deps: Update dependency types-requests to v2.25.2 (4782678)

  • deps: Update wagoid/commitlint-github-action action to v4 (ae97196)

  • deps: Update dependency types-requests to v2.25.1 (a2d133a)

  • deps: Update precommit hook pycqa/isort to v5.9.3 (e1954f3)

  • deps: Update dependency isort to v5.9.3 (ab46e31)

Documentation

  • mergequests: Gl.mergequests.list documentation was missleading (5b5a7bc)

v2.10.0 (2021-07-28)

Bug Fixes

  • api: Do not require Release name for creation (98cd03b)

Stop requiring a name attribute for creating a Release, since a release name has not been required since GitLab 12.5.

Chores

  • deps: Update dependency requests to v2.26.0 (d3ea203)

  • deps: Update precommit hook pycqa/isort to v5.9.2 (521cddd)

  • deps: Update dependency isort to v5.9.2 (d5dcf1c)

Documentation

  • readme: Move contributing docs to CONTRIBUTING.rst (edf49a3)

Move the Contributing section of README.rst to CONTRIBUTING.rst, so it is recognized by GitHub and shown when new contributors make pull requests.

  • Add example for mr.merge_ref (b30b8ac)

Signed-off-by: Matej Focko mfocko@redhat.com

  • project: Add example on getting a single project using name with namespace (ef16a97)

Features

  • api: Add merge_ref for merge requests (1e24ab2)

Support merge_ref on merge requests that returns commit of attempted merge of the MR.

Signed-off-by: Matej Focko mfocko@redhat.com

  • api: Add name_regex_keep attribute in delete_in_bulk() (e49ff3f)

Testing

  • functional: Add mr.merge_ref tests (a9924f4)

  • Add test for using merge_ref on non-merged MR - Add test for using merge_ref on MR with conflicts

Signed-off-by: Matej Focko mfocko@redhat.com

v2.9.0 (2021-06-28)

Chores

  • Skip EE test case in functional tests (953f207)

  • deps: Update dependency types-requests to v2 (a81a926)

  • deps: Update dependency mypy to v0.910 (02a56f3)

  • deps: Update precommit hook pycqa/isort to v5.9.1 (c57ffe3)

  • deps: Update dependency isort to v5.9.1 (0479dba)

  • deps: Update dependency types-requests to v0.1.13 (c3ddae2)

  • deps: Update dependency types-requests to v0.1.12 (f84c2a8)

  • deps: Update dependency types-pyyaml to v5 (5c22634)

  • deps: Update dependency types-pyyaml to v0.1.9 (1f5b3c0)

  • deps: Update dependency types-pyyaml to v0.1.8 (e566767)

  • deps: Update dependency types-requests to v0.1.11 (6ba629c)

  • deps: Update dependency mypy to v0.902 (19c9736)

  • Add new required type packages for mypy (a7371e1)

New version of mypy flagged errors for missing types. Install the recommended type-* packages that resolve the issues.

  • Add type-hints to gitlab/v4/objects/projects.py (872dd6d)

Adding type-hints to gitlab/v4/objects/projects.py

Documentation

  • tags: Remove deprecated functions (1b1a827)

  • release: Add update example (6254a5f)

  • Make Gitlab class usable for intersphinx (8753add)

Features

  • api: Add group hooks (4a7e9b8)

  • release: Allow to update release (b4c4787)

Release API now supports PUT.

  • api: Remove responsibility for API inconsistencies for MR reviewers (3d985ee)

  • api: Add support for creating/editing reviewers in project merge requests (676d1f6)

  • api: Add MR pipeline manager in favor of pipelines() method (954357c)

Testing

  • releases: Integration for release PUT (13bf61d)

  • releases: Add unit-tests for release update (5b68a5a)

v2.8.0 (2021-06-10)

Bug Fixes

  • Catch invalid type used to initialize RESTObject (c7bcc25)

Sometimes we have errors where we don’t get a dictionary passed to RESTObject.init() method. This breaks things but in confusing ways.

Check in the init() method and raise an exception if it occurs.

chore: fix functional project service test

  • Ensure kwargs are passed appropriately for ObjectDeleteMixin (4e690c2)

  • cli: Add missing list filter for jobs (b3d1c26)

  • Change mr.merge() to use ‘post_data’ (cb6a3c6)

MR https://github.com/python-gitlab/python-gitlab/pull/1121 changed mr.merge() to use ‘query_data’. This appears to have been wrong.

From the Gitlab docs they state it should be sent in a payload body https://docs.gitlab.com/ee/api/README.html#request-payload since mr.merge() is a PUT request.

Request Payload

API Requests can use parameters sent as query strings or as a > payload body. GET requests usually send a query string, while PUT > or POST requests usually send the payload body

Fixes: #1452 Related to: #1120

  • cli: Fix parsing CLI objects to classnames (4252070)

  • objects: Allow lists for filters for in all objects (603a351)

  • objects: Return server data in cancel/retry methods (9fed061)

  • objects: Add missing group attributes (d20ff4f)

  • Iids not working as a list in projects.issues.list() (45f806c)

Set the ‘iids’ values as type ListAttribute so it will pass the list as a comma-separated string, instead of a list.

Add a functional test.

Closes: #1407

  • Add a check to ensure the MRO is correct (565d548)

Add a check to ensure the MRO (Method Resolution Order) is correct for classes in gitlab.v4.objects when doing type-checking.

An example of an incorrect definition: class ProjectPipeline(RESTObject, RefreshMixin, ObjectDeleteMixin): ^^^^^^^^^^ This should be at the end.

Correct way would be: class ProjectPipeline(RefreshMixin, ObjectDeleteMixin, RESTObject): Correctly at the end ^^^^^^^^^^

Also fix classes which have the issue.

Chores

  • ci: Use admin PAT for release workflow (d175d41)

  • Sync create and update attributes for Projects (0044bd2)

Sync the create attributes with: https://docs.gitlab.com/ee/api/projects.html#create-project

Sync the update attributes with documentation at: https://docs.gitlab.com/ee/api/projects.html#edit-project

As a note the ordering of the attributes was done to match the ordering of the attributes in the documentation.

Closes: #1497

  • Add missing linters to pre-commit and pin versions (85bbd1a)

  • Add type-hints to gitlab/v4/cli.py (2673af0)

  • Add type-hints to gitlab/v4/cli.py * Add required type-hints to other files based on adding type-hints to gitlab/v4/cli.py

  • Add missing optional create parameter for approval_rules (06a6001)

Add missing optional create parameter (‘protected_branch_ids’) to the project approvalrules.

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

  • Apply typing suggestions (a11623b)

Co-authored-by: John Villalovos john@sodarock.com

  • ci: Ignore .python-version from pyenv (149953d)

  • Apply suggestions (fe7d19d)

  • Clean up tox, pre-commit and requirements (237b97c)

  • Make certain dotfiles searchable by ripgrep (e4ce078)

By explicitly NOT excluding the dotfiles we care about to the .gitignore file we make those files searchable by tools like ripgrep.

By default dotfiles are ignored by ripgrep and other search tools (not grep)

  • Use built-in function issubclass() instead of getmro() (81f6386)

Code was using inspect.getmro() to replicate the functionality of the built-in function issubclass()

Switch to using issubclass()

  • Move ‘gitlab/tests/’ dir to ‘tests/unit/’ (1ac0722)

Move the ‘gitlab/tests/’ directory to ‘tests/unit/’ so we have all the tests located under the ‘tests/’ directory.

  • Correct a type-hint (046607c)

  • Rename ‘tools/functional/’ to ‘tests/functional/’ (502715d)

Rename the ‘tools/functional/’ directory to ‘tests/functional/’

This makes more sense as these are functional tests and not tools.

This was dicussed in: https://github.com/python-gitlab/python-gitlab/discussions/1468

  • Add a merge_request() pytest fixture and use it (8be2838)

Added a pytest.fixture for merge_request(). Use this fixture in tools/functional/api/test_merge_requests.py

  • Simplify functional tests (df9b5f9)

Add a helper function to have less code duplication in the functional testing.

  • Add functional test mr.merge() with long commit message (cd5993c)

Functional test to show that https://github.com/python-gitlab/python-gitlab/issues/1452 is fixed.

Added a functional test to ensure that we can use large commit message (10_000+ bytes) in mr.merge()

Related to: #1452

  • Add a functional test for issue #1120 (7d66115)

Going to switch to putting parameters from in the query string to having them in the ‘data’ body section. Add a functional test to make sure that we don’t break anything.

https://github.com/python-gitlab/python-gitlab/issues/1120

  • Fix import ordering using isort (f3afd34)

Fix the import ordering using isort.

https://pycqa.github.io/isort/

  • Add an isort tox environment and run isort in CI (dda646e)

  • Add an isort tox environment * Run the isort tox environment using –check in the Github CI

https://pycqa.github.io/isort/

  • deps: Update precommit hook alessandrojcm/commitlint-pre-commit-hook to v5 (9ff349d)

  • deps: Update gitlab/gitlab-ce docker tag to v13.11.4-ce.0 (4223269)

  • deps: Update dependency docker-compose to v1.29.2 (fc241e1)

  • ci: Automate releases (0ef497e)

  • ci: Ignore debug and type_checking in coverage (885b608)

  • Mypy: Disallow untyped definitions (6aef2da)

Be more strict and don’t allow untyped definitions on the files we check.

Also this adds type-hints for two of the decorators so that now functions/methods decorated by them will have their types be revealed correctly.

  • docs: Fix import order for readthedocs build (c3de1fb)

  • deps: Update gitlab/gitlab-ce docker tag to v13.11.3-ce.0 (f0b52d8)

  • Have black run at the top-level (429d6c5)

This will ensure everything is formatted with black, including setup.py.

  • Have flake8 check the entire project (ab343ef)

Have flake8 run at the top-level of the projects instead of just the gitlab directory.

  • deps: Update gitlab/gitlab-ce docker tag to v13.11.2-ce.0 (434d15d)

  • Remove commented-out print (0357c37)

  • Make Get.*Mixin._optional_get_attrs always present (3c1a0b3)

Always create GetMixin/GetWithoutIdMixin._optional_get_attrs attribute with a default value of tuple()

This way we don’t need to use hasattr() and we will know the type of the attribute.

Code Style

  • Clean up test run config (dfa40c1)

Documentation

  • Fix typo in http_delete docstring (5226f09)

  • api: Add behavior in local attributes when updating objects (38f65e8)

  • Fail on warnings during sphinx build (cbd4d52)

This is useful when docs aren’t included in the toctree and don’t show up on RTD.

Features

feat(objects): add support for Group wikis

  • objects: Add support for generic packages API (79d88bd)

  • api: Add deployment mergerequests interface (fbbc0d4)

  • objects: Support all issues statistics endpoints (f731707)

  • objects: Add support for descendant groups API (1b70580)

  • objects: Add pipeline test report support (ee9f96e)

  • objects: Add support for billable members (fb0b083)

  • Add feature to get inherited member for project/group (e444b39)

  • Add code owner approval as attribute (fdc46ba)

The python API was missing the field code_owner_approval_required as implemented in the GitLab REST API.

  • Indicate that we are a typed package (e4421ca)

By adding the file: py.typed it indicates that python-gitlab is a typed package and contains type-hints.

https://www.python.org/dev/peps/pep-0561/

  • Add support for lists of integers to ListAttribute (115938b)

Previously ListAttribute only support lists of integers. Now be more flexible and support lists of items which can be coerced into strings, for example integers.

This will help us fix issue #1407 by using ListAttribute for the ‘iids’ field.

Testing

  • functional: Force delete users on reset (8f81456)

Timing issues between requesting group deletion and GitLab enacting that deletion resulted in errors while attempting to delete a user which was the sole owner of said group (see: test_groups). Pass the ‘hard_delete’ parameter to ensure user deletion.

Was incorrectly using the issue ‘id’ vs ‘iid’.

  • functional: Explicitly remove deploy tokens on reset (19a55d8)

Deploy tokens would remain in the instance if the respective project or group was deleted without explicitly revoking the deploy tokens first.

  • cli: Replace assignment expression (11ae11b)

This is a feature added in 3.8, removing it allows for the test to run with lower python versions.

  • functional: Optionally keep containers running post-tests (4c475ab)

Additionally updates token creation to make use of first_or_create(), to avoid errors from the script caused by GitLab constraints preventing duplicate tokens with the same value.

  • cli: Add more real class scenarios (8cf5031)

  • functional: Start tracking functional test coverage (f875786)

  • functional: Add test for skip_groups list filter (a014774)

v2.7.1 (2021-04-26)

Bug Fixes

  • files: Do not url-encode file paths twice (8e25cec)

v2.7.0 (2021-04-25)

Bug Fixes

  • Only append kwargs as query parameters (b9ecc9a)

Some arguments to http_request were being read from kwargs, but kwargs is where this function creates query parameters from, by default. In the absence of a query_parameters param, the function would construct URLs with query parameters such as retry_transient_errors=True despite those parameters having no meaning to the API to which the request was sent.

This change names those arguments that are specific to http_request so that they do not end up as query parameters read from kwargs.

  • Only add query_parameters to GitlabList once (ca2c3c9)

Fixes #1386

  • Correct ProjectFile.decode() documentation (b180baf)

ProjectFile.decode() returns ‘bytes’ and not ‘str’.

Update the method’s doc-string and add a type-hint.

ProjectFile.decode() returns the result of a call to base64.b64decode()

The docs for that function state it returns ‘bytes’: https://docs.python.org/3/library/base64.html#base64.b64decode

Fixes: #1403

  • Update user’s bool data and avatar (3ba27ff)

If we want to update email, avatar and do not send email confirmation change (skip_reconfirmation = True), MultipartEncoder will try to encode everything except None and bytes. So it tries to encode bools. Casting bool’s values to their stringified int representation fix it.

  • types: Prevent dir from producing duplicates (5bf7525)

  • Correct some type-hints in gitlab/mixins.py (8bd3124)

Commit baea7215bbbe07c06b2ca0f97a1d3d482668d887 introduced type-hints for gitlab/mixins.py.

After starting to add type-hints to gitlab/v4/objects/users.py discovered a few errors.

Main error was using ‘=’ instead of ‘:’. For example: _parent = Optional[…] should be _parent: Optional[…]

Resolved those issues.

  • Argument type was not a tuple as expected (062f8f6)

While adding type-hints mypy flagged this as an issue. The third argument to register_custom_action is supposed to be a tuple. It was being passed as a string rather than a tuple of strings.

  • Handling config value in _get_values_from_helper (9dfb4cd)

  • Update doc for token helper (3ac6fa1)

  • Let the homedir be expanded in path of helper (fc7387a)

  • Make secret helper more user friendly (fc2798f)

  • Linting issues and test (b04dd2c)

  • Better real life token lookup example (9ef8311)

  • objects: Add single get endpoint for instance audit events (c3f0a6f)

  • Checking if RESTManager._from_parent_attrs is set (8224b40)

Prior to commit 3727cbd21fc40b312573ca8da56e0f6cf9577d08 RESTManager._from_parent_attrs did not exist unless it was explicitly set. But commit 3727cbd21fc40b312573ca8da56e0f6cf9577d08 set it to a default value of {}.

So the checks using hasattr() were no longer valid.

Update the checks to check if RESTManager._from_parent_attrs has a value.

  • Handle tags like debian/2%2.6-21 as identifiers (b4dac5c)

Git refnames are relatively free-form and can contain all sort for special characters, not just / and #, see http://git-scm.com/docs/git-check-ref-format

In particular, Debian’s DEP-14 standard for storing packaging in git repositories mandates the use of the % character in tags in some cases like debian/2%2.6-21.

Unfortunately python-gitlab currently only escapes / to %2F and in some cases # to %23. This means that when using the commit API to retrieve information about the debian/2%2.6-21 tag only the slash is escaped before being inserted in the URL path and the % is left untouched, resulting in something like /api/v4/projects/123/repository/commits/debian%2F2%2.6-21. When urllib3 seees that it detects the invalid % escape and then urlencodes the whole string, resulting in /api/v4/projects/123/repository/commits/debian%252F2%252.6-21, where the original / got escaped twice and produced %252F.

To avoid the issue, fully urlencode identifiers and parameters to avoid the urllib3 auto-escaping in all cases.

Signed-off-by: Emanuele Aina emanuele.aina@collabora.com

  • Remove duplicate class definitions in v4/objects/users.py (7c4e625)

The classes UserStatus and UserStatusManager were each declared twice. Remove the duplicate declarations.

Discovered this when I ran flake8 on the file. Unfortunately I was the one who introduced this wrong variable name :(

  • Tox pep8 target, so that it can run (f518e87)

Previously running the pep8 target would fail as flake8 was not installed.

Now install flake8 for the pep8 target.

NOTE: Running the pep8 target fails as there are many warnings/errors. But it does allow us to run it and possibly work on reducing these warnings/errors in the future.

In addition, add two checks to the ignore list as black takes care of formatting. The two checks added to the ignore list are: * E501: line too long * W503: line break before binary operator

Discovered that there were some undefined names.

  • Extend wait timeout for test_delete_user() (19fde8e)

Have been seeing intermittent failures of the test_delete_user() functional test. Have made the following changes to hopefully resolve the issue and if it still fails to know better why the failure occurred.

  • Extend the wait timeout for test_delete_user() from 30 to 60 tries of 0.5 seconds each.

  • Modify wait_for_sidekiq() to return True if sidekiq process terminated. Return False if the timeout expired.

  • Modify wait_for_sidekiq() to loop through all processes instead of assuming there is only one process. If all processes are not busy then return.

  • Modify wait_for_sidekiq() to sleep at least once before checking for processes being busy.

  • Check for True being returned in test_delete_user() call to wait_for_sidekiq()

  • Test_update_group() dependency on ordering (e78a8d6)

Since there are two groups we can’t depend on the one we changed to always be the first one returned.

Instead fetch the group we want and then test our assertion against that group.

  • Honor parameter value passed (c2f8f0e)

Gitlab allows setting the defaults for MR to delete the source. Also the inline help of the CLI suggest that a boolean is expected, but no matter what value you set, it will always delete.

Chores

  • Bump version to 2.7.0 (34c4052)

  • Make ListMixin._list_filters always present (8933113)

Always create ListMixin._list_filters attribute with a default value of tuple().

This way we don’t need to use hasattr() and we will know the type of the attribute.

  • Make RESTObject._short_print_attrs always present (6d55120)

Always create RESTObject._short_print_attrs with a default value of None.

This way we don’t need to use hasattr() and we will know the type of the attribute.

  • objects: Remove noisy deprecation warning for audit events (2953642)

It’s mostly an internal thing anyway and can be removed in 3.0.0

  • deps: Update gitlab/gitlab-ce docker tag to v13.11.1-ce.0 (3088714)

  • Fix F841 errors reported by flake8 (40f4ab2)

Local variable name is assigned to but never used

https://www.flake8rules.com/rules/F841.html

  • Fix F401 errors reported by flake8 (ff21eb6)

F401: Module imported but unused

https://www.flake8rules.com/rules/F401.html

  • Fix E711 error reported by flake8 (630901b)

E711: Comparison to none should be ‘if cond is none:’

https://www.flake8rules.com/rules/E711.html

  • Fix E712 errors reported by flake8 (83670a4)

E712: Comparison to true should be ‘if cond is true:’ or ‘if cond:’

https://www.flake8rules.com/rules/E712.html

  • Fix E741/E742 errors reported by flake8 (380f227)

Fixes to resolve errors for: https://www.flake8rules.com/rules/E741.html Do not use variables named ‘I’, ‘O’, or ‘l’ (E741)

https://www.flake8rules.com/rules/E742.html Do not define classes named ‘I’, ‘O’, or ‘l’ (E742)

  • deps: Update gitlab/gitlab-ce docker tag to v13.11.0-ce.0 (711896f)

  • Remove unused function sanitize_parameters() (443b934)

The function sanitize_parameters() was used when the v3 API was in use. Since v3 API support has been removed there are no more users of this function.

Remove usage of getattr(self, “_update_uses_post”, False)

Instead add it to class and set default value to False.

Add a tests that shows it is set to True for the ProjectMergeRequestApprovalManager and ProjectApprovalManager classes.

  • Have _create_attrs & _update_attrs be a namedtuple (aee1f49)

Convert _create_attrs and _update_attrs to use a NamedTuple (RequiredOptional) to help with code readability. Update all code to use the NamedTuple.

  • deps: Update dependency docker-compose to v1.29.1 (a89ec43)

  • deps: Update dependency sphinx to v3.5.4 (a886d28)

  • deps: Update gitlab/gitlab-ce docker tag to v13.10.3-ce.0 (eabe091)

  • deps: Update gitlab/gitlab-ce docker tag to v13.10.1-ce.0 (1995361)

  • Import audit events in objects (35a190c)

  • deps: Update dependency docker-compose to v1.28.6 (46b05d5)

  • deps: Update gitlab/gitlab-ce docker tag to v13.10.0-ce.0 (5221e33)

  • deps: Update gitlab/gitlab-ce docker tag to v13.9.4-ce.0 (939f769)

  • Fix package file test naming (8c80268)

  • Add _create_attrs & _update_attrs to RESTManager (147f05d)

Add the attributes: _create_attrs and _update_attrs to the RESTManager class. This is so that we stop using getattr() if we don’t need to.

This also helps with type-hints being available for these attributes.

  • deps: Update gitlab/gitlab-ce docker tag to v13.9.3-ce.0 (2ddf45f)

  • Make _types always present in RESTManager (924f83e)

We now create _types = {} in RESTManager class.

By making _types always present in RESTManager it makes the code simpler. We no longer have to do: types = getattr(self, “_types”, {})

And the type checker now understands the type.

  • Add type-hints for gitlab/mixins.py (baea721)

  • Added type-hints for gitlab/mixins.py * Changed use of filter with a lambda expression to list-comprehension. mypy was not able to understand the previous code. Also list-comprehension is better :)

  • Add type hints to gitlab/base.py:RESTManager (9c55593)

Add some additional type hints to gitlab/base.py

  • Put assert statements inside ‘if TYPE_CHECKING:’ (b562458)

To be safe that we don’t assert while running, put the assert statements, which are used by mypy to check that types are correct, inside an ‘if TYPE_CHECKING:’ block.

Also, instead of asserting that the item is a dict, instead assert that it is not a requests.Response object. Theoretically the JSON could return as a list or dict, though at this time we are assuming a dict.

  • deps: Update dependency sphinx to v3.5.2 (9dee5c4)

  • deps: Update gitlab/gitlab-ce docker tag to v13.9.2-ce.0 (933ba52)

  • Del ‘import *’ in gitlab/v4/objects/project_access_tokens.py (9efbe12)

Remove usage of ‘import *’ in gitlab/v4/objects/project_access_tokens.py.

  • Disallow incomplete type defs (907634f)

Don’t allow a partially annotated function definition. Either none of the function is annotated or all of it must be.

Update code to ensure no-more partially annotated functions.

Update gitlab/cli.py with better type-hints. Changed Tuple[Any, …] to Tuple[str, …]

  • api: Move repository endpoints into separate module (1ed154c)

  • Add and fix some type-hints in gitlab/client.py (8837207)

Was able to figure out better type-hints for gitlab/client.py

  • Add additional type-hints for gitlab/base.py (ad72ef3)

Add type-hints for the variables which are set via self.dict

mypy doesn’t see them when they are assigned via self.dict. So declare them in the class definition.

  • Add type-hints to gitlab/client.py (c9e5b4f)

Adding some initial type-hints to gitlab/client.py

  • Remove import of gitlab.utils from init.py (39b9183)

Initially when extracting out the gitlab/client.py code we tried to remove this but functional tests failed.

Later we fixed the functional test that was failing, so now remove the unneeded import.

  • Improve type-hints for gitlab/base.py (cbd43d0)

Determined the base class for obj_cls and adding type-hints for it.

  • Add type-hints to gitlab/cli.py (10b7b83)

  • deps: Update dependency docker-compose to v1.28.5 (f4ab558)

  • deps: Update wagoid/commitlint-github-action action to v3 (b3274cf)

  • Add type-hints to gitlab/const.py (a10a777)

  • Add type hints to gitlab/utils.py (acd9294)

  • Add type-hints to gitlab/config.py (213e563)

  • Remove usage of ‘from … import *’ (c83eaf4)

In gitlab/v4/objects/*.py remove usage of: * from gitlab.base import * * from gitlab.mixins import *

Change them to: * from gitlab.base import CLASS_NAME * from gitlab.mixins import CLASS_NAME

Programmatically update code to explicitly import needed classes only.

After the change the output of: $ flake8 gitlab/v4/objects/*py | grep ‘REST|Mixin’

Is empty. Before many messages about unable to determine if it was a valid name.

  • deps: Update gitlab/gitlab-ce docker tag to v13.9.1-ce.0 (f6fd995)

  • Remove unused function _construct_url() (009d369)

The function _construct_url() was used by the v3 API. All usage of the function was removed in commit fe89b949922c028830dd49095432ba627d330186

  • Add type hints to gitlab/base.py (3727cbd)

  • Remove usage of ‘from … import *’ in client.py (bf0c8c5)

In gitlab/client.py remove usage of: * from gitlab.const import * * from gitlab.exceptions import *

Change them to: * import gitlab.const * import gitlab.exceptions

Update code to explicitly reference things in gitlab.const and gitlab.exceptions

A flake8 run no longer lists any undefined variables. Before it listed possible undefined variables.

  • Explicitly import gitlab.v4.objects/cli (233b79e)

As we only support the v4 Gitlab API, explicitly import gitlab.v4.objects and gitlab.v4.clie instead of dynamically importing it depending on the API version.

This has the added benefit of mypy being able to type check the Gitlab init() function as currently it will fail if we enable type checking of init() it will fail.

Also, this also helps by not confusing tools like pyinstaller/cx_freeze with dynamic imports so you don’t need hooks for standalone executables. And according to https://docs.gitlab.com/ee/api/,

“GraphQL co-exists with the current v4 REST API. If we have a v5 API, this should be a compatibility layer on top of GraphQL.”

  • deps: Update gitlab/gitlab-ce docker tag to v13.9.0-ce.0 (3aef19c)

  • objects: Make Project refreshable (958a6aa)

Helps getting the real state of the project from the server.

  • deps: Update dependency docker-compose to v1.28.4 (8938484)

  • tests: Remove unused URL segment (66f0b6c)

  • deps: Update dependency docker-compose to v1.28.3 (2358d48)

  • Remove unused ALLOWED_KEYSET_ENDPOINTS variable (3d5d5d8)

The variable ALLOWED_KEYSET_ENDPOINTS was added in commit f86ef3bbdb5bffa1348a802e62b281d3f31d33ad.

Then most of that commit was removed in commit e71fe16b47835aa4db2834e98c7ffc6bdec36723, but ALLOWED_KEYSET_ENDPOINTS was missed.

  • deps: Update dependency sphinx to v3.5.1 (f916f09)

  • Remove Python 2 code (b5d4e40)

httplib is a Python 2 library. It was renamed to http.client in Python 3.

https://docs.python.org/2.7/library/httplib.html

  • deps: Update dependency sphinx to v3.5.0 (188c5b6)

  • deps: Update gitlab/gitlab-ce docker tag to v13.8.4-ce.0 (832cb88)

  • ci: Deduplicate PR jobs (63918c3)

  • deps: Update gitlab/gitlab-ce docker tag to v13.8.3-ce.0 (e6c20f1)

  • deps: Update precommit hook alessandrojcm/commitlint-pre-commit-hook to v4 (505a8b8)

  • deps: Update gitlab/gitlab-ce docker tag to v13.8.2-ce.0 (7c12038)

  • deps: Update dependency sphinx to v3.4.3 (37c992c)

Documentation

  • api: Add examples for resource state events (4d00c12)

  • Add information about the gitter community (6ff67e7)

Add a section in the README.rst about the gitter community. The badge already exists and is useful but very easy to miss.

  • api: Add release links API docs (36d65f0)

  • Add docs and examples for custom user agent (a69a214)

  • Change travis-ci badge to githubactions (2ba5ba2)

Features

  • objects: Add support for resource state events API (d4799c4)

  • Option to add a helper to lookup token (8ecf559)

  • objects: Add support for group audit events API (2a0fbdf)

  • Add ProjectPackageFile (b9d469b)

Add ProjectPackageFile and the ability to list project package package_files.

Fixes #1372

  • users: Add follow/unfollow API (e456869)

  • projects: Add project access token api (1becef0)

  • Add an initial mypy test to tox.ini (fdec039)

Add an initial mypy test to test gitlab/base.py and gitlab/init.py

  • objects: Add Release Links API support (28d7518)

  • Add project audit endpoint (6660dbe)

  • Add personal access token API (2bb16fa)

See: https://docs.gitlab.com/ee/api/personal_access_tokens.html

  • issues: Add missing get verb to IssueManager (f78ebe0)

  • Import from bitbucket server (ff3013a)

I’d like to use this libary to automate importing Bitbucket Server repositories into GitLab. There is a GitLab API endpoint to do this, but it is not exposed through this library.

  • Add an import_bitbucket_server method to the ProjectManager. This method calls this GitLab API endpoint: https://docs.gitlab.com/ee/api/import.html#import-repository-from-bitbucket-server * Modify import_gitlab method docstring for python3 compatibility * Add a skipped stub test for the existing import_github method

  • api,cli: Make user agent configurable (4bb201b)

Refactoring

  • objects: Move instance audit events where they belong (48ba88f)

  • Move Gitlab and GitlabList to gitlab/client.py (53a7645)

Move the classes Gitlab and GitlabList from gitlab/init.py to the newly created gitlab/client.py file.

Update one test case that was depending on requests being defined in gitlab/init.py

  • api: Explicitly export classes for star imports (f05c287)

  • v4: Split objects and managers per API resource (a5a48ad)

Testing

  • object: Add test for dir duplicates (a8e591f)

  • objects: Add tests for resource state events (10225cf)

  • objects: Add unit test for instance audit events (84e3247)

  • Don’t add duplicate fixture (5d94846)

Co-authored-by: Nejc Habjan hab.nejc@gmail.com

  • api: Add functional test for release links API (ab2a1c8)

  • api,cli: Add tests for custom user agent (c5a37e7)

v2.6.0 (2021-01-29)

Bug Fixes

  • api: Use RetrieveMixin for ProjectLabelManager (1a14395)

Allows to get a single label from a project, which was missing before even though the GitLab API has the ability to.

  • base: Really refresh object (e1e0d8c)

This fixes and error, where deleted attributes would not show up

Fixes #1155

  • cli: Write binary data to stdout buffer (0733ec6)

  • Docs changed using the consts (650b65c)

  • Typo (9baa905)

  • cli: Add missing args for project lists (c73e237)

  • api: Add missing runner access_level param (92669f2)

Chores

  • Offically support and test 3.9 (62dd07d)

  • deps: Pin dependency requests-toolbelt to ==0.9.1 (4d25f20)

  • deps: Update dependency requests to v2.25.1 (9c2789e)

  • deps: Update gitlab/gitlab-ce docker tag to v13.8.1-ce.0 (9854d6d)

  • ci: Add coverage and docs jobs (2de64cf)

  • ci: Force colors in pytest runs (1502079)

  • ci: Pin docker-compose install for tests (1f7a2ab)

This ensures python-dotenv with expected behavior for .env processing

  • ci: Pin os version (cfa27ac)

  • ci: Fix typo in matrix (5e1547a)

  • ci: Fix copy/paste oopsie (c6241e7)

  • ci: Add pytest PR annotations (8f92230)

  • ci: Replace travis with Actions (8bb73a3)

  • Move .env into docker-compose dir (55cbd1c)

  • deps: Update gitlab/gitlab-ce docker tag to v13.5.4-ce.0 (265dbbd)

  • deps: Update gitlab/gitlab-ce docker tag to v13.5.3-ce.0 (d1b0b08)

  • deps: Update gitlab/gitlab-ce docker tag to v13.5.2-ce.0 (4a6831c)

  • deps: Update gitlab/gitlab-ce docker tag to v13.5.1-ce.0 (348e860)

  • deps: Update gitlab/gitlab-ce docker tag to v13.5.0-ce.0 (fc205cc)

  • docs: Always edit the file directly on master (35e43c5)

There is no way to edit the raw commit

  • cli: Remove python2 code (1030e0a)

  • deps: Update gitlab/gitlab-ce docker tag to v13.4.3-ce.0 (bc17889)

  • Simplified search scope constants (16fc048)

  • Added docs for search scopes constants (7565bf0)

  • Added constants for search API (8ef53d6)

  • Apply suggestions (65ce026)

  • deps: Update python docker tag to v3.9 (1fc65e0)

  • Use helper fixtures for test directories (40ec2f5)

  • Allow overriding docker-compose env vars for tag (27109ca)

  • Remove unnecessary random function (d4ee0a6)

  • deps: Pin dependencies (14d8f77)

  • deps: Update gitlab/gitlab-ce docker tag to v13.3.6-ce.0 (57b5782)

  • test: Remove hacking dependencies (9384493)

  • ci: Add .readthedocs.yml (0ad441e)

  • ci: Reduce renovate PR noise (f4d7a55)

  • deps: Update gitlab/gitlab-ce docker tag to v13.3.5-ce.0 (c88d870)

  • deps: Update gitlab/gitlab-ce docker tag to v13.3.4-ce.0 (e94c4c6)

  • deps: Update gitlab/gitlab-ce docker tag to v13.3.3-ce.0 (667bf01)

Documentation

  • cli-usage: Fixed term (d282a99)

  • readme: Update supported Python versions (20b1e79)

  • cli: Use inline anonymous references for external links (f2cf467)

There doesn’t seem to be an obvious way to use an alias for identical text labels that link to different targets. With inline links we can work around this shortcoming. Until we know better.

  • groups: Add example for creating subgroups (92eb4e3)

  • Clean up grammar and formatting in documentation (aff9bc7)

  • Add Project Merge Request approval rule documentation (449fc26)

  • issues: Add admin, project owner hint (609c03b)

Closes #1101

  • readme: Also add hint to delete gitlab-runner-test (8894f2d)

Otherwise the whole testsuite will refuse to run

  • projects: Correct fork docs (54921db)

Closes #1126

  • cli: Add example for job artifacts download (375b29d)

  • cli: Add auto-generated CLI reference (6c21fc8)

Features

  • Support multipart uploads (2fa3004)

  • Add MINIMAL_ACCESS constant (49eb3ca)

A “minimal access” access level was introduced in GitLab 13.5.

  • tests: Test label getter (a41af90)

  • Adds support for project merge request approval rules (#1199, c6fbf39)

  • Unit tests added (f37ebf5)

  • Added support for pipeline bridges (05cbdc2)

  • api: Added wip filter param for merge requests (d6078f8)

  • api: Added wip filter param for merge requests (aa6e80d)

  • api: Add support for user identity provider deletion (e78e121)

Refactoring

  • tests: Split functional tests (61e43eb)

Testing

  • Ignore failing test for now (4b4e253)

  • Add test_project_merge_request_approvals.py (9f6335f)

  • cli: Add test for job artifacts download (f4e7950)

  • env: Replace custom scripts with pytest and docker-compose (79489c7)

  • Add unit tests for badges API (2720b73)

  • Add unit tests for resource label events API (e9a211c)

v2.5.0 (2020-09-01)

Bug Fixes

  • Wrong reconfirmation parameter when updating user’s email (b5c267e)

Since version 10.3 (and later), param to not send (re)confirmation when updating an user is skip_reconfirmation (and not skip_confirmation).

See:

  • https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/15175?tab= * https://docs.gitlab.com/11.11/ee/api/users.html#user-modification * https://docs.gitlab.com/ee/api/users.html#user-modification

  • Tests fail when using REUSE_CONTAINER option (0078f89)

Fixes #1146

  • Implement Gitlab’s behavior change for owned=True (9977799)

Chores

  • Bump python-gitlab to 2.5.0 (56fef01)

  • deps: Update python docker tag to v3.8 (a8070f2)

  • test: Use pathlib for paths (5a56b6b)

  • deps: Update gitlab/gitlab-ce docker tag to v13.3.2-ce.0 (9fd778b)

  • ci: Pin gitlab-ce version for renovate (cb79fb7)

  • env: Add pre-commit and commit-msg hooks (82070b2)

  • ci: Use fixed black version (9565684)

  • Make latest black happy with existing code (6961479)

  • Update tools dir for latest black version (c2806d8)

  • Remove unnecessary import (f337b7a)

  • Make latest black happy with existing code (4039c8c)

  • Update tools dir for latest black version (f245ffb)

  • Make latest black happy with existing code (d299753)

  • Run unittest2pytest on all unit tests (11383e7)

  • Remove remnants of python2 imports (402566a)

Documentation

  • variables: Add docs for instance-level variables (ad4b87c)

  • api: Add example for latest pipeline job artifacts (d20f022)

  • packages: Add examples for Packages API and cli usage (a47dfcd)

  • cli: Add examples for group-project list (af86dcd)

  • Additional project file delete example (9e94b75)

Showing how to delete without having to pull the file

Features

  • api: Add support for instance variables (4492fc4)

  • Add support to resource milestone events (88f8cc7)

Fixes #1154

  • api: Add endpoint for latest ref artifacts (b7a07fc)

  • api: Add support for Packages API (71495d1)

  • Add share/unshare group with group (7c6e541)

Refactoring

  • Turn objects module into a package (da8af6f)

  • Rewrite unit tests for objects with responses (204782a)

  • Split unit tests by GitLab API resources (76b2cad)

Testing

  • api: Add tests for variables API (66d108d)

  • Add unit tests for resource milestone events API (1317f4b)

Fixes #1154

  • packages: Add tests for Packages API (7ea178b)

v2.4.0 (2020-07-09)

Bug Fixes

  • Do not check if kwargs is none (a349b90)

Co-authored-by: Traian Nedelea tron1point0@pm.me

  • Make query kwargs consistent between call in init and next (72ffa01)

  • Pass kwargs to subsequent queries in gitlab list (1d011ac)

  • Add masked parameter for variables command (b6339bf)

  • merge: Parse arguments as query_data (878098b)

Chores

Documentation

  • pipelines: Simplify download (9a068e0)

This uses a context instead of inventing your own stream handler which makes the code simpler and should be fine for most use cases.

Signed-off-by: Paul Spooren mail@aparcar.org

Features

This constant is useful for cases where no access is granted, e.g. when creating a protected branch.

The NO_ACCESS const corresponds to the definition in https://docs.gitlab.com/ee/api/protected_branches.html

v2.3.1 (2020-06-09)

Bug Fixes

  • Disable default keyset pagination (e71fe16)

Instead we set pagination to offset on the other paths

Chores

v2.3.0 (2020-06-08)

Bug Fixes

  • Use keyset pagination by default for /projects > 50000 (f86ef3b)

Workaround for https://gitlab.com/gitlab-org/gitlab/-/issues/218504. Remove this in 13.1

  • config: Fix duplicate code (ee2df6f)

Fixes #1094

  • project: Add missing project parameters (ad8c67d)

Chores

  • Correctly render rst (f674bf2)

  • Bump to 2.3.0 (01ff865)

  • ci: Add codecov integration to Travis (e230568)

  • test: Remove outdated token test (e6c9fe9)

  • Bring commit signatures up to date with 12.10 (dc382fe)

  • Fix typo in docstring (c20f5f1)

  • Remove old builds-email service (c60e2df)

  • services: Update available service attributes (7afc357)

  • Use pytest for unit tests and coverage (9787a40)

Continuous Integration

  • Lint fixes (930122b)

  • Add a test for creating and triggering pipeline schedule (9f04560)

Documentation

  • remote_mirrors: Fix create command (bab91fe)

  • remote_mirrors: Fix create command (1bb4e42)

  • Update authors (ac0c84d)

  • readme: Add codecov badge for master (e21b2c5)

  • readme: Update test docs (6e2b1ec)

Features

  • Add group runners api (4943991)

  • Add play command to project pipeline schedules (07b9988)

fix: remove version from setup

feat: add pipeline schedule play error exception

docs: add documentation for pipeline schedule play

  • api: Added support in the GroupManager to upload Group avatars (28eb7ea)

  • services: Add project service list API (fc52221)

Can be used to list available services It was introduced in GitLab 12.7

  • Allow an environment variable to specify config location (401e702)

It can be useful (especially in scripts) to specify a configuration location via an environment variable. If the “PYTHON_GITLAB_CFG” environment variable is defined, treat its value as the path to a configuration file and include it in the set of default configuration locations.

  • types: Add dir to RESTObject to expose attributes (cad134c)

Testing

  • Disable test until Gitlab 13.1 (63ae77a)

  • runners: Add all runners unit tests (127fa5a)

  • cli: Convert shell tests to pytest test cases (c4ab4f5)

v2.2.0 (2020-04-07)

Bug Fixes

  • types: Do not split single value string in ListAttribute (a26e585)

  • Add missing import_project param (9b16614)

Chores

  • Bump to 2.2.0 (22d4b46)

  • Use raise..from for chained exceptions (#939, 79fef26)

  • Rename ExportMixin to DownloadMixin (847da60)

  • mixins: Factor out export download into ExportMixin (6ce5d1f)

  • group: Update group_manager attributes (#1062, fa34f5e)

  • chore(group): update group_manager attributes

Co-Authored-By: Nejc Habjan hab.nejc@gmail.com

  • Fix typo in allow_failures (265bbdd)

  • Pass environment variables in tox (e06d33c)

  • Improve and document testing against different images (98d3f77)

  • Remove references to python2 in test env (6e80723)

  • Clean up for black and flake8 (4fede5d)

  • Flatten test_import_github (b8ea96c)

  • Move test_import_github into TestProjectImport (a881fb7)

Documentation

  • Add docs for Group Import/Export API (8c3d744)

  • Fix comment of prev_page() (b066b41)

Co-Authored-By: Nejc Habjan hab.nejc@gmail.com

  • Fix comment of prev_page() (ac6b2da)

Co-Authored-By: Nejc Habjan hab.nejc@gmail.com

  • Fix comment of prev_page() (7993c93)

Features

  • api: Add support for Gitlab Deploy Token API (01de524)

  • api: Add support for remote mirrors API (#1056, 4cfaa2f)

  • api: Add support for Group Import/Export API (#1037, 6cb9d92)

  • Add create from template args to ProjectManager (f493b73)

This commit adds the v4 Create project attributes necessary to create a project from a project, instance, or group level template as documented in https://docs.gitlab.com/ee/api/projects.html#create-project

  • Add support for commit GPG signature API (da7a809)

Testing

  • api: Add tests for group export/import API (e7b2d6c)

  • types: Reproduce get_for_api splitting strings (#1057, babd298)

  • Create separate module for commit tests (8c03771)

  • Move mocks to top of module (0bff713)

  • Add unit tests for Project Import (f7aad5f)

  • Add unit tests for Project Export (600dc86)

  • Prepare base project test class for more tests (915587f)

v2.1.2 (2020-03-09)

Chores

v2.1.1 (2020-03-09)

Bug Fixes

  • docs: Additional project statistics example (5ae5a06)

Chores

  • Bump version to 2.1.1 (6c5458a)

  • user: Update user attributes to 12.8 (666f880)

v2.1.0 (2020-03-08)

Bug Fixes

  • projects: Correct copy-paste error (adc9101)

  • objects: Add default name data and use http post (70c0cfb)

Updating approvers new api needs a POST call. Also It needs a name of the new rule, defaulting this to ‘name’.

  • Do not require empty data dict for create() (99d959f)

  • docs: Fix typo in user memberships example (33889bc)

  • Remove trailing slashes from base URL (#913, 2e396e4)

  • Return response with commit data (b77b945)

  • docs: Update to new set approvers call for # of approvers (8e0c526)

to set the # of approvers for an MR you need to use the same function as for setting the approvers id.

  • objects: Update set_approvers function call (65ecadc)

Added a miss paramter update to the set_approvers function

  • docs and tests: Update docs and tests for set_approvers (2cf12c7)

Updated the docs with the new set_approvers arguments, and updated tests with the arg as well.

  • objects: Update to new gitlab api for path, and args (e512cdd)

Updated the gitlab path for set_approvers to approvers_rules, added default arg for rule type, and added arg for # of approvals required.

  • Remove null values from features POST data, because it fails (1ec1816)

Chores

Another case of the double slash rewrite.

  • Ensure developers use same gitlab image as Travis (fab17fc)

Code Style

Documentation

  • Add reference for REQUESTS_CA_BUNDLE (37e8d5d)

  • pagination: Clear up pagination docs (1609824)

Co-Authored-By: Mitar mitar.git@tnode.com

Features

  • api: Add support for GitLab OAuth Applications API (4e12356)

  • Use keyset pagination by default for all=True (99b4484)

  • Add support for user memberships API (#1009, c313c2b)

  • Add support for commit revert API (#991, 5298964)

  • Add capability to control GitLab features per project or group (7f192b4)

Performance Improvements

  • Prepare environment when gitlab is reconfigured (3834d9c)

Testing

  • Add unit tests for base URLs with trailing slashes (32844c7)

  • Remove duplicate resp_get_project (cb43695)

  • Use lazy object in unit tests (31c6562)

  • Add unit tests for revert commit API (d7a3066)

v2.0.1 (2020-02-05)

Chores

I’ve misread the tag

There are a few more features in there

  • Bump version to 2.0.1 (8287a0d)

  • user: Update user attributes (27375f6)

This also workarounds an GitLab issue, where private_profile, would reset to false if not supplied

Documentation

  • auth: Remove email/password auth (c9329bb)

v2.0.0 (2020-01-26)

Bug Fixes

  • projects: Adjust snippets to match the API (e104e21)

Chores

  • Build_sphinx needs sphinx >= 1.7.6 (528dfab)

Stepping thru Sphinx versions from 1.6.5 to 1.7.5 build_sphinx fails. Once Sphinx == 1.7.6 build_sphinx finished.

  • Enforce python version requirements (70176db)

  • Bump to 2.0.0 (c817dcc)

Dropping support for legacy python requires a new major version

  • Drop legacy python tests (af8679a)

Support dropped for: 2.7, 3.4, 3.5

  • Add PyYaml as extra require (7ecd518)

  • Bump minimum required requests version (3f78aa3)

for security reasons

Documentation

  • Fix snippet get in project (3a4ff2f)

  • projects: Add raw file download docs (939e9d3)

Fixes #969

Features

  • Add global order_by option to ease pagination (d187925)

  • Support keyset pagination globally (0b71ba4)

  • Add appearance API (4c4ac5c)

  • Add autocompletion support (973cb8b)

Refactoring

  • Support new list filters (bded2de)

This is most likely only useful for the CLI

Testing

  • Adjust functional tests for project snippets (ac0ea91)

  • Add project snippet tests (0952c55)

v1.15.0 (2019-12-16)

Bug Fixes

  • Ignore all parameter, when as_list=True (137d72b)

Closes #962

Chores

Code Style

  • Format with the latest black version (06a8050)

Documentation

  • projects: Fix file deletion docs (1c4f1c4)

The function file.delete() requires branch argument in addition to commit_message.

  • Added docs for statistics (8c84cbf)

Features

  • Allow cfg timeout to be overrided via kwargs (e9a8289)

On startup, the timeout parameter is loaded from config and stored on the base gitlab object instance. This instance parameter is used as the timeout for all API requests (it’s passed into the session object when making HTTP calls).

This change allows any API method to specify a timeout argument to **kwargs that will override the global timeout value. This was somewhat needed / helpful for the import_github method.

I have also updated the docs accordingly.

  • Add support for /import/github (aa4d41b)

Addresses python-gitlab/python-gitlab#952

This adds a method to the ProjectManager called import_github, which maps to the /import/github API endpoint. Calling import_github will trigger an import operation from <repo_id> into <target_namespace>, using <personal_access_token> to authenticate against github. In practice a gitlab server may take many 10’s of seconds to respond to this API call, so we also take the liberty of increasing the default timeout (only for this method invocation).

Unfortunately since import is a protected keyword in python, I was unable to follow the endpoint structure with the manager namespace. I’m open to suggestions on a more sensible interface.

I’m successfully using this addition to batch-import hundreds of github repositories into gitlab.

  • Nicer stacktrace (697cda2)

  • Add variable_type/protected to projects ci variables (4724c50)

This adds the ci variables types and protected flag for create/update requests.

See https://docs.gitlab.com/ee/api/project_level_variables.html#create-variable

  • Add variable_type to groups ci variables (0986c93)

This adds the ci variables types for create/update requests.

See https://docs.gitlab.com/ee/api/group_level_variables.html#create-variable

  • Access project’s issues statistics (482e57b)

Fixes #966

Fixes #967

  • Retry transient HTTP errors (59fe271)

Fixes #970

Testing

  • Added tests for statistics (8760efc)

  • Test that all is ignored, when as_list=False (b5e88f3)

v1.14.0 (2019-12-07)

Bug Fixes

  • project-fork: Copy create fix from ProjectPipelineManager (516307f)

  • project-fork: Correct path computation for project-fork list (44a7c27)

  • labels: Ensure label.save() works (727f536)

Otherwise, we get: File “gitlabracadabra/mixins/labels.py”, line 67, in _process_labels current_label.save() File “gitlab/exceptions.py”, line 267, in wrapped_f return f(*args, **kwargs) File “gitlab/v4/objects.py”, line 896, in save self._update_attrs(server_data) File “gitlab/base.py”, line 131, in _update_attrs self.dict[“_attrs”].update(new_attrs) TypeError: ‘NoneType’ object is not iterable

Because server_data is None.

  • Added missing attributes for project approvals (460ed63)

Reference: https://docs.gitlab.com/ee/api/merge_request_approvals.html#change-configuration

Missing attributes: * merge_requests_author_approval * merge_requests_disable_committers_approval

Chores

Documentation

  • readme: Fix Docker image reference (b9a40d8)

    v1.8.0 is not available.

    Unable to find image 'registry.gitlab.com/python-gitlab/python-gitlab:v1.8.0' locally
    docker: Error response from daemon: manifest for registry.gitlab.com/python-gitlab/python-gitlab:v1.8.0 not found: manifest unknown: manifest unknown.
    

    ‘registry.gitlab.com/python-gitlab/python-gitlab:v1.8.0’ locally docker: Error response from daemon: manifest for registry.gitlab.com/python-gitlab/python-gitlab:v1.8.0 not found: manifest unknown: manifest unknown. ```

  • snippets: Fix snippet docs (bbaa754)

Fixes #954

  • Fix typo (d9871b1)

  • Add project and group cluster examples (d15801d)

  • changelog: Add notice for release-notes on Github (#938, de98e57)

  • pipelines_and_jobs: Add pipeline custom variables usage example (b275eb0)

Features

  • Add audit endpoint (2534020)

  • Add project and group clusters (ebd053e)

  • Add support for include_subgroups filter (adbcd83)

v1.13.0 (2019-11-02)

Bug Fixes

  • projects: Support approval_rules endpoint for projects (2cef2bb)

The approvers API endpoint is deprecated [1]. GitLab instead uses the approval_rules API endpoint to modify approval settings for merge requests. This adds the functionality for project-level merge request approval settings.

Note that there does not exist an endpoint to ‘get’ a single approval rule at this moment - only ‘list’.

[1] https://docs.gitlab.com/ee/api/merge_request_approvals.html

Chores

  • chore(setup): we support 3.8

  • style: format with black

  • ci: Update latest docker image for every tag (01cbc7a)

  • dist: Add test data (3133ed7)

Closes #907

Documentation

  • Projects get requires id (5bd8947)

Also, add an example value for project_id to the other projects.get() example.

  • project: Fix group project example (e680943)

GroupManager.search is removed since 9a66d78, use list(search=’keyword’) instead

Features

  • Add users activate, deactivate functionality (32ad669)

These were introduced in GitLab 12.4

  • Send python-gitlab version as user-agent (c22d49d)

  • Add deployment creation (ca256a0)

Added in GitLab 12.4

Fixes #917

  • test: Unused unittest2, type -> isinstance (33b1801)

  • auth: Remove deprecated session auth (b751cdf)

  • doc: Remove refs to api v3 in docs (6beeaa9)

Testing

  • projects: Support approval_rules endpoint for projects (94bac44)

  • Remove warning about open files from test_todo() (d6419aa)

When running unittests python warns that the json file from test_todo() was still open. Use with to open, read, and create encoded json data that is used by resp_get_todo().

v1.12.1 (2019-10-07)

Bug Fixes

  • Fix not working without auth (03b7b5b)

v1.12.0 (2019-10-06)

Bug Fixes

  • cli: Fix cli command user-project list (c17d7ce)

  • labels: Don’t mangle label name on update (1fb6f73)

  • todo: Mark_all_as_done doesn’t return anything (5066e68)

Chores

Code Style

Documentation

  • project: Add submodule docs (b5969a2)

  • projects: Add note about project list (44407c0)

Fixes #795

  • repository-tags: Fix typo (3024c5d)

Closes #879

  • todo: Correct todo docs (d64edcb)

Features

  • project: Implement update_submodule (4d1e377)

  • ci: Improve functionnal tests (eefceac)

  • project: Add file blame api (f5b4a11)

https://docs.gitlab.com/ee/api/repository_files.html#get-file-blame-from-repository

  • Add support for job token (cef3aa5)

See https://docs.gitlab.com/ee/api/jobs.html#get-job-artifacts for usage

Refactoring

  • Remove obsolete test image (a14c02e)

Follow up of #896

  • Remove unused code, simplify string format (c7ff676)

Testing

  • submodules: Correct test method (e59356f)

  • func: Disable commit test (c9c76a2)

GitLab seems to be randomly failing here

  • todo: Add unittests (7715567)

  • status: Add user status test (fec4f9c)

  • Re-enabled py_func_v4 test (49d84ba)

v1.11.0 (2019-08-31)

Bug Fixes

  • projects: Avatar uploading for projects (558ace9)

  • Remove empty list default arguments (6e204ce)

Signed-off-by: Frantisek Lachman flachman@redhat.com

  • Remove empty dict default arguments (8fc8e35)

Signed-off-by: Frantisek Lachman flachman@redhat.com

  • Add project and group label update without id to fix cli (a3d0d7c)

Chores

Features

  • Add methods to retrieve an individual project environment (29de40e)

  • Group labels with subscriptable mixin (4a9ef9f)

Testing

  • Add group label cli tests (f7f24bd)

v1.10.0 (2019-07-22)

Bug Fixes

  • Improve pickle support (b4b5dec)

  • cli: Allow –recursive parameter in repository tree (7969a78)

Fixes #718 Fixes #731

  • cli: Don’t fail when the short print attr value is None (8d1552a)

Fixes #717 Fixes #727

  • cli: Fix update value for key not working (b766203)

  • Convert # to %23 in URLs (14f5385)

Refactor a bit to handle this change, and add unit tests.

Closes #779

Errors have not been detected by broken travis runs.

  • api: Make *MemberManager.all() return a list of objects (d74ff50)

Fixes #699

  • Use python2 compatible syntax for super (b08efcb)

  • Re-add merge request pipelines (877ddc0)

  • api: Don’t try to parse raw downloads (35a6d85)

http_get always tries to interpret the retrieved data if the content-type is json. In some cases (artifact download for instance) this is not the expected behavior.

This patch changes http_get and download methods to always get the raw data without parsing.

Closes #683

  • api: Avoid parameter conflicts with python and gitlab (4bd027a)

Provide another way to send data to gitlab with a new query_parameters argument. This parameter can be used to explicitly define the dict of items to send to the server, so that **kwargs are only used to specify python-gitlab specific parameters.

Closes #566 Closes #629

  • Remove decode() on error_message string (16bda20)

The integration tests failed because a test called ‘decode()’ on a string-type variable - the GitLabException class handles byte-to-string conversion already in its init. This commit removes the call to ‘decode()’ in the test.

Traceback (most recent call last):
  File "./tools/python_test_v4.py", line 801, in <module>
    assert 'Retry later' in error_message.decode()
AttributeError: 'str' object has no attribute 'decode'
  • Handle empty ‘Retry-After’ header from GitLab (7a3724f)

When requests are throttled (HTTP response code 429), python-gitlab assumed that ‘Retry-After’ existed in the response headers. This is not always the case and so the request fails due to a KeyError. The change in this commit adds a rudimentary exponential backoff to the ‘http_request’ method, which defaults to 10 retries but can be set to -1 to retry without bound.

  • api: Make reset_time_estimate() work again (cb388d6)

Closes #672

  • Enable use of YAML in the CLI (ad0b476)

In order to use the YAML output, PyYaml needs to be installed on the docker image. This commit adds the installation to the dockerfile as a separate layer.

  • Docker entry point argument passing (67ab637)

Fixes the problem of passing spaces in the arguments to the docker entrypoint.

Before this fix, there was virtually no way to pass spaces in arguments such as task description.

  • cli: Exit on config parse error, instead of crashing (6ad9da0)

  • Exit and hint user about possible errors * test: adjust test cases to config missing error

  • docker: Use docker image with current sources (06e8ca8)

  • cli: Print help and usage without config file (6bb4d17)

Fixes #560

Chores

  • Bump package version to 1.10.0 (c7c8470)

  • setup: Add 3.7 to supported python versions (b1525c9)

  • Move checks back to travis (b764525)

  • Disable failing travis test (515aa9a)

  • ci: Rebuild test image, when something changed (2fff260)

  • ci: Update the GitLab version in the test image (c410699)

  • ci: Add automatic GitLab image pushes (95c9b6d)

  • ci: Fix gitlab PyPI publish (3e37df1)

  • Add a tox job to run black (c27fa48)

Allow lines to be 88 chars long for flake8.

  • ci: Use reliable ci system (724a672)

  • ci: Don’t try to publish existing release (b4e818d)

  • Release tags to PyPI automatically (3133b48)

Fixes #609

  • tests: Add rate limit tests (e216f06)

Code Style

  • Format with black again (22b5082)

Documentation

  • snippets: Fix project-snippets layout (7feb97e)

Fixes #828

  • projects: Add mention about project listings (f604b25)

Having exactly 20 internal and 5 private projects in the group spent some time debugging this issue.

Hopefully that helped: https://github.com/python-gitlab/python-gitlab/issues/93

Imho should be definitely mention about all=True parameter.

six URL was pointing to 404

Pipelines and Jobs and Protected Branches are out of order in contents and sometimes hard to find when looking for examples.

  • Add pipeline deletion (2bb2571)

  • api-usage: Fix project group example (40a1bf3)

Fixes #798

  • Remove v3 support (7927663)

  • Add an example of trigger token usage (ea1eefe)

Closes #752

  • readme: Add more info about commitlint, code-format (286f703)

  • readme: Provide commit message guidelines (bed8e1b)

Fixes #660

  • setup: Use proper readme on PyPI (6898097)

  • projects: Fix typo in code sample (b93f2a9)

Fixes #630

Fixes #635

  • cli: Add PyYAML requirement notice (d29a489)

Fixes #606

  • readme: Add docs build information (6585c96)

  • Add MR approvals in index (0b45afb)

  • api-usage: Add rate limit documentation (ad4de20)

  • projects: Fix typo (c6bcfe6)

  • Trigger_pipeline only accept branches and tags as ref (d63748a)

Fixes #430

  • Fix invalid Raise attribute in docstrings (95a3fe6)

  • Add missing = (391417c)

  • Remove the build warning about _static (764d3ca)

  • Fix “required” attribute (e64d0b9)

  • Add missing requiredCreateAttrs (b08d74a)

  • Add a note for python 3.5 for file content update (ca014f8)

The data passed to the JSON serializer must be a string with python 3. Document this in the exemples.

Fix #175

Features

  • Add mr rebase method (bc4280c)

  • Get artifact by ref and job (cda1174)

  • Add support for issue.related_merge_requests (90a3631)

Closes #794

  • Add support for board update (908d79f)

Closes #801

  • Bump version to 1.9.0 (aaed448)

  • Implement artifacts deletion (76b6e1f)

Closes #744

  • Add endpoint to get the variables of a pipeline (564de48)

It adds a new endpoint which was released in the Gitlab CE 11.11.

Signed-off-by: Agustin Henze tin@redhat.com

  • GitLab Update: Delete ProjectPipeline (#736, 768ce19)

  • feat(GitLab Update): delete ProjectPipeline

As of Gitlab 11.6 it is now possible to delete a pipeline - https://docs.gitlab.com/ee/api/pipelines.html#delete-a-pipeline

  • Added approve & unapprove method for Mergerequests (53f7de7)

Offical GitLab API supports this for GitLab EE

done by using the retry-after header

Fixes #166

Refactoring

to MAINTAINER_ACCESS to follow GitLab 11.0 docs

See: https://docs.gitlab.com/ce/user/permissions.html#project-members-permissions

Testing

Fixes #762

  • Increase speed by disabling the rate limit faster (497f56c)

  • Always use latest version to test (82b0fc6)

  • Update the tests for GitLab 11.11 (622854f)

Changes in GitLab make the functional tests fail:

  • Some actions add new notes and discussions: do not use hardcoded values in related listing asserts

    • The feature flag API is buggy (errors 500): disable the tests for now