prefect-gitlab 0.3.4__tar.gz → 0.3.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {prefect_gitlab-0.3.4/prefect_gitlab.egg-info → prefect_gitlab-0.3.5}/PKG-INFO +2 -2
- prefect_gitlab-0.3.5/justfile +18 -0
- prefect_gitlab-0.3.5/prefect_gitlab/_version.py +24 -0
- {prefect_gitlab-0.3.4 → prefect_gitlab-0.3.5}/prefect_gitlab/repositories.py +15 -2
- {prefect_gitlab-0.3.4 → prefect_gitlab-0.3.5/prefect_gitlab.egg-info}/PKG-INFO +2 -2
- {prefect_gitlab-0.3.4 → prefect_gitlab-0.3.5}/prefect_gitlab.egg-info/SOURCES.txt +1 -0
- {prefect_gitlab-0.3.4 → prefect_gitlab-0.3.5}/prefect_gitlab.egg-info/requires.txt +1 -1
- {prefect_gitlab-0.3.4 → prefect_gitlab-0.3.5}/pyproject.toml +1 -1
- {prefect_gitlab-0.3.4 → prefect_gitlab-0.3.5}/tests/test_repositories.py +28 -0
- prefect_gitlab-0.3.4/prefect_gitlab/_version.py +0 -34
- {prefect_gitlab-0.3.4 → prefect_gitlab-0.3.5}/LICENSE +0 -0
- {prefect_gitlab-0.3.4 → prefect_gitlab-0.3.5}/MANIFEST.in +0 -0
- {prefect_gitlab-0.3.4 → prefect_gitlab-0.3.5}/README.md +0 -0
- {prefect_gitlab-0.3.4 → prefect_gitlab-0.3.5}/prefect_gitlab/__init__.py +0 -0
- {prefect_gitlab-0.3.4 → prefect_gitlab-0.3.5}/prefect_gitlab/credentials.py +0 -0
- {prefect_gitlab-0.3.4 → prefect_gitlab-0.3.5}/prefect_gitlab.egg-info/dependency_links.txt +0 -0
- {prefect_gitlab-0.3.4 → prefect_gitlab-0.3.5}/prefect_gitlab.egg-info/entry_points.txt +0 -0
- {prefect_gitlab-0.3.4 → prefect_gitlab-0.3.5}/prefect_gitlab.egg-info/top_level.txt +0 -0
- {prefect_gitlab-0.3.4 → prefect_gitlab-0.3.5}/setup.cfg +0 -0
- {prefect_gitlab-0.3.4 → prefect_gitlab-0.3.5}/tests/conftest.py +0 -0
- {prefect_gitlab-0.3.4 → prefect_gitlab-0.3.5}/tests/test_credentials.py +0 -0
- {prefect_gitlab-0.3.4 → prefect_gitlab-0.3.5}/tests/test_version.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: prefect-gitlab
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.5
|
|
4
4
|
Summary: A Prefect collection for working with GitLab repositories.
|
|
5
5
|
Author-email: "Prefect Technologies, Inc." <help@prefect.io>
|
|
6
6
|
License: Apache License 2.0
|
|
@@ -19,7 +19,7 @@ Classifier: Topic :: Software Development :: Libraries
|
|
|
19
19
|
Requires-Python: >=3.10
|
|
20
20
|
Description-Content-Type: text/markdown
|
|
21
21
|
License-File: LICENSE
|
|
22
|
-
Requires-Dist: prefect>=3.
|
|
22
|
+
Requires-Dist: prefect>=3.7.4
|
|
23
23
|
Requires-Dist: python-gitlab>=3.12.0
|
|
24
24
|
Requires-Dist: tenacity>=8.2.3
|
|
25
25
|
Dynamic: license-file
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
test:
|
|
2
|
+
uv run pytest
|
|
3
|
+
|
|
4
|
+
# Generate API reference documentation for prefect-gitlab
|
|
5
|
+
api-ref:
|
|
6
|
+
#!/usr/bin/env bash
|
|
7
|
+
REPO_ROOT="$(git rev-parse --show-toplevel)"
|
|
8
|
+
cd "$REPO_ROOT"
|
|
9
|
+
uvx --with-editable ./src/integrations/prefect-gitlab \
|
|
10
|
+
--python 3.12 \
|
|
11
|
+
--isolated \
|
|
12
|
+
mdxify \
|
|
13
|
+
--all \
|
|
14
|
+
--root-module prefect_gitlab \
|
|
15
|
+
--output-dir docs/integrations/prefect-gitlab/api-ref \
|
|
16
|
+
--anchor-name "prefect-gitlab-sdk-reference" \
|
|
17
|
+
--repo-url https://github.com/PrefectHQ/prefect \
|
|
18
|
+
--include-inheritance
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# file generated by vcs-versioning
|
|
2
|
+
# don't change, don't track in version control
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
__all__ = [
|
|
6
|
+
"__version__",
|
|
7
|
+
"__version_tuple__",
|
|
8
|
+
"version",
|
|
9
|
+
"version_tuple",
|
|
10
|
+
"__commit_id__",
|
|
11
|
+
"commit_id",
|
|
12
|
+
]
|
|
13
|
+
|
|
14
|
+
version: str
|
|
15
|
+
__version__: str
|
|
16
|
+
__version_tuple__: tuple[int | str, ...]
|
|
17
|
+
version_tuple: tuple[int | str, ...]
|
|
18
|
+
commit_id: str | None
|
|
19
|
+
__commit_id__: str | None
|
|
20
|
+
|
|
21
|
+
__version__ = version = '0.3.5'
|
|
22
|
+
__version_tuple__ = version_tuple = (0, 3, 5)
|
|
23
|
+
|
|
24
|
+
__commit_id__ = commit_id = 'g7d7cd722b'
|
|
@@ -53,6 +53,7 @@ from pydantic import Field
|
|
|
53
53
|
from tenacity import retry, stop_after_attempt, wait_fixed, wait_random
|
|
54
54
|
|
|
55
55
|
from prefect._internal.compatibility.async_dispatch import async_dispatch
|
|
56
|
+
from prefect._internal.urls import strip_auth_from_urls_in_text
|
|
56
57
|
from prefect.filesystems import ReadableDeploymentStorage
|
|
57
58
|
from prefect.utilities.processutils import run_process
|
|
58
59
|
from prefect_gitlab.credentials import GitLabCredentials
|
|
@@ -116,6 +117,12 @@ class GitLabRepository(ReadableDeploymentStorage):
|
|
|
116
117
|
|
|
117
118
|
return full_url
|
|
118
119
|
|
|
120
|
+
def _git_error_extra_secrets(self) -> list[str]:
|
|
121
|
+
if self.credentials is None:
|
|
122
|
+
return []
|
|
123
|
+
token = self.credentials.token.get_secret_value()
|
|
124
|
+
return [token, f"oauth2:{token}"]
|
|
125
|
+
|
|
119
126
|
@staticmethod
|
|
120
127
|
def _get_paths(
|
|
121
128
|
dst_dir: Union[str, None], src_dir: str, sub_directory: Optional[str]
|
|
@@ -176,7 +183,10 @@ class GitLabRepository(ReadableDeploymentStorage):
|
|
|
176
183
|
process = await run_process(cmd, stream_output=(out_stream, err_stream))
|
|
177
184
|
if process.returncode != 0:
|
|
178
185
|
err_stream.seek(0)
|
|
179
|
-
|
|
186
|
+
sanitized_error = strip_auth_from_urls_in_text(
|
|
187
|
+
err_stream.read(), extra_secrets=self._git_error_extra_secrets()
|
|
188
|
+
)
|
|
189
|
+
raise OSError(f"Failed to pull from remote:\n {sanitized_error}")
|
|
180
190
|
|
|
181
191
|
content_source, content_destination = self._get_paths(
|
|
182
192
|
dst_dir=local_path, src_dir=tmp_dir, sub_directory=from_path
|
|
@@ -221,7 +231,10 @@ class GitLabRepository(ReadableDeploymentStorage):
|
|
|
221
231
|
|
|
222
232
|
result = subprocess.run(cmd, capture_output=True, text=True)
|
|
223
233
|
if result.returncode != 0:
|
|
224
|
-
|
|
234
|
+
sanitized_error = strip_auth_from_urls_in_text(
|
|
235
|
+
result.stderr, extra_secrets=self._git_error_extra_secrets()
|
|
236
|
+
)
|
|
237
|
+
raise OSError(f"Failed to pull from remote:\n {sanitized_error}")
|
|
225
238
|
|
|
226
239
|
content_source, content_destination = self._get_paths(
|
|
227
240
|
dst_dir=local_path, src_dir=tmp_dir, sub_directory=from_path
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: prefect-gitlab
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.5
|
|
4
4
|
Summary: A Prefect collection for working with GitLab repositories.
|
|
5
5
|
Author-email: "Prefect Technologies, Inc." <help@prefect.io>
|
|
6
6
|
License: Apache License 2.0
|
|
@@ -19,7 +19,7 @@ Classifier: Topic :: Software Development :: Libraries
|
|
|
19
19
|
Requires-Python: >=3.10
|
|
20
20
|
Description-Content-Type: text/markdown
|
|
21
21
|
License-File: LICENSE
|
|
22
|
-
Requires-Dist: prefect>=3.
|
|
22
|
+
Requires-Dist: prefect>=3.7.4
|
|
23
23
|
Requires-Dist: python-gitlab>=3.12.0
|
|
24
24
|
Requires-Dist: tenacity>=8.2.3
|
|
25
25
|
Dynamic: license-file
|
|
@@ -22,7 +22,7 @@ classifiers = [
|
|
|
22
22
|
"Programming Language :: Python :: 3.13",
|
|
23
23
|
"Topic :: Software Development :: Libraries",
|
|
24
24
|
]
|
|
25
|
-
dependencies = ["prefect>=3.
|
|
25
|
+
dependencies = ["prefect>=3.7.4", "python-gitlab>=3.12.0", "tenacity>=8.2.3"]
|
|
26
26
|
dynamic = ["version"]
|
|
27
27
|
|
|
28
28
|
[dependency-groups]
|
|
@@ -139,6 +139,34 @@ class TestGitLab:
|
|
|
139
139
|
]
|
|
140
140
|
assert mock.await_args[0][0][: len(expected_cmd)] == expected_cmd
|
|
141
141
|
|
|
142
|
+
async def test_get_directory_redacts_token_in_clone_error(self, monkeypatch):
|
|
143
|
+
class p:
|
|
144
|
+
returncode = 1
|
|
145
|
+
|
|
146
|
+
async def mock(cmd, stream_output=None, **kwargs):
|
|
147
|
+
if stream_output:
|
|
148
|
+
_, err_stream = stream_output
|
|
149
|
+
err_stream.write(
|
|
150
|
+
"fatal: Authentication failed for "
|
|
151
|
+
"'https://oauth2:p@ss:word#1@gitlab.com/PrefectHQ/prefect.git/'"
|
|
152
|
+
"\nremote: token p@ss:word#1 rejected"
|
|
153
|
+
)
|
|
154
|
+
return p()
|
|
155
|
+
|
|
156
|
+
monkeypatch.setattr(prefect_gitlab.repositories, "run_process", mock)
|
|
157
|
+
|
|
158
|
+
g = GitLabRepository(
|
|
159
|
+
repository="https://gitlab.com/PrefectHQ/prefect.git",
|
|
160
|
+
credentials=GitLabCredentials(token=SecretStr("p@ss:word#1")),
|
|
161
|
+
)
|
|
162
|
+
|
|
163
|
+
with pytest.raises(OSError) as exc_info:
|
|
164
|
+
await g.get_directory()
|
|
165
|
+
|
|
166
|
+
message = str(exc_info.value)
|
|
167
|
+
assert "p@ss:word#1" not in message
|
|
168
|
+
assert "https://gitlab.com/PrefectHQ/prefect.git/" in message
|
|
169
|
+
|
|
142
170
|
async def test_cloning_with_custom_depth(self, monkeypatch):
|
|
143
171
|
"""Ensure that we can retrieve the whole history, i.e. support true git clone""" # noqa: E501
|
|
144
172
|
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
# file generated by setuptools-scm
|
|
2
|
-
# don't change, don't track in version control
|
|
3
|
-
|
|
4
|
-
__all__ = [
|
|
5
|
-
"__version__",
|
|
6
|
-
"__version_tuple__",
|
|
7
|
-
"version",
|
|
8
|
-
"version_tuple",
|
|
9
|
-
"__commit_id__",
|
|
10
|
-
"commit_id",
|
|
11
|
-
]
|
|
12
|
-
|
|
13
|
-
TYPE_CHECKING = False
|
|
14
|
-
if TYPE_CHECKING:
|
|
15
|
-
from typing import Tuple
|
|
16
|
-
from typing import Union
|
|
17
|
-
|
|
18
|
-
VERSION_TUPLE = Tuple[Union[int, str], ...]
|
|
19
|
-
COMMIT_ID = Union[str, None]
|
|
20
|
-
else:
|
|
21
|
-
VERSION_TUPLE = object
|
|
22
|
-
COMMIT_ID = object
|
|
23
|
-
|
|
24
|
-
version: str
|
|
25
|
-
__version__: str
|
|
26
|
-
__version_tuple__: VERSION_TUPLE
|
|
27
|
-
version_tuple: VERSION_TUPLE
|
|
28
|
-
commit_id: COMMIT_ID
|
|
29
|
-
__commit_id__: COMMIT_ID
|
|
30
|
-
|
|
31
|
-
__version__ = version = '0.3.4'
|
|
32
|
-
__version_tuple__ = version_tuple = (0, 3, 4)
|
|
33
|
-
|
|
34
|
-
__commit_id__ = commit_id = 'gee531648b'
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|