apache-airflow-providers-git 0.0.1__py3-none-any.whl → 0.0.2rc1__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,23 @@ 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 self.git_conn_id:
84
+ try:
85
+ self.hook = GitHook(git_conn_id=self.git_conn_id, 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)
88
+ else:
89
+ self.repo_url = self.hook.repo_url
90
+ self._log.debug("repo_url updated from hook")
88
91
 
89
92
  def _initialize(self):
90
93
  with self.lock():
91
- with self.hook.configure_hook_env():
94
+ cm = self.hook.configure_hook_env() if self.hook else nullcontext()
95
+ with cm:
92
96
  self._clone_bare_repo_if_required()
93
97
  self._ensure_version_in_bare_repo()
94
98
 
@@ -134,7 +138,7 @@ class GitDagBundle(BaseDagBundle):
134
138
  url=self.repo_url,
135
139
  to_path=self.bare_repo_path,
136
140
  bare=True,
137
- env=self.hook.env,
141
+ env=self.hook.env if self.hook else None,
138
142
  )
139
143
  except GitCommandError as e:
140
144
  raise AirflowException("Error cloning repository") from e
@@ -177,10 +181,10 @@ class GitDagBundle(BaseDagBundle):
177
181
 
178
182
  def _fetch_bare_repo(self):
179
183
  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:
184
+ cm = nullcontext()
185
+ if self.hook and (cmd := self.hook.env.get("GIT_SSH_COMMAND")):
186
+ cm = self.bare_repo.git.custom_environment(GIT_SSH_COMMAND=cmd)
187
+ with cm:
184
188
  self.bare_repo.remotes.origin.fetch(refspecs)
185
189
 
186
190
  def refresh(self) -> None:
@@ -188,7 +192,8 @@ class GitDagBundle(BaseDagBundle):
188
192
  raise AirflowException("Refreshing a specific version is not supported")
189
193
 
190
194
  with self.lock():
191
- with self.hook.configure_hook_env():
195
+ cm = self.hook.configure_hook_env() if self.hook else nullcontext()
196
+ with cm:
192
197
  self._fetch_bare_repo()
193
198
  self.repo.remotes.origin.fetch(
194
199
  ["+refs/heads/*:refs/remotes/origin/*", "+refs/tags/*:refs/tags/*"]
@@ -233,6 +238,8 @@ class GitDagBundle(BaseDagBundle):
233
238
  "gitlab.com": f"{url}/-/tree/{version}",
234
239
  "bitbucket.org": f"{url}/src/{version}",
235
240
  }
241
+ if self.subdir:
242
+ host_patterns = {k: f"{v}/{self.subdir}" for k, v in host_patterns.items()}
236
243
  for allowed_host, template in host_patterns.items():
237
244
  if host == allowed_host or host.endswith(f".{allowed_host}"):
238
245
  return template
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: apache-airflow-providers-git
3
- Version: 0.0.1
3
+ Version: 0.0.2rc1
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>
@@ -20,11 +20,11 @@ Classifier: Programming Language :: Python :: 3.10
20
20
  Classifier: Programming Language :: Python :: 3.11
21
21
  Classifier: Programming Language :: Python :: 3.12
22
22
  Classifier: Topic :: System :: Monitoring
23
- Requires-Dist: apache-airflow>=3.0.0
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
 
@@ -0,0 +1,11 @@
1
+ airflow/providers/git/LICENSE,sha256=gXPVwptPlW1TJ4HSuG5OMPg-a3h43OGMkZRR1rpwfJA,10850
2
+ airflow/providers/git/__init__.py,sha256=jllQ1mZczFIYO53Gb9mCS8ySzj6s5yrgjtCWQv_3198,1490
3
+ airflow/providers/git/get_provider_info.py,sha256=6xC_Jru3CMrhO7r5aX03J4HR6Jl62rp9BWVcLKFjxQQ,1809
4
+ airflow/providers/git/bundles/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2xSGeG4GEua0Hmelus,785
5
+ airflow/providers/git/bundles/git.py,sha256=OXiq9hE5V0nSGl_CE3C4hgmDaZFnFvPuCdPne2Xc0j8,9461
6
+ airflow/providers/git/hooks/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2xSGeG4GEua0Hmelus,785
7
+ airflow/providers/git/hooks/git.py,sha256=RIhvVfd3J-GW9itJ0V1tXeEQSMxZFsMqqmLZGiUBfM4,3908
8
+ apache_airflow_providers_git-0.0.2rc1.dist-info/entry_points.txt,sha256=k9QR9MAaAm9yDsRDBIK3QOt5Fos3fBCqCngNFPaJnKs,99
9
+ apache_airflow_providers_git-0.0.2rc1.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
10
+ apache_airflow_providers_git-0.0.2rc1.dist-info/METADATA,sha256=Oj-j_QwKn1BCZwMfjm6yq6hiF6tsCKVkLDIr6uk68Hg,3845
11
+ apache_airflow_providers_git-0.0.2rc1.dist-info/RECORD,,
@@ -1,11 +0,0 @@
1
- airflow/providers/git/LICENSE,sha256=gXPVwptPlW1TJ4HSuG5OMPg-a3h43OGMkZRR1rpwfJA,10850
2
- airflow/providers/git/__init__.py,sha256=zNgp9rHGoc5roLS_cYTHNnTO1yjoAJCqdYAGmKhEuQ4,1490
3
- airflow/providers/git/get_provider_info.py,sha256=6xC_Jru3CMrhO7r5aX03J4HR6Jl62rp9BWVcLKFjxQQ,1809
4
- airflow/providers/git/bundles/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2xSGeG4GEua0Hmelus,785
5
- airflow/providers/git/bundles/git.py,sha256=rN6C9t0cltaDcKNZnYsXgbia6CFsiXtA0TsFPijpplw,9157
6
- airflow/providers/git/hooks/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2xSGeG4GEua0Hmelus,785
7
- airflow/providers/git/hooks/git.py,sha256=RIhvVfd3J-GW9itJ0V1tXeEQSMxZFsMqqmLZGiUBfM4,3908
8
- apache_airflow_providers_git-0.0.1.dist-info/entry_points.txt,sha256=k9QR9MAaAm9yDsRDBIK3QOt5Fos3fBCqCngNFPaJnKs,99
9
- apache_airflow_providers_git-0.0.1.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
10
- apache_airflow_providers_git-0.0.1.dist-info/METADATA,sha256=owWS8bAsS26Nj24UwaEnu3QUE1jXR3QfRofUHx7N8fc,3839
11
- apache_airflow_providers_git-0.0.1.dist-info/RECORD,,