prefect-gitlab 0.2.2__tar.gz → 0.2.3__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.
Files changed (26) hide show
  1. {prefect-gitlab-0.2.2/prefect_gitlab.egg-info → prefect_gitlab-0.2.3}/PKG-INFO +27 -60
  2. {prefect-gitlab-0.2.2 → prefect_gitlab-0.2.3}/README.md +11 -42
  3. {prefect-gitlab-0.2.2 → prefect_gitlab-0.2.3}/prefect_gitlab/__init__.py +1 -1
  4. prefect_gitlab-0.2.3/prefect_gitlab/_version.py +16 -0
  5. {prefect-gitlab-0.2.2 → prefect_gitlab-0.2.3}/prefect_gitlab/credentials.py +2 -1
  6. {prefect-gitlab-0.2.2 → prefect_gitlab-0.2.3}/prefect_gitlab/repositories.py +11 -3
  7. {prefect-gitlab-0.2.2 → prefect_gitlab-0.2.3/prefect_gitlab.egg-info}/PKG-INFO +27 -60
  8. {prefect-gitlab-0.2.2 → prefect_gitlab-0.2.3}/prefect_gitlab.egg-info/SOURCES.txt +4 -8
  9. {prefect-gitlab-0.2.2 → prefect_gitlab-0.2.3}/prefect_gitlab.egg-info/requires.txt +9 -10
  10. prefect_gitlab-0.2.3/pyproject.toml +81 -0
  11. prefect_gitlab-0.2.3/setup.cfg +4 -0
  12. prefect_gitlab-0.2.3/tests/conftest.py +23 -0
  13. {prefect-gitlab-0.2.2 → prefect_gitlab-0.2.3}/tests/test_repositories.py +26 -4
  14. prefect_gitlab-0.2.3/tests/test_version.py +9 -0
  15. prefect-gitlab-0.2.2/LICENSE +0 -202
  16. prefect-gitlab-0.2.2/MANIFEST.in +0 -14
  17. prefect-gitlab-0.2.2/prefect_gitlab/_version.py +0 -21
  18. prefect-gitlab-0.2.2/requirements-dev.txt +0 -15
  19. prefect-gitlab-0.2.2/requirements.txt +0 -3
  20. prefect-gitlab-0.2.2/setup.cfg +0 -43
  21. prefect-gitlab-0.2.2/setup.py +0 -47
  22. prefect-gitlab-0.2.2/versioneer.py +0 -2163
  23. {prefect-gitlab-0.2.2 → prefect_gitlab-0.2.3}/prefect_gitlab.egg-info/dependency_links.txt +0 -0
  24. {prefect-gitlab-0.2.2 → prefect_gitlab-0.2.3}/prefect_gitlab.egg-info/entry_points.txt +0 -0
  25. {prefect-gitlab-0.2.2 → prefect_gitlab-0.2.3}/prefect_gitlab.egg-info/top_level.txt +0 -0
  26. {prefect-gitlab-0.2.2 → prefect_gitlab-0.2.3}/tests/test_credentials.py +0 -0
@@ -1,59 +1,50 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: prefect-gitlab
3
- Version: 0.2.2
3
+ Version: 0.2.3
4
4
  Summary: A Prefect collection for working with GitLab repositories.
5
- Home-page: https://github.com/prefecthq/prefect-gitlab
6
- Author: Prefect Technologies, Inc.
7
- Author-email: help@prefect.io
5
+ Author-email: "Prefect Technologies, Inc." <help@prefect.io>
8
6
  License: Apache License 2.0
7
+ Project-URL: Homepage, https://github.com/PrefectHQ/prefect/tree/main/src/integrations/prefect-gitlab
9
8
  Keywords: prefect
10
9
  Classifier: Natural Language :: English
11
10
  Classifier: Intended Audience :: Developers
12
11
  Classifier: Intended Audience :: System Administrators
13
12
  Classifier: License :: OSI Approved :: Apache Software License
14
13
  Classifier: Programming Language :: Python :: 3 :: Only
15
- Classifier: Programming Language :: Python :: 3.7
16
14
  Classifier: Programming Language :: Python :: 3.8
17
15
  Classifier: Programming Language :: Python :: 3.9
18
16
  Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
19
  Classifier: Topic :: Software Development :: Libraries
20
- Requires-Python: >=3.7
20
+ Requires-Python: >=3.8
21
21
  Description-Content-Type: text/markdown
22
- License-File: LICENSE
23
22
  Requires-Dist: prefect>=2.13.5
24
23
  Requires-Dist: python-gitlab>=3.12.0
25
24
  Requires-Dist: tenacity>=8.2.3
26
25
  Provides-Extra: dev
27
- Requires-Dist: pytest; extra == "dev"
28
- Requires-Dist: black; extra == "dev"
29
- Requires-Dist: flake8; extra == "dev"
30
- Requires-Dist: mypy; extra == "dev"
31
- Requires-Dist: mkdocs; extra == "dev"
26
+ Requires-Dist: aiohttp; extra == "dev"
27
+ Requires-Dist: coverage; extra == "dev"
28
+ Requires-Dist: interrogate; extra == "dev"
29
+ Requires-Dist: mkdocs-gen-files; extra == "dev"
32
30
  Requires-Dist: mkdocs-material; extra == "dev"
31
+ Requires-Dist: mkdocs; extra == "dev"
33
32
  Requires-Dist: mkdocstrings[python]; extra == "dev"
34
- Requires-Dist: isort; extra == "dev"
35
- Requires-Dist: pre-commit; extra == "dev"
36
- Requires-Dist: pytest-asyncio; extra == "dev"
37
33
  Requires-Dist: mock; python_version < "3.8" and extra == "dev"
38
- Requires-Dist: mkdocs-gen-files; extra == "dev"
39
- Requires-Dist: interrogate; extra == "dev"
40
- Requires-Dist: coverage; extra == "dev"
34
+ Requires-Dist: mypy; extra == "dev"
41
35
  Requires-Dist: pillow; extra == "dev"
36
+ Requires-Dist: pre-commit; extra == "dev"
37
+ Requires-Dist: pytest-asyncio; extra == "dev"
38
+ Requires-Dist: pytest; extra == "dev"
39
+ Requires-Dist: pytest-xdist; extra == "dev"
42
40
 
43
41
  # prefect-gitlab
44
42
 
45
43
  <p align="center">
46
44
  <a href="https://pypi.python.org/pypi/prefect-gitlab/" alt="PyPI version">
47
45
  <img alt="PyPI" src="https://img.shields.io/pypi/v/prefect-gitlab?color=26272B&labelColor=090422"></a>
48
- <a href="https://github.com/prefecthq/prefect-gitlab/" alt="Stars">
49
- <img src="https://img.shields.io/github/stars/prefecthq/prefect-gitlab?color=26272B&labelColor=090422" /></a>
50
46
  <a href="https://pepy.tech/badge/prefect-gitlab/" alt="Downloads">
51
47
  <img src="https://img.shields.io/pypi/dm/prefect-gitlab?color=26272B&labelColor=090422" /></a>
52
- <a href="https://github.com/prefecthq/prefect-gitlab/pulse" alt="Activity">
53
- <img src="https://img.shields.io/github/commit-activity/m/prefecthq/prefect-gitlab?color=26272B&labelColor=090422" /></a>
54
- <br>
55
- <a href="https://prefect-community.slack.com" alt="Slack">
56
- <img src="https://img.shields.io/badge/slack-join_community-red.svg?color=26272B&labelColor=090422&logo=slack" /></a>
57
48
  </p>
58
49
 
59
50
  ## Welcome!
@@ -105,13 +96,23 @@ public_gitlab_block.save()
105
96
  # specific branch or tag of a GitLab repository
106
97
  branch_gitlab_block = GitLabRepository(
107
98
  name="my-gitlab-block",
108
- reference="branch-or-tag-name"
99
+ reference="branch-or-tag-name",
109
100
  repository="https://gitlab.com/testing/my-repository.git"
110
101
  )
111
102
 
112
103
  branch_gitlab_block.save()
113
104
 
114
105
 
106
+ # Get all history of a specific branch or tag of a GitLab repository
107
+ branch_gitlab_block = GitLabRepository(
108
+ name="my-gitlab-block",
109
+ reference="branch-or-tag-name",
110
+ git_depth=None,
111
+ repository="https://gitlab.com/testing/my-repository.git"
112
+ )
113
+
114
+ branch_gitlab_block.save()
115
+
115
116
  # private GitLab repository
116
117
  private_gitlab_block = GitLabRepository(
117
118
  name="my-private-gitlab-block",
@@ -121,37 +122,3 @@ private_gitlab_block = GitLabRepository(
121
122
 
122
123
  private_gitlab_block.save()
123
124
  ```
124
-
125
- ### In the UI
126
- Click on the **Blocks** menu, then click the **+** button in the page header to open the block catalog:
127
- ![blocks menu](https://github.com/PrefectHQ/prefect-gitlab/blob/main/docs/img/blocks-menu.png?raw=true)
128
-
129
- Then, find the **GitLab** block and click the **Add** button:
130
- ![GitLab block catalog entry](https://github.com/PrefectHQ/prefect-gitlab/blob/main/docs/img/gitlab-blocks.png?raw=true)
131
-
132
-
133
- Finally, enter your repository information in the form and click **Create**:
134
- ![GitLab repository information form](https://github.com/PrefectHQ/prefect-gitlab/blob/main/docs/img/create-gitlab-repository.png?raw=true)
135
-
136
- ## Resources
137
-
138
- If you encounter any bugs while using `prefect-gitlab`, feel free to open an issue in the [prefect-gitlab](https://github.com/prefecthq/prefect-gitlab) repository.
139
-
140
- If you have any questions or issues while using `prefect-gitlab`, you can find help in the [Prefect Slack community](https://prefect.io/slack).
141
-
142
- Feel free to ⭐️ or watch [`prefect-gitlab`](https://github.com/prefecthq/prefect-gitlab) for updates!
143
-
144
- ## Development
145
-
146
- If you'd like to install a version of `prefect-gitlab` for development, clone the repository and perform an editable install with `pip`:
147
-
148
- ```bash
149
- git clone https://github.com/prefecthq/prefect-gitlab.git
150
-
151
- cd prefect-gitlab/
152
-
153
- pip install -e ".[dev]"
154
-
155
- # Install linting pre-commit hooks
156
- pre-commit install
157
- ```
@@ -3,15 +3,8 @@
3
3
  <p align="center">
4
4
  <a href="https://pypi.python.org/pypi/prefect-gitlab/" alt="PyPI version">
5
5
  <img alt="PyPI" src="https://img.shields.io/pypi/v/prefect-gitlab?color=26272B&labelColor=090422"></a>
6
- <a href="https://github.com/prefecthq/prefect-gitlab/" alt="Stars">
7
- <img src="https://img.shields.io/github/stars/prefecthq/prefect-gitlab?color=26272B&labelColor=090422" /></a>
8
6
  <a href="https://pepy.tech/badge/prefect-gitlab/" alt="Downloads">
9
7
  <img src="https://img.shields.io/pypi/dm/prefect-gitlab?color=26272B&labelColor=090422" /></a>
10
- <a href="https://github.com/prefecthq/prefect-gitlab/pulse" alt="Activity">
11
- <img src="https://img.shields.io/github/commit-activity/m/prefecthq/prefect-gitlab?color=26272B&labelColor=090422" /></a>
12
- <br>
13
- <a href="https://prefect-community.slack.com" alt="Slack">
14
- <img src="https://img.shields.io/badge/slack-join_community-red.svg?color=26272B&labelColor=090422&logo=slack" /></a>
15
8
  </p>
16
9
 
17
10
  ## Welcome!
@@ -63,13 +56,23 @@ public_gitlab_block.save()
63
56
  # specific branch or tag of a GitLab repository
64
57
  branch_gitlab_block = GitLabRepository(
65
58
  name="my-gitlab-block",
66
- reference="branch-or-tag-name"
59
+ reference="branch-or-tag-name",
67
60
  repository="https://gitlab.com/testing/my-repository.git"
68
61
  )
69
62
 
70
63
  branch_gitlab_block.save()
71
64
 
72
65
 
66
+ # Get all history of a specific branch or tag of a GitLab repository
67
+ branch_gitlab_block = GitLabRepository(
68
+ name="my-gitlab-block",
69
+ reference="branch-or-tag-name",
70
+ git_depth=None,
71
+ repository="https://gitlab.com/testing/my-repository.git"
72
+ )
73
+
74
+ branch_gitlab_block.save()
75
+
73
76
  # private GitLab repository
74
77
  private_gitlab_block = GitLabRepository(
75
78
  name="my-private-gitlab-block",
@@ -79,37 +82,3 @@ private_gitlab_block = GitLabRepository(
79
82
 
80
83
  private_gitlab_block.save()
81
84
  ```
82
-
83
- ### In the UI
84
- Click on the **Blocks** menu, then click the **+** button in the page header to open the block catalog:
85
- ![blocks menu](https://github.com/PrefectHQ/prefect-gitlab/blob/main/docs/img/blocks-menu.png?raw=true)
86
-
87
- Then, find the **GitLab** block and click the **Add** button:
88
- ![GitLab block catalog entry](https://github.com/PrefectHQ/prefect-gitlab/blob/main/docs/img/gitlab-blocks.png?raw=true)
89
-
90
-
91
- Finally, enter your repository information in the form and click **Create**:
92
- ![GitLab repository information form](https://github.com/PrefectHQ/prefect-gitlab/blob/main/docs/img/create-gitlab-repository.png?raw=true)
93
-
94
- ## Resources
95
-
96
- If you encounter any bugs while using `prefect-gitlab`, feel free to open an issue in the [prefect-gitlab](https://github.com/prefecthq/prefect-gitlab) repository.
97
-
98
- If you have any questions or issues while using `prefect-gitlab`, you can find help in the [Prefect Slack community](https://prefect.io/slack).
99
-
100
- Feel free to ⭐️ or watch [`prefect-gitlab`](https://github.com/prefecthq/prefect-gitlab) for updates!
101
-
102
- ## Development
103
-
104
- If you'd like to install a version of `prefect-gitlab` for development, clone the repository and perform an editable install with `pip`:
105
-
106
- ```bash
107
- git clone https://github.com/prefecthq/prefect-gitlab.git
108
-
109
- cd prefect-gitlab/
110
-
111
- pip install -e ".[dev]"
112
-
113
- # Install linting pre-commit hooks
114
- pre-commit install
115
- ```
@@ -2,5 +2,5 @@ from . import _version
2
2
  from .credentials import GitLabCredentials
3
3
  from .repositories import GitLabRepository
4
4
 
5
- __version__ = _version.get_versions()["version"]
5
+ __version__ = _version.__version__
6
6
  __all__ = ["GitLabRepository", "GitLabCredentials"]
@@ -0,0 +1,16 @@
1
+ # file generated by setuptools_scm
2
+ # don't change, don't track in version control
3
+ TYPE_CHECKING = False
4
+ if TYPE_CHECKING:
5
+ from typing import Tuple, Union
6
+ VERSION_TUPLE = Tuple[Union[int, str], ...]
7
+ else:
8
+ VERSION_TUPLE = object
9
+
10
+ version: str
11
+ __version__: str
12
+ __version_tuple__: VERSION_TUPLE
13
+ version_tuple: VERSION_TUPLE
14
+
15
+ __version__ = version = '0.2.3'
16
+ __version_tuple__ = version_tuple = (0, 2, 3)
@@ -1,9 +1,10 @@
1
1
  """Module used to enable authenticated interactions with GitLab"""
2
2
 
3
3
  from gitlab import Gitlab
4
- from prefect.blocks.core import Block
5
4
  from pydantic import VERSION as PYDANTIC_VERSION
6
5
 
6
+ from prefect.blocks.core import Block
7
+
7
8
  if PYDANTIC_VERSION.startswith("2."):
8
9
  from pydantic.v1 import Field, HttpUrl, SecretStr
9
10
  else:
@@ -47,12 +47,13 @@ from pathlib import Path
47
47
  from tempfile import TemporaryDirectory
48
48
  from typing import Optional, Tuple, Union
49
49
 
50
+ from pydantic import VERSION as PYDANTIC_VERSION
51
+ from tenacity import retry, stop_after_attempt, wait_fixed, wait_random
52
+
50
53
  from prefect.exceptions import InvalidRepositoryURLError
51
54
  from prefect.filesystems import ReadableDeploymentStorage
52
55
  from prefect.utilities.asyncutils import sync_compatible
53
56
  from prefect.utilities.processutils import run_process
54
- from pydantic import VERSION as PYDANTIC_VERSION
55
- from tenacity import retry, stop_after_attempt, wait_fixed, wait_random
56
57
 
57
58
  if PYDANTIC_VERSION.startswith("2."):
58
59
  from pydantic.v1 import Field, HttpUrl, validator
@@ -94,6 +95,12 @@ class GitLabRepository(ReadableDeploymentStorage):
94
95
  default=None,
95
96
  description="An optional reference to pin to; can be a branch name or tag.",
96
97
  )
98
+ git_depth: Optional[int] = Field(
99
+ default=1,
100
+ gte=1,
101
+ description="The number of commits that Git history is truncated to "
102
+ "during cloning. Set to None to fetch the entire history.",
103
+ )
97
104
  credentials: Optional[GitLabCredentials] = Field(
98
105
  default=None,
99
106
  description="An optional GitLab Credentials block for authenticating with "
@@ -188,7 +195,8 @@ class GitLabRepository(ReadableDeploymentStorage):
188
195
  cmd += ["-b", self.reference]
189
196
 
190
197
  # Limit git history
191
- cmd += ["--depth", "1"]
198
+ if self.git_depth is not None:
199
+ cmd += ["--depth", f"{self.git_depth}"]
192
200
 
193
201
  # Clone to a temporary directory and move the subdirectory over
194
202
  with TemporaryDirectory(suffix="prefect") as tmp_dir:
@@ -1,59 +1,50 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: prefect-gitlab
3
- Version: 0.2.2
3
+ Version: 0.2.3
4
4
  Summary: A Prefect collection for working with GitLab repositories.
5
- Home-page: https://github.com/prefecthq/prefect-gitlab
6
- Author: Prefect Technologies, Inc.
7
- Author-email: help@prefect.io
5
+ Author-email: "Prefect Technologies, Inc." <help@prefect.io>
8
6
  License: Apache License 2.0
7
+ Project-URL: Homepage, https://github.com/PrefectHQ/prefect/tree/main/src/integrations/prefect-gitlab
9
8
  Keywords: prefect
10
9
  Classifier: Natural Language :: English
11
10
  Classifier: Intended Audience :: Developers
12
11
  Classifier: Intended Audience :: System Administrators
13
12
  Classifier: License :: OSI Approved :: Apache Software License
14
13
  Classifier: Programming Language :: Python :: 3 :: Only
15
- Classifier: Programming Language :: Python :: 3.7
16
14
  Classifier: Programming Language :: Python :: 3.8
17
15
  Classifier: Programming Language :: Python :: 3.9
18
16
  Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
19
  Classifier: Topic :: Software Development :: Libraries
20
- Requires-Python: >=3.7
20
+ Requires-Python: >=3.8
21
21
  Description-Content-Type: text/markdown
22
- License-File: LICENSE
23
22
  Requires-Dist: prefect>=2.13.5
24
23
  Requires-Dist: python-gitlab>=3.12.0
25
24
  Requires-Dist: tenacity>=8.2.3
26
25
  Provides-Extra: dev
27
- Requires-Dist: pytest; extra == "dev"
28
- Requires-Dist: black; extra == "dev"
29
- Requires-Dist: flake8; extra == "dev"
30
- Requires-Dist: mypy; extra == "dev"
31
- Requires-Dist: mkdocs; extra == "dev"
26
+ Requires-Dist: aiohttp; extra == "dev"
27
+ Requires-Dist: coverage; extra == "dev"
28
+ Requires-Dist: interrogate; extra == "dev"
29
+ Requires-Dist: mkdocs-gen-files; extra == "dev"
32
30
  Requires-Dist: mkdocs-material; extra == "dev"
31
+ Requires-Dist: mkdocs; extra == "dev"
33
32
  Requires-Dist: mkdocstrings[python]; extra == "dev"
34
- Requires-Dist: isort; extra == "dev"
35
- Requires-Dist: pre-commit; extra == "dev"
36
- Requires-Dist: pytest-asyncio; extra == "dev"
37
33
  Requires-Dist: mock; python_version < "3.8" and extra == "dev"
38
- Requires-Dist: mkdocs-gen-files; extra == "dev"
39
- Requires-Dist: interrogate; extra == "dev"
40
- Requires-Dist: coverage; extra == "dev"
34
+ Requires-Dist: mypy; extra == "dev"
41
35
  Requires-Dist: pillow; extra == "dev"
36
+ Requires-Dist: pre-commit; extra == "dev"
37
+ Requires-Dist: pytest-asyncio; extra == "dev"
38
+ Requires-Dist: pytest; extra == "dev"
39
+ Requires-Dist: pytest-xdist; extra == "dev"
42
40
 
43
41
  # prefect-gitlab
44
42
 
45
43
  <p align="center">
46
44
  <a href="https://pypi.python.org/pypi/prefect-gitlab/" alt="PyPI version">
47
45
  <img alt="PyPI" src="https://img.shields.io/pypi/v/prefect-gitlab?color=26272B&labelColor=090422"></a>
48
- <a href="https://github.com/prefecthq/prefect-gitlab/" alt="Stars">
49
- <img src="https://img.shields.io/github/stars/prefecthq/prefect-gitlab?color=26272B&labelColor=090422" /></a>
50
46
  <a href="https://pepy.tech/badge/prefect-gitlab/" alt="Downloads">
51
47
  <img src="https://img.shields.io/pypi/dm/prefect-gitlab?color=26272B&labelColor=090422" /></a>
52
- <a href="https://github.com/prefecthq/prefect-gitlab/pulse" alt="Activity">
53
- <img src="https://img.shields.io/github/commit-activity/m/prefecthq/prefect-gitlab?color=26272B&labelColor=090422" /></a>
54
- <br>
55
- <a href="https://prefect-community.slack.com" alt="Slack">
56
- <img src="https://img.shields.io/badge/slack-join_community-red.svg?color=26272B&labelColor=090422&logo=slack" /></a>
57
48
  </p>
58
49
 
59
50
  ## Welcome!
@@ -105,13 +96,23 @@ public_gitlab_block.save()
105
96
  # specific branch or tag of a GitLab repository
106
97
  branch_gitlab_block = GitLabRepository(
107
98
  name="my-gitlab-block",
108
- reference="branch-or-tag-name"
99
+ reference="branch-or-tag-name",
109
100
  repository="https://gitlab.com/testing/my-repository.git"
110
101
  )
111
102
 
112
103
  branch_gitlab_block.save()
113
104
 
114
105
 
106
+ # Get all history of a specific branch or tag of a GitLab repository
107
+ branch_gitlab_block = GitLabRepository(
108
+ name="my-gitlab-block",
109
+ reference="branch-or-tag-name",
110
+ git_depth=None,
111
+ repository="https://gitlab.com/testing/my-repository.git"
112
+ )
113
+
114
+ branch_gitlab_block.save()
115
+
115
116
  # private GitLab repository
116
117
  private_gitlab_block = GitLabRepository(
117
118
  name="my-private-gitlab-block",
@@ -121,37 +122,3 @@ private_gitlab_block = GitLabRepository(
121
122
 
122
123
  private_gitlab_block.save()
123
124
  ```
124
-
125
- ### In the UI
126
- Click on the **Blocks** menu, then click the **+** button in the page header to open the block catalog:
127
- ![blocks menu](https://github.com/PrefectHQ/prefect-gitlab/blob/main/docs/img/blocks-menu.png?raw=true)
128
-
129
- Then, find the **GitLab** block and click the **Add** button:
130
- ![GitLab block catalog entry](https://github.com/PrefectHQ/prefect-gitlab/blob/main/docs/img/gitlab-blocks.png?raw=true)
131
-
132
-
133
- Finally, enter your repository information in the form and click **Create**:
134
- ![GitLab repository information form](https://github.com/PrefectHQ/prefect-gitlab/blob/main/docs/img/create-gitlab-repository.png?raw=true)
135
-
136
- ## Resources
137
-
138
- If you encounter any bugs while using `prefect-gitlab`, feel free to open an issue in the [prefect-gitlab](https://github.com/prefecthq/prefect-gitlab) repository.
139
-
140
- If you have any questions or issues while using `prefect-gitlab`, you can find help in the [Prefect Slack community](https://prefect.io/slack).
141
-
142
- Feel free to ⭐️ or watch [`prefect-gitlab`](https://github.com/prefecthq/prefect-gitlab) for updates!
143
-
144
- ## Development
145
-
146
- If you'd like to install a version of `prefect-gitlab` for development, clone the repository and perform an editable install with `pip`:
147
-
148
- ```bash
149
- git clone https://github.com/prefecthq/prefect-gitlab.git
150
-
151
- cd prefect-gitlab/
152
-
153
- pip install -e ".[dev]"
154
-
155
- # Install linting pre-commit hooks
156
- pre-commit install
157
- ```
@@ -1,11 +1,5 @@
1
- LICENSE
2
- MANIFEST.in
3
1
  README.md
4
- requirements-dev.txt
5
- requirements.txt
6
- setup.cfg
7
- setup.py
8
- versioneer.py
2
+ pyproject.toml
9
3
  prefect_gitlab/__init__.py
10
4
  prefect_gitlab/_version.py
11
5
  prefect_gitlab/credentials.py
@@ -16,5 +10,7 @@ prefect_gitlab.egg-info/dependency_links.txt
16
10
  prefect_gitlab.egg-info/entry_points.txt
17
11
  prefect_gitlab.egg-info/requires.txt
18
12
  prefect_gitlab.egg-info/top_level.txt
13
+ tests/conftest.py
19
14
  tests/test_credentials.py
20
- tests/test_repositories.py
15
+ tests/test_repositories.py
16
+ tests/test_version.py
@@ -3,20 +3,19 @@ python-gitlab>=3.12.0
3
3
  tenacity>=8.2.3
4
4
 
5
5
  [dev]
6
- pytest
7
- black
8
- flake8
9
- mypy
10
- mkdocs
6
+ aiohttp
7
+ coverage
8
+ interrogate
9
+ mkdocs-gen-files
11
10
  mkdocs-material
11
+ mkdocs
12
12
  mkdocstrings[python]
13
- isort
13
+ mypy
14
+ pillow
14
15
  pre-commit
15
16
  pytest-asyncio
16
- mkdocs-gen-files
17
- interrogate
18
- coverage
19
- pillow
17
+ pytest
18
+ pytest-xdist
20
19
 
21
20
  [dev:python_version < "3.8"]
22
21
  mock
@@ -0,0 +1,81 @@
1
+ [build-system]
2
+ requires = ["setuptools>=45", "wheel", "setuptools_scm>=6.2"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "prefect-gitlab"
7
+ description = "A Prefect collection for working with GitLab repositories."
8
+ readme = "README.md"
9
+ requires-python = ">=3.8"
10
+ license = {text = "Apache License 2.0"}
11
+ keywords = ["prefect"]
12
+ authors = [
13
+ {name = "Prefect Technologies, Inc.", email = "help@prefect.io"}
14
+ ]
15
+ classifiers = [
16
+ "Natural Language :: English",
17
+ "Intended Audience :: Developers",
18
+ "Intended Audience :: System Administrators",
19
+ "License :: OSI Approved :: Apache Software License",
20
+ "Programming Language :: Python :: 3 :: Only",
21
+ "Programming Language :: Python :: 3.8",
22
+ "Programming Language :: Python :: 3.9",
23
+ "Programming Language :: Python :: 3.10",
24
+ "Programming Language :: Python :: 3.11",
25
+ "Programming Language :: Python :: 3.12",
26
+ "Topic :: Software Development :: Libraries",
27
+ ]
28
+ dependencies = [
29
+ "prefect>=2.13.5",
30
+ "python-gitlab>=3.12.0",
31
+ "tenacity>=8.2.3",
32
+ ]
33
+ dynamic = ["version"]
34
+
35
+ [project.optional-dependencies]
36
+ dev = [
37
+ "aiohttp",
38
+ "coverage",
39
+ "interrogate",
40
+ "mkdocs-gen-files",
41
+ "mkdocs-material",
42
+ "mkdocs",
43
+ "mkdocstrings[python]",
44
+ "mock; python_version < '3.8'",
45
+ "mypy",
46
+ "pillow",
47
+ "pre-commit",
48
+ "pytest-asyncio",
49
+ "pytest",
50
+ "pytest-xdist",
51
+ ]
52
+
53
+ [project.urls]
54
+ Homepage = "https://github.com/PrefectHQ/prefect/tree/main/src/integrations/prefect-gitlab"
55
+
56
+ [project.entry-points."prefect.collections"]
57
+ prefect_gitlab = "prefect_gitlab"
58
+
59
+ [tool.setuptools_scm]
60
+ version_file = "prefect_gitlab/_version.py"
61
+ root = "../../.."
62
+ tag_regex = "^prefect-gitlab-(?P<version>\\d+\\.\\d+\\.\\d+)$"
63
+ fallback_version = "0.0.0"
64
+ git_describe_command = 'git describe --dirty --tags --long --match "prefect-gitlab-*[0-9]*"'
65
+
66
+ [tool.interrogate]
67
+ ignore-init-module = true
68
+ ignore_init_method = true
69
+ exclude = ["prefect_gitlab/_version.py", "tests"]
70
+ fail-under = 95
71
+ omit-covered-files = true
72
+
73
+ [tool.coverage.run]
74
+ omit = ["tests/*", "prefect_gitlab/_version.py"]
75
+
76
+ [tool.coverage.report]
77
+ fail_under = 80
78
+ show_missing = true
79
+
80
+ [tool.pytest.ini_options]
81
+ asyncio_mode = "auto"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,23 @@
1
+ import pytest
2
+
3
+ from prefect.testing.utilities import prefect_test_harness
4
+
5
+
6
+ @pytest.fixture(scope="session", autouse=True)
7
+ def prefect_db():
8
+ """
9
+ Sets up test harness for temporary DB during test runs.
10
+ """
11
+ with prefect_test_harness():
12
+ yield
13
+
14
+
15
+ @pytest.fixture(autouse=True)
16
+ def reset_object_registry():
17
+ """
18
+ Ensures each test has a clean object registry.
19
+ """
20
+ from prefect.context import PrefectObjectRegistry
21
+
22
+ with PrefectObjectRegistry():
23
+ yield
@@ -4,9 +4,10 @@ from tempfile import TemporaryDirectory
4
4
  from typing import Set, Tuple
5
5
 
6
6
  import pytest
7
+ from pydantic import VERSION as PYDANTIC_VERSION
8
+
7
9
  from prefect.exceptions import InvalidRepositoryURLError
8
10
  from prefect.testing.utilities import AsyncMock
9
- from pydantic import VERSION as PYDANTIC_VERSION
10
11
 
11
12
  if PYDANTIC_VERSION.startswith("2."):
12
13
  from pydantic.v1 import SecretStr
@@ -146,6 +147,29 @@ class TestGitLab:
146
147
  ]
147
148
  assert mock.await_args[0][0][: len(expected_cmd)] == expected_cmd
148
149
 
150
+ async def test_cloning_with_custom_depth(self, monkeypatch):
151
+ """Ensure that we can retrieve the whole history, i.e. support true git clone""" # noqa: E501
152
+
153
+ class p:
154
+ returncode = 0
155
+
156
+ mock = AsyncMock(return_value=p())
157
+ monkeypatch.setattr(prefect_gitlab.repositories, "run_process", mock)
158
+ repo = "git@gitlab.com:PrefectHQ/prefect.git"
159
+ depth = None
160
+ g = GitLabRepository(
161
+ repository=repo,
162
+ git_depth=depth,
163
+ )
164
+ await g.get_directory()
165
+ assert mock.await_count == 1
166
+ expected_cmd = [
167
+ "git",
168
+ "clone",
169
+ repo,
170
+ ]
171
+ assert mock.await_args[0][0][: len(expected_cmd)] == expected_cmd
172
+
149
173
  async def test_ssh_fails_with_credential(self, monkeypatch):
150
174
  """Ensure that credentials cannot be passed in if the URL is not in the HTTPS/HTTP
151
175
  format.
@@ -170,9 +194,7 @@ class TestGitLab:
170
194
  credentials=GitLabCredentials(token=SecretStr(credential)),
171
195
  )
172
196
 
173
- async def test_dir_contents_copied_correctly_with_get_directory(
174
- self, monkeypatch
175
- ): # noqa
197
+ async def test_dir_contents_copied_correctly_with_get_directory(self, monkeypatch): # noqa
176
198
  """Check that `get_directory` is able to correctly copy contents from src->dst""" # noqa
177
199
 
178
200
  class p:
@@ -0,0 +1,9 @@
1
+ from packaging.version import Version
2
+
3
+
4
+ def test_version():
5
+ from prefect_gitlab import __version__
6
+
7
+ assert isinstance(__version__, str)
8
+ assert Version(__version__)
9
+ assert __version__.startswith("0.")