8000 Merge branch 'main' into fix-3032 · python-gitlab/python-gitlab@1134ce5 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1134ce5

Browse files
authored
Merge branch 'main' into fix-3032
2 parents 5971ca0 + e3cb806 commit 1134ce5

21 files changed

+579
-33
lines changed

CHANGELOG.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,28 @@
11
# CHANGELOG
22

33

4+
## v5.3.1 (2025-01-07)
5+
6+
### Bug Fixes
7+
8+
- **api**: Allow configuration of keep_base_url from file
9+
([`f4f7d7a`](https://github.com/python-gitlab/python-gitlab/commit/f4f7d7a63716f072eb45db2c7f590db0435350f0))
10+
11+
- **registry-protection**: Fix api url
12+
([`8c1aaa3`](https://github.com/python-gitlab/python-gitlab/commit/8c1aaa3f6a797caf7bd79a7da083eae56c6250ff))
13+
14+
See:
15+
https://docs.gitlab.com/ee/api/container_repository_protection_rules.html#list-container-repository-protection-rules
16+
17+
### Chores
18+
19+
- Bump to 5.3.1
20+
([`912e1a0`](https://github.com/python-gitlab/python-gitlab/commit/912e1a0620a96c56081ffec284c2cac871cb7626))
21+
22+
- **deps**: Update dependency jinja2 to v3.1.5 [security]
23+
([`01d4194`](https://github.com/python-gitlab/python-gitlab/commit/01d41946cbb1a4e5f29752eac89239d635c2ec6f))
24+
25+
426
## v5.3.0 (2024-12-28)
527

628
### Chores

docs/gl_objects/protected_container_repositories.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ References
1111

1212
+ :class:`gitlab.v4.objects.ProjectRegistryRepositoryProtectionRuleRule`
1313
+ :class:`gitlab.v4.objects.ProjectRegistryRepositoryProtectionRuleRuleManager`
14-
+ :attr:`gitlab.v4.objects.Project.registry_repository_protection_rules`
14+
+ :attr:`gitlab.v4.objects.Project.registry_protection_repository_rules`
1515

1616
* GitLab API: https://docs.gitlab.com/ee/api/container_repository_protection_rules.html
1717

@@ -20,11 +20,11 @@ Examples
2020

2121
List the container registry protection rules for a project::
2222

23-
registry_rules = project.registry_repository_protection_rules.list()
23+
registry_rules = project.registry_protection_repository_rules.list()
2424

2525
Create a container registry protection rule::
2626

27-
registry_rule = project.registry_repository_protection_rules.create(
27+
registry_rule = project.registry_protection_repository_rules.create(
2828
{
2929
'repository_path_pattern': 'test/image',
3030
'minimum_access_level_for_push': 'maintainer',
@@ -39,6 +39,6 @@ Update a container registry protection rule::
3939

4040
Delete a container registry protection rule::
4141

42-
registry_rule = project.registry_repository_protection_rules.delete(registry_rule.id)
42+
registry_rule = project.registry_protection_repository_rules.delete(registry_rule.id)
4343
# or
4444
registry_rule.delete()

gitlab/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
__email__ = "gauvainpocentek@gmail.com"
44
__license__ = "LGPL3"
55
__title__ = "python-gitlab"
6-
__version__ = "5.3.0"
6+
__version__ = "5.3.1"

gitlab/client.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,7 @@ def from_config(
303303
order_by=config.order_by,
304304
user_agent=config.user_agent,
305305
retry_transient_errors=config.retry_transient_errors,
306+
keep_base_url=config.keep_base_url,
306307
**kwargs,
307308
)
308309

gitlab/mixins.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
Dict,
77
Iterator,
88
List,
9+
Literal,
910
Optional,
11+
overload,
1012
Tuple,
1113
Type,
1214
TYPE_CHECKING,
@@ -612,6 +614,39 @@ class DownloadMixin(_RestObjectBase):
612614
_updated_attrs: Dict[str, Any]
613615
manager: base.RESTManager
614616

617+
@overload
618+
def download(
619+
self,
620+
streamed: Literal[False] = False,
621+
action: None = None,
622+
chunk_size: int = 1024,
623+
*,
624+
iterator: Literal[False] = False,
625+
**kwargs: Any,
626+
) -> bytes: ...
627+
628+
@overload
629+
def download(
630+
self,
631+
streamed: bool = False,
632+
action: None = None,
633+
chunk_size: int = 1024,
634+
*,
635+
iterator: Literal[True] = True,
636+
**kwargs: Any,
637+
) -> Iterator[Any]: ...
638+
639+
@overload
640+
def download(
641+
self,
642+
streamed: Literal[True] = True,
643+
action: Optional[Callable[[bytes], None]] = None,
644+
chunk_size: int = 1024,
645+
*,
646+
iterator: Literal[False] = False,
647+
**kwargs: Any,
648+
) -> None: ...
649+
615650
@cli.register_custom_action(cls_names=("GroupExport", "ProjectExport"))
616651
@exc.on_http_error(exc.GitlabGetError)
617652
def download(

gitlab/v4/objects/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@
5555
from .project_access_tokens import *
5656
from .projects import *
5757
from .push_rules import *
58+
from .registry_protection_repository_rules import *
5859
from .registry_protection_rules import *
59-
from .registry_repository_protection_rules import *
6060
from .releases import *
6161
from .repositories import *
6262
from .resource_groups import *

gitlab/v4/objects/artifacts.py

Lines changed: 91 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,16 @@
33
https://docs.gitlab.com/ee/api/job_artifacts.html
44
"""
55

6-
from typing import Any, Callable, Iterator, Optional, TYPE_CHECKING, Union
6+
from typing import (
7+
Any,
8+
Callable,
9+
Iterator,
10+
Literal,
11+
Optional,
12+
overload,
13+
TYPE_CHECKING,
14+
Union,
15+
)
716

817
import requests
918

@@ -43,6 +52,45 @@ def delete(self, **kwargs: Any) -> None:
4352
assert path is not None
4453
self.gitlab.http_delete(path, **kwargs)
4554

55+
@overload
56+
def download(
57+
self,
58+
ref_name: str,
59+
job: str,
60+
streamed: Literal[False] = False,
61+
action: None = None,
62+
chunk_size: int = 1024,
63+
*,
64+
iterator: Literal[False] = False,
65+
**kwargs: Any,
66+
) -> bytes: ...
67+
68+
@overload
69+
def download(
70+
self,
71+
ref_name: str,
72+
job: str,
73+
streamed: bool = False,
74+
action: None = None,
75+
chunk_size: int = 1024,
76+
*,
77+
iterator: Literal[True] = True,
78+
**kwargs: Any,
79+
) -> Iterator[Any]: ...
80+
81+
@overload
82+
def download(
83+
self,
84+
ref_name: str,
85+
job: str,
86+
streamed: Literal[True] = True,
87+
action: Optional[Callable[[bytes], None]] = None,
88+
chunk_size: int = 1024,
89+
*,
90+
iterator: Literal[False] = False,
91+
**kwargs: Any,
92+
) -> None: ...
93+
4694
@cli.register_custom_action(
4795
cls_names="ProjectArtifactManager",
4896
required=("ref_name", "job"),
@@ -94,6 +142,48 @@ def download(
94142
result, streamed, action, chunk_size, iterator=iterator
95143
)
96144

145+
@overload
146+
def raw(
147+
self,
148+
ref_name: str,
149+
artifact_path: str,
150+
job: str,
151+
streamed: Literal[False] = False,
152+
action: None = None,
153+
chunk_size: int = 1024,
154+
*,
155+
iterator: Literal[False] = False,
156+
**kwargs: Any,
157+
) -> bytes: ...
158+
159+
@overload
160+
def raw(
161+
self,
162+
ref_name: str,
163+
artifact_path: str,
164+
job: str,
165+
streamed: bool = False,
166+
action: None = None,
167+
chunk_size: int = 1024,
168+
*,
169+
iterator: Literal[True] = True,
170+
**kwargs: Any,
171+
) -> Iterator[Any]: ...
172+
173+
@overload
174+
def raw(
175+
self,
176+
ref_name: str,
177+
artifact_path: str,
178+
job: str,
179+
streamed: Literal[True] = True,
180+
action: Optional[Callable[[bytes], None]] = None,
181+
chunk_size: int = 1024,
182+
*,
183+
iterator: Literal[False] = False,
184+
**kwargs: Any,
185+
) -> None: ...
186+
97187
@cli.register_custom_action(
98188
cls_names="ProjectArtifactManager",
99189
required=("ref_name", "artifact_path", "job"),

gitlab/v4/objects/files.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def decode(self) -> bytes:
5151

5252
# NOTE(jlvillal): Signature doesn't match SaveMixin.save() so ignore
5353
# type error
54-
def save( # type: ignore
54+
def save( # type: ignore[override]
5555
self, branch: str, commit_message: str, **kwargs: Any
5656
) -> None:
5757
"""Save the changes made to the file to the server.
@@ -75,7 +75,7 @@ def save( # type: ignore
7575
@exc.on_http_error(exc.GitlabDeleteError)
7676
# NOTE(jlvillal): Signature doesn't match DeleteMixin.delete() so ignore
7777
# type error
78-
def delete( # type: ignore
78+
def delete( # type: ignore[override]
7979
self, branch: str, commit_message: str, **kwargs: Any
8080
) -> None:
8181
"""Delete the file from the server.
@@ -219,7 +219,7 @@ def create(
219219
@exc.on_http_error(exc.GitlabUpdateError)
220220
# NOTE(jlvillal): Signature doesn't match UpdateMixin.update() so ignore
221221
# type error
222-
def update( # type: ignore
222+
def update( # type: ignore[over CE0B ride]
223223
self, file_path: str, new_data: Optional[Dict[str, Any]] = None, **kwargs: Any
224224
) -> Dict[str, Any]:
225225
"""Update an object on the server.
@@ -254,7 +254,7 @@ def update( # type: ignore
254254
@exc.on_http_error(exc.GitlabDeleteError)
255255
# NOTE(jlvillal): Signature doesn't match DeleteMixin.delete() so ignore
256256
# type error
257-
def delete( # type: ignore
257+
def delete( # type: ignore[override]
258258
self, file_path: str, branch: str, commit_message: str, **kwargs: Any
259259
) -> None:
260260
"""Delete a file on the server.

gitlab/v4/objects/issues.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ class ProjectIssueLinkManager(ListMixin, CreateMixin, DeleteMixin, RESTManager):
302302
@exc.on_http_error(exc.GitlabCreateError)
303303
# NOTE(jlvillal): Signature doesn't match CreateMixin.create() so ignore
304304
# type error
305-
def create( # type: ignore
305+
def create( # type: ignore[override]
306306
self, data: Dict[str, Any], **kwargs: Any
307307
) -> Tuple[RESTObject, RESTObject]:
308308
"""Create a new object.

0 commit comments

Comments
 (0)
0