airbyte-source-github 2.1.10__tar.gz → 2.1.10.dev202602202300__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 (63) hide show
  1. {airbyte_source_github-2.1.10 → airbyte_source_github-2.1.10.dev202602202300}/PKG-INFO +1 -1
  2. {airbyte_source_github-2.1.10 → airbyte_source_github-2.1.10.dev202602202300}/pyproject.toml +1 -1
  3. {airbyte_source_github-2.1.10 → airbyte_source_github-2.1.10.dev202602202300}/source_github/graphql.py +45 -0
  4. {airbyte_source_github-2.1.10 → airbyte_source_github-2.1.10.dev202602202300}/source_github/streams.py +50 -18
  5. {airbyte_source_github-2.1.10 → airbyte_source_github-2.1.10.dev202602202300}/README.md +0 -0
  6. {airbyte_source_github-2.1.10 → airbyte_source_github-2.1.10.dev202602202300}/source_github/__init__.py +0 -0
  7. {airbyte_source_github-2.1.10 → airbyte_source_github-2.1.10.dev202602202300}/source_github/backoff_strategies.py +0 -0
  8. {airbyte_source_github-2.1.10 → airbyte_source_github-2.1.10.dev202602202300}/source_github/config_migrations.py +0 -0
  9. {airbyte_source_github-2.1.10 → airbyte_source_github-2.1.10.dev202602202300}/source_github/constants.py +0 -0
  10. {airbyte_source_github-2.1.10 → airbyte_source_github-2.1.10.dev202602202300}/source_github/errors_handlers.py +0 -0
  11. {airbyte_source_github-2.1.10 → airbyte_source_github-2.1.10.dev202602202300}/source_github/github_schema.py +0 -0
  12. {airbyte_source_github-2.1.10 → airbyte_source_github-2.1.10.dev202602202300}/source_github/run.py +0 -0
  13. {airbyte_source_github-2.1.10 → airbyte_source_github-2.1.10.dev202602202300}/source_github/schemas/assignees.json +0 -0
  14. {airbyte_source_github-2.1.10 → airbyte_source_github-2.1.10.dev202602202300}/source_github/schemas/branches.json +0 -0
  15. {airbyte_source_github-2.1.10 → airbyte_source_github-2.1.10.dev202602202300}/source_github/schemas/collaborators.json +0 -0
  16. {airbyte_source_github-2.1.10 → airbyte_source_github-2.1.10.dev202602202300}/source_github/schemas/comments.json +0 -0
  17. {airbyte_source_github-2.1.10 → airbyte_source_github-2.1.10.dev202602202300}/source_github/schemas/commit_comment_reactions.json +0 -0
  18. {airbyte_source_github-2.1.10 → airbyte_source_github-2.1.10.dev202602202300}/source_github/schemas/commit_comments.json +0 -0
  19. {airbyte_source_github-2.1.10 → airbyte_source_github-2.1.10.dev202602202300}/source_github/schemas/commits.json +0 -0
  20. {airbyte_source_github-2.1.10 → airbyte_source_github-2.1.10.dev202602202300}/source_github/schemas/contributor_activity.json +0 -0
  21. {airbyte_source_github-2.1.10 → airbyte_source_github-2.1.10.dev202602202300}/source_github/schemas/deployments.json +0 -0
  22. {airbyte_source_github-2.1.10 → airbyte_source_github-2.1.10.dev202602202300}/source_github/schemas/events.json +0 -0
  23. {airbyte_source_github-2.1.10 → airbyte_source_github-2.1.10.dev202602202300}/source_github/schemas/issue_comment_reactions.json +0 -0
  24. {airbyte_source_github-2.1.10 → airbyte_source_github-2.1.10.dev202602202300}/source_github/schemas/issue_events.json +0 -0
  25. {airbyte_source_github-2.1.10 → airbyte_source_github-2.1.10.dev202602202300}/source_github/schemas/issue_labels.json +0 -0
  26. {airbyte_source_github-2.1.10 → airbyte_source_github-2.1.10.dev202602202300}/source_github/schemas/issue_milestones.json +0 -0
  27. {airbyte_source_github-2.1.10 → airbyte_source_github-2.1.10.dev202602202300}/source_github/schemas/issue_reactions.json +0 -0
  28. {airbyte_source_github-2.1.10 → airbyte_source_github-2.1.10.dev202602202300}/source_github/schemas/issue_timeline_events.json +0 -0
  29. {airbyte_source_github-2.1.10 → airbyte_source_github-2.1.10.dev202602202300}/source_github/schemas/issues.json +0 -0
  30. {airbyte_source_github-2.1.10 → airbyte_source_github-2.1.10.dev202602202300}/source_github/schemas/organizations.json +0 -0
  31. {airbyte_source_github-2.1.10 → airbyte_source_github-2.1.10.dev202602202300}/source_github/schemas/project_cards.json +0 -0
  32. {airbyte_source_github-2.1.10 → airbyte_source_github-2.1.10.dev202602202300}/source_github/schemas/project_columns.json +0 -0
  33. {airbyte_source_github-2.1.10 → airbyte_source_github-2.1.10.dev202602202300}/source_github/schemas/projects.json +0 -0
  34. {airbyte_source_github-2.1.10 → airbyte_source_github-2.1.10.dev202602202300}/source_github/schemas/projects_v2.json +0 -0
  35. {airbyte_source_github-2.1.10 → airbyte_source_github-2.1.10.dev202602202300}/source_github/schemas/pull_request_comment_reactions.json +0 -0
  36. {airbyte_source_github-2.1.10 → airbyte_source_github-2.1.10.dev202602202300}/source_github/schemas/pull_request_commits.json +0 -0
  37. {airbyte_source_github-2.1.10 → airbyte_source_github-2.1.10.dev202602202300}/source_github/schemas/pull_request_stats.json +0 -0
  38. {airbyte_source_github-2.1.10 → airbyte_source_github-2.1.10.dev202602202300}/source_github/schemas/pull_requests.json +0 -0
  39. {airbyte_source_github-2.1.10 → airbyte_source_github-2.1.10.dev202602202300}/source_github/schemas/releases.json +0 -0
  40. {airbyte_source_github-2.1.10 → airbyte_source_github-2.1.10.dev202602202300}/source_github/schemas/repositories.json +0 -0
  41. {airbyte_source_github-2.1.10 → airbyte_source_github-2.1.10.dev202602202300}/source_github/schemas/review_comments.json +0 -0
  42. {airbyte_source_github-2.1.10 → airbyte_source_github-2.1.10.dev202602202300}/source_github/schemas/reviews.json +0 -0
  43. {airbyte_source_github-2.1.10 → airbyte_source_github-2.1.10.dev202602202300}/source_github/schemas/shared/events/comment.json +0 -0
  44. {airbyte_source_github-2.1.10 → airbyte_source_github-2.1.10.dev202602202300}/source_github/schemas/shared/events/commented.json +0 -0
  45. {airbyte_source_github-2.1.10 → airbyte_source_github-2.1.10.dev202602202300}/source_github/schemas/shared/events/committed.json +0 -0
  46. {airbyte_source_github-2.1.10 → airbyte_source_github-2.1.10.dev202602202300}/source_github/schemas/shared/events/cross_referenced.json +0 -0
  47. {airbyte_source_github-2.1.10 → airbyte_source_github-2.1.10.dev202602202300}/source_github/schemas/shared/events/reviewed.json +0 -0
  48. {airbyte_source_github-2.1.10 → airbyte_source_github-2.1.10.dev202602202300}/source_github/schemas/shared/reaction.json +0 -0
  49. {airbyte_source_github-2.1.10 → airbyte_source_github-2.1.10.dev202602202300}/source_github/schemas/shared/reactions.json +0 -0
  50. {airbyte_source_github-2.1.10 → airbyte_source_github-2.1.10.dev202602202300}/source_github/schemas/shared/user.json +0 -0
  51. {airbyte_source_github-2.1.10 → airbyte_source_github-2.1.10.dev202602202300}/source_github/schemas/shared/user_graphql.json +0 -0
  52. {airbyte_source_github-2.1.10 → airbyte_source_github-2.1.10.dev202602202300}/source_github/schemas/stargazers.json +0 -0
  53. {airbyte_source_github-2.1.10 → airbyte_source_github-2.1.10.dev202602202300}/source_github/schemas/tags.json +0 -0
  54. {airbyte_source_github-2.1.10 → airbyte_source_github-2.1.10.dev202602202300}/source_github/schemas/team_members.json +0 -0
  55. {airbyte_source_github-2.1.10 → airbyte_source_github-2.1.10.dev202602202300}/source_github/schemas/team_memberships.json +0 -0
  56. {airbyte_source_github-2.1.10 → airbyte_source_github-2.1.10.dev202602202300}/source_github/schemas/teams.json +0 -0
  57. {airbyte_source_github-2.1.10 → airbyte_source_github-2.1.10.dev202602202300}/source_github/schemas/users.json +0 -0
  58. {airbyte_source_github-2.1.10 → airbyte_source_github-2.1.10.dev202602202300}/source_github/schemas/workflow_jobs.json +0 -0
  59. {airbyte_source_github-2.1.10 → airbyte_source_github-2.1.10.dev202602202300}/source_github/schemas/workflow_runs.json +0 -0
  60. {airbyte_source_github-2.1.10 → airbyte_source_github-2.1.10.dev202602202300}/source_github/schemas/workflows.json +0 -0
  61. {airbyte_source_github-2.1.10 → airbyte_source_github-2.1.10.dev202602202300}/source_github/source.py +0 -0
  62. {airbyte_source_github-2.1.10 → airbyte_source_github-2.1.10.dev202602202300}/source_github/spec.json +0 -0
  63. {airbyte_source_github-2.1.10 → airbyte_source_github-2.1.10.dev202602202300}/source_github/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: airbyte-source-github
3
- Version: 2.1.10
3
+ Version: 2.1.10.dev202602202300
4
4
  Summary: Source implementation for GitHub.
5
5
  Home-page: https://airbyte.com
6
6
  License: ELv2
@@ -3,7 +3,7 @@ requires = [ "poetry-core>=1.0.0",]
3
3
  build-backend = "poetry.core.masonry.api"
4
4
 
5
5
  [tool.poetry]
6
- version = "2.1.10"
6
+ version = "2.1.10.dev.202602202300"
7
7
  name = "airbyte-source-github"
8
8
  description = "Source implementation for GitHub."
9
9
  authors = [ "Airbyte <contact@airbyte.io>",]
@@ -165,6 +165,51 @@ def get_query_issue_reactions(owner, name, first, after, number=None):
165
165
  return str(op)
166
166
 
167
167
 
168
+ def get_query_releases(owner, name, first, after, direction):
169
+ kwargs = {"first": first, "order_by": {"field": "CREATED_AT", "direction": direction}}
170
+ if after:
171
+ kwargs["after"] = after
172
+
173
+ op = sgqlc.operation.Operation(_schema_root.query_type)
174
+ repository = op.repository(owner=owner, name=name)
175
+ repository.name()
176
+ repository.owner.login()
177
+ releases = repository.releases(**kwargs)
178
+ releases.nodes.__fields__(
179
+ id="node_id",
180
+ database_id="id",
181
+ name=True,
182
+ tag_name="tag_name",
183
+ created_at="created_at",
184
+ published_at="published_at",
185
+ updated_at="updated_at",
186
+ is_draft="draft",
187
+ is_prerelease="prerelease",
188
+ description="body",
189
+ description_html="body_html",
190
+ url="html_url",
191
+ )
192
+ releases.nodes.tag_commit.oid(__alias__="target_commitish")
193
+ author = releases.nodes.author(__alias__="author").__as__(_schema_root.User)
194
+ select_user_fields(author)
195
+ release_assets = releases.nodes.release_assets(first=100, __alias__="assets")
196
+ release_assets.nodes.__fields__(
197
+ id="node_id",
198
+ name=True,
199
+ content_type="content_type",
200
+ size=True,
201
+ download_count="download_count",
202
+ created_at="created_at",
203
+ updated_at="updated_at",
204
+ download_url="browser_download_url",
205
+ url=True,
206
+ )
207
+ release_assets.nodes.uploaded_by(__alias__="uploader").__as__(_schema_root.User).__fields__(database_id="id")
208
+ releases.nodes.mentions(first=0, __alias__="mentions_connection").total_count()
209
+ releases.page_info.__fields__(has_next_page=True, end_cursor=True)
210
+ return str(op)
211
+
212
+
168
213
  class QueryReactions:
169
214
  # AVERAGE_REVIEWS - optimal number of reviews to fetch inside every pull request.
170
215
  # If we try to fetch too many (up to 100) we will spend too many scores of query cost.
@@ -39,6 +39,7 @@ from .graphql import (
39
39
  get_query_issue_reactions,
40
40
  get_query_projectsV2,
41
41
  get_query_pull_requests,
42
+ get_query_releases,
42
43
  get_query_reviews,
43
44
  )
44
45
  from .utils import GitHubAPILimitException, getter
@@ -502,24 +503,6 @@ class Users(Organizations):
502
503
  # Below are semi incremental streams
503
504
 
504
505
 
505
- class Releases(SemiIncrementalMixin, GithubStream):
506
- """
507
- API docs: https://docs.github.com/en/rest/releases/releases?apiVersion=2022-11-28#list-releases
508
- """
509
-
510
- cursor_field = "created_at"
511
-
512
- def transform(self, record: MutableMapping[str, Any], stream_slice: Mapping[str, Any]) -> MutableMapping[str, Any]:
513
- record = super().transform(record=record, stream_slice=stream_slice)
514
-
515
- assets = record.get("assets", [])
516
- for asset in assets:
517
- uploader = asset.pop("uploader", None)
518
- asset["uploader_id"] = uploader.get("id") if uploader else None
519
-
520
- return record
521
-
522
-
523
506
  class Events(SemiIncrementalMixin, GithubStream):
524
507
  """
525
508
  API docs: https://docs.github.com/en/rest/activity/events?apiVersion=2022-11-28#list-repository-events
@@ -808,6 +791,55 @@ class GitHubGraphQLStream(GithubStream, ABC):
808
791
  return {}
809
792
 
810
793
 
794
+ class Releases(SemiIncrementalMixin, GitHubGraphQLStream):
795
+ """
796
+ API docs: https://docs.github.com/en/graphql/reference/objects#release
797
+ Uses GraphQL API to avoid the REST API's 10,000 result pagination limit.
798
+ """
799
+
800
+ cursor_field = "created_at"
801
+ is_sorted = "asc"
802
+
803
+ def parse_response(self, response: requests.Response, **kwargs) -> Iterable[Mapping]:
804
+ repository = response.json().get("data", {}).get("repository")
805
+ if repository:
806
+ nodes = repository.get("releases", {}).get("nodes", [])
807
+ for record in nodes:
808
+ record["repository"] = self._get_repository_name(repository)
809
+ if record.get("author"):
810
+ record["author"]["type"] = record["author"].pop("__typename", "User")
811
+ assets = record.get("assets", {}).get("nodes", [])
812
+ for asset in assets:
813
+ uploader = asset.pop("uploader", None)
814
+ asset["uploader_id"] = uploader.get("id") if uploader else None
815
+ record["assets"] = assets
816
+ mentions_connection = record.pop("mentions_connection", None)
817
+ if mentions_connection is not None:
818
+ record["mentions_count"] = mentions_connection.get("totalCount", 0)
819
+ tag_commit = record.pop("tagCommit", record.pop("tag_commit", None))
820
+ if tag_commit:
821
+ record["target_commitish"] = tag_commit.get("target_commitish", tag_commit.get("oid"))
822
+ yield record
823
+
824
+ def next_page_token(self, response: requests.Response) -> Optional[Mapping[str, Any]]:
825
+ repository = response.json().get("data", {}).get("repository")
826
+ if repository:
827
+ page_info = repository.get("releases", {}).get("pageInfo", {})
828
+ if page_info.get("hasNextPage"):
829
+ return {"after": page_info["endCursor"]}
830
+
831
+ def request_body_json(
832
+ self,
833
+ stream_state: Mapping[str, Any],
834
+ stream_slice: Mapping[str, Any] = None,
835
+ next_page_token: Mapping[str, Any] = None,
836
+ ) -> Optional[Mapping]:
837
+ organization, name = stream_slice["repository"].split("/")
838
+ after = next_page_token["after"] if next_page_token else None
839
+ query = get_query_releases(owner=organization, name=name, first=self.page_size, after=after, direction=self.is_sorted.upper())
840
+ return {"query": query}
841
+
842
+
811
843
  class PullRequestStats(SemiIncrementalMixin, GitHubGraphQLStream):
812
844
  """
813
845
  API docs: https://docs.github.com/en/graphql/reference/objects#pullrequest