apache-airflow-providers-git 0.0.1rc1__py3-none-any.whl → 0.0.2rc2__py3-none-any.whl

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.

Potentially problematic release.


This version of apache-airflow-providers-git might be problematic. Click here for more details.

@@ -29,7 +29,7 @@ from airflow import __version__ as airflow_version
29
29
 
30
30
  __all__ = ["__version__"]
31
31
 
32
- __version__ = "0.0.1"
32
+ __version__ = "0.0.2"
33
33
 
34
34
  if packaging.version.parse(packaging.version.parse(airflow_version).base_version) < packaging.version.parse(
35
35
  "3.0.0"
@@ -17,6 +17,7 @@
17
17
  from __future__ import annotations
18
18
 
19
19
  import os
20
+ from contextlib import nullcontext
20
21
  from pathlib import Path
21
22
  from urllib.parse import urlparse
22
23
 
@@ -53,7 +54,7 @@ class GitDagBundle(BaseDagBundle):
53
54
  *,
54
55
  tracking_ref: str,
55
56
  subdir: str | None = None,
56
- git_conn_id: str = "git_default",
57
+ git_conn_id: str | None = None,
57
58
  repo_url: str | None = None,
58
59
  **kwargs,
59
60
  ) -> None:
@@ -75,20 +76,26 @@ class GitDagBundle(BaseDagBundle):
75
76
  repo_path=self.repo_path,
76
77
  versions_path=self.versions_dir,
77
78
  git_conn_id=self.git_conn_id,
78
- repo_url=self.repo_url,
79
79
  )
80
80
 
81
81
  self._log.debug("bundle configured")
82
- try:
83
- self.hook = GitHook(git_conn_id=self.git_conn_id, repo_url=self.repo_url)
84
- self.repo_url = self.hook.repo_url
85
- self._log.debug("repo_url updated from hook", repo_url=self.repo_url)
86
- except AirflowException as e:
87
- self._log.warning("Could not create GitHook", conn_id=self.git_conn_id, exc=e)
82
+ self.hook: GitHook | None = None
83
+ if not repo_url:
84
+ if not git_conn_id:
85
+ self._log.debug("Neither git_conn_id nor repo_url provided; loading 'git_default'")
86
+ git_conn_id = "git_default"
87
+ try:
88
+ self.hook = GitHook(git_conn_id=git_conn_id)
89
+ except AirflowException as e:
90
+ self._log.warning("Could not create GitHook", conn_id=git_conn_id, exc=e)
91
+ else:
92
+ self.repo_url = self.hook.repo_url
93
+ self._log.debug("repo_url updated from hook")
88
94
 
89
95
  def _initialize(self):
90
96
  with self.lock():
91
- with self.hook.configure_hook_env():
97
+ cm = self.hook.configure_hook_env() if self.hook else nullcontext()
98
+ with cm:
92
99
  self._clone_bare_repo_if_required()
93
100
  self._ensure_version_in_bare_repo()
94
101
 
@@ -134,7 +141,7 @@ class GitDagBundle(BaseDagBundle):
134
141
  url=self.repo_url,
135
142
  to_path=self.bare_repo_path,
136
143
  bare=True,
137
- env=self.hook.env,
144
+ env=self.hook.env if self.hook else None,
138
145
  )
139
146
  except GitCommandError as e:
140
147
  raise AirflowException("Error cloning repository") from e
@@ -177,10 +184,10 @@ class GitDagBundle(BaseDagBundle):
177
184
 
178
185
  def _fetch_bare_repo(self):
179
186
  refspecs = ["+refs/heads/*:refs/heads/*", "+refs/tags/*:refs/tags/*"]
180
- if self.hook.env:
181
- with self.bare_repo.git.custom_environment(GIT_SSH_COMMAND=self.hook.env.get("GIT_SSH_COMMAND")):
182
- self.bare_repo.remotes.origin.fetch(refspecs)
183
- else:
187
+ cm = nullcontext()
188
+ if self.hook and (cmd := self.hook.env.get("GIT_SSH_COMMAND")):
189
+ cm = self.bare_repo.git.custom_environment(GIT_SSH_COMMAND=cmd)
190
+ with cm:
184
191
  self.bare_repo.remotes.origin.fetch(refspecs)
185
192
 
186
193
  def refresh(self) -> None:
@@ -188,7 +195,8 @@ class GitDagBundle(BaseDagBundle):
188
195
  raise AirflowException("Refreshing a specific version is not supported")
189
196
 
190
197
  with self.lock():
191
- with self.hook.configure_hook_env():
198
+ cm = self.hook.configure_hook_env() if self.hook else nullcontext()
199
+ with cm:
192
200
  self._fetch_bare_repo()
193
201
  self.repo.remotes.origin.fetch(
194
202
  ["+refs/heads/*:refs/remotes/origin/*", "+refs/tags/*:refs/tags/*"]
@@ -233,6 +241,8 @@ class GitDagBundle(BaseDagBundle):
233
241
  "gitlab.com": f"{url}/-/tree/{version}",
234
242
  "bitbucket.org": f"{url}/src/{version}",
235
243
  }
244
+ if self.subdir:
245
+ host_patterns = {k: f"{v}/{self.subdir}" for k, v in host_patterns.items()}
236
246
  for allowed_host, template in host_patterns.items():
237
247
  if host == allowed_host or host.endswith(f".{allowed_host}"):
238
248
  return template
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: apache-airflow-providers-git
3
- Version: 0.0.1rc1
3
+ Version: 0.0.2rc2
4
4
  Summary: Provider package apache-airflow-providers-git for Apache Airflow
5
5
  Keywords: airflow-provider,git,airflow,integration
6
6
  Author-email: Apache Software Foundation <dev@airflow.apache.org>
@@ -23,8 +23,8 @@ Classifier: Topic :: System :: Monitoring
23
23
  Requires-Dist: apache-airflow>=3.0.0rc0
24
24
  Requires-Dist: GitPython>=3.1.44
25
25
  Project-URL: Bug Tracker, https://github.com/apache/airflow/issues
26
- Project-URL: Changelog, https://airflow.apache.org/docs/apache-airflow-providers-git/0.0.1/changelog.html
27
- Project-URL: Documentation, https://airflow.apache.org/docs/apache-airflow-providers-git/0.0.1
26
+ Project-URL: Changelog, https://airflow.apache.org/docs/apache-airflow-providers-git/0.0.2/changelog.html
27
+ Project-URL: Documentation, https://airflow.apache.org/docs/apache-airflow-providers-git/0.0.2
28
28
  Project-URL: Mastodon, https://fosstodon.org/@airflow
29
29
  Project-URL: Slack Chat, https://s.apache.org/airflow-slack
30
30
  Project-URL: Source Code, https://github.com/apache/airflow
@@ -55,7 +55,7 @@ Project-URL: YouTube, https://www.youtube.com/channel/UCSXwxpWZQ7XZ1WL3wqevChA/
55
55
 
56
56
  Package ``apache-airflow-providers-git``
57
57
 
58
- Release: ``0.0.1``
58
+ Release: ``0.0.2``
59
59
 
60
60
 
61
61
  `Distributed version control system (GIT) <https://git-scm.com/>`__
@@ -68,7 +68,7 @@ This is a provider package for ``git`` provider. All classes for this provider p
68
68
  are in ``airflow.providers.git`` python package.
69
69
 
70
70
  You can find package information and changelog for the provider
71
- in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-git/0.0.1/>`_.
71
+ in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-git/0.0.2/>`_.
72
72
 
73
73
  Installation
74
74
  ------------
@@ -90,5 +90,5 @@ PIP package Version required
90
90
  ================== ==================
91
91
 
92
92
  The changelog for the provider package can be found in the
93
- `changelog <https://airflow.apache.org/docs/apache-airflow-providers-git/0.0.1/changelog.html>`_.
93
+ `changelog <https://airflow.apache.org/docs/apache-airflow-providers-git/0.0.2/changelog.html>`_.
94
94
 
@@ -1,11 +1,11 @@
1
1
  airflow/providers/git/LICENSE,sha256=gXPVwptPlW1TJ4HSuG5OMPg-a3h43OGMkZRR1rpwfJA,10850
2
- airflow/providers/git/__init__.py,sha256=zNgp9rHGoc5roLS_cYTHNnTO1yjoAJCqdYAGmKhEuQ4,1490
2
+ airflow/providers/git/__init__.py,sha256=jllQ1mZczFIYO53Gb9mCS8ySzj6s5yrgjtCWQv_3198,1490
3
3
  airflow/providers/git/get_provider_info.py,sha256=6xC_Jru3CMrhO7r5aX03J4HR6Jl62rp9BWVcLKFjxQQ,1809
4
4
  airflow/providers/git/bundles/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2xSGeG4GEua0Hmelus,785
5
- airflow/providers/git/bundles/git.py,sha256=rN6C9t0cltaDcKNZnYsXgbia6CFsiXtA0TsFPijpplw,9157
5
+ airflow/providers/git/bundles/git.py,sha256=vYerC80phtGd26P2Jv8VxxL3kj4liW8UM2mbgdOELZI,9599
6
6
  airflow/providers/git/hooks/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2xSGeG4GEua0Hmelus,785
7
7
  airflow/providers/git/hooks/git.py,sha256=RIhvVfd3J-GW9itJ0V1tXeEQSMxZFsMqqmLZGiUBfM4,3908
8
- apache_airflow_providers_git-0.0.1rc1.dist-info/entry_points.txt,sha256=k9QR9MAaAm9yDsRDBIK3QOt5Fos3fBCqCngNFPaJnKs,99
9
- apache_airflow_providers_git-0.0.1rc1.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
10
- apache_airflow_providers_git-0.0.1rc1.dist-info/METADATA,sha256=aE88ziqAEK9HIpvT7mhBKSzqDbXegYroD_ea6P8bL6s,3845
11
- apache_airflow_providers_git-0.0.1rc1.dist-info/RECORD,,
8
+ apache_airflow_providers_git-0.0.2rc2.dist-info/entry_points.txt,sha256=k9QR9MAaAm9yDsRDBIK3QOt5Fos3fBCqCngNFPaJnKs,99
9
+ apache_airflow_providers_git-0.0.2rc2.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
10
+ apache_airflow_providers_git-0.0.2rc2.dist-info/METADATA,sha256=eb1LZ8-MjKUJyB11vh0BiXhkpQaXmyv5M4uaxv5JFtE,3845
11
+ apache_airflow_providers_git-0.0.2rc2.dist-info/RECORD,,