airbyte-source-github 2.1.35__tar.gz → 2.1.36rc1__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.
- {airbyte_source_github-2.1.35 → airbyte_source_github-2.1.36rc1}/PKG-INFO +1 -1
- {airbyte_source_github-2.1.35 → airbyte_source_github-2.1.36rc1}/pyproject.toml +1 -1
- airbyte_source_github-2.1.36rc1/source_github/manifest.yaml +6 -0
- airbyte_source_github-2.1.36rc1/source_github/run.py +63 -0
- {airbyte_source_github-2.1.35 → airbyte_source_github-2.1.36rc1}/source_github/source.py +74 -3
- airbyte_source_github-2.1.35/source_github/run.py +0 -17
- {airbyte_source_github-2.1.35 → airbyte_source_github-2.1.36rc1}/.airbyte-pypi-readme.md +0 -0
- {airbyte_source_github-2.1.35 → airbyte_source_github-2.1.36rc1}/source_github/__init__.py +0 -0
- {airbyte_source_github-2.1.35 → airbyte_source_github-2.1.36rc1}/source_github/backoff_strategies.py +0 -0
- {airbyte_source_github-2.1.35 → airbyte_source_github-2.1.36rc1}/source_github/config_migrations.py +0 -0
- {airbyte_source_github-2.1.35 → airbyte_source_github-2.1.36rc1}/source_github/constants.py +0 -0
- {airbyte_source_github-2.1.35 → airbyte_source_github-2.1.36rc1}/source_github/errors_handlers.py +0 -0
- {airbyte_source_github-2.1.35 → airbyte_source_github-2.1.36rc1}/source_github/github_schema.py +0 -0
- {airbyte_source_github-2.1.35 → airbyte_source_github-2.1.36rc1}/source_github/graphql.py +0 -0
- {airbyte_source_github-2.1.35 → airbyte_source_github-2.1.36rc1}/source_github/schemas/assignees.json +0 -0
- {airbyte_source_github-2.1.35 → airbyte_source_github-2.1.36rc1}/source_github/schemas/branches.json +0 -0
- {airbyte_source_github-2.1.35 → airbyte_source_github-2.1.36rc1}/source_github/schemas/collaborators.json +0 -0
- {airbyte_source_github-2.1.35 → airbyte_source_github-2.1.36rc1}/source_github/schemas/comments.json +0 -0
- {airbyte_source_github-2.1.35 → airbyte_source_github-2.1.36rc1}/source_github/schemas/commit_comment_reactions.json +0 -0
- {airbyte_source_github-2.1.35 → airbyte_source_github-2.1.36rc1}/source_github/schemas/commit_comments.json +0 -0
- {airbyte_source_github-2.1.35 → airbyte_source_github-2.1.36rc1}/source_github/schemas/commits.json +0 -0
- {airbyte_source_github-2.1.35 → airbyte_source_github-2.1.36rc1}/source_github/schemas/contributor_activity.json +0 -0
- {airbyte_source_github-2.1.35 → airbyte_source_github-2.1.36rc1}/source_github/schemas/deployments.json +0 -0
- {airbyte_source_github-2.1.35 → airbyte_source_github-2.1.36rc1}/source_github/schemas/events.json +0 -0
- {airbyte_source_github-2.1.35 → airbyte_source_github-2.1.36rc1}/source_github/schemas/issue_comment_reactions.json +0 -0
- {airbyte_source_github-2.1.35 → airbyte_source_github-2.1.36rc1}/source_github/schemas/issue_events.json +0 -0
- {airbyte_source_github-2.1.35 → airbyte_source_github-2.1.36rc1}/source_github/schemas/issue_labels.json +0 -0
- {airbyte_source_github-2.1.35 → airbyte_source_github-2.1.36rc1}/source_github/schemas/issue_milestones.json +0 -0
- {airbyte_source_github-2.1.35 → airbyte_source_github-2.1.36rc1}/source_github/schemas/issue_reactions.json +0 -0
- {airbyte_source_github-2.1.35 → airbyte_source_github-2.1.36rc1}/source_github/schemas/issue_timeline_events.json +0 -0
- {airbyte_source_github-2.1.35 → airbyte_source_github-2.1.36rc1}/source_github/schemas/issues.json +0 -0
- {airbyte_source_github-2.1.35 → airbyte_source_github-2.1.36rc1}/source_github/schemas/organizations.json +0 -0
- {airbyte_source_github-2.1.35 → airbyte_source_github-2.1.36rc1}/source_github/schemas/project_cards.json +0 -0
- {airbyte_source_github-2.1.35 → airbyte_source_github-2.1.36rc1}/source_github/schemas/project_columns.json +0 -0
- {airbyte_source_github-2.1.35 → airbyte_source_github-2.1.36rc1}/source_github/schemas/projects.json +0 -0
- {airbyte_source_github-2.1.35 → airbyte_source_github-2.1.36rc1}/source_github/schemas/projects_v2.json +0 -0
- {airbyte_source_github-2.1.35 → airbyte_source_github-2.1.36rc1}/source_github/schemas/pull_request_comment_reactions.json +0 -0
- {airbyte_source_github-2.1.35 → airbyte_source_github-2.1.36rc1}/source_github/schemas/pull_request_commits.json +0 -0
- {airbyte_source_github-2.1.35 → airbyte_source_github-2.1.36rc1}/source_github/schemas/pull_request_stats.json +0 -0
- {airbyte_source_github-2.1.35 → airbyte_source_github-2.1.36rc1}/source_github/schemas/pull_requests.json +0 -0
- {airbyte_source_github-2.1.35 → airbyte_source_github-2.1.36rc1}/source_github/schemas/releases.json +0 -0
- {airbyte_source_github-2.1.35 → airbyte_source_github-2.1.36rc1}/source_github/schemas/repositories.json +0 -0
- {airbyte_source_github-2.1.35 → airbyte_source_github-2.1.36rc1}/source_github/schemas/review_comments.json +0 -0
- {airbyte_source_github-2.1.35 → airbyte_source_github-2.1.36rc1}/source_github/schemas/reviews.json +0 -0
- {airbyte_source_github-2.1.35 → airbyte_source_github-2.1.36rc1}/source_github/schemas/shared/events/comment.json +0 -0
- {airbyte_source_github-2.1.35 → airbyte_source_github-2.1.36rc1}/source_github/schemas/shared/events/commented.json +0 -0
- {airbyte_source_github-2.1.35 → airbyte_source_github-2.1.36rc1}/source_github/schemas/shared/events/committed.json +0 -0
- {airbyte_source_github-2.1.35 → airbyte_source_github-2.1.36rc1}/source_github/schemas/shared/events/cross_referenced.json +0 -0
- {airbyte_source_github-2.1.35 → airbyte_source_github-2.1.36rc1}/source_github/schemas/shared/events/reviewed.json +0 -0
- {airbyte_source_github-2.1.35 → airbyte_source_github-2.1.36rc1}/source_github/schemas/shared/reaction.json +0 -0
- {airbyte_source_github-2.1.35 → airbyte_source_github-2.1.36rc1}/source_github/schemas/shared/reactions.json +0 -0
- {airbyte_source_github-2.1.35 → airbyte_source_github-2.1.36rc1}/source_github/schemas/shared/user.json +0 -0
- {airbyte_source_github-2.1.35 → airbyte_source_github-2.1.36rc1}/source_github/schemas/shared/user_graphql.json +0 -0
- {airbyte_source_github-2.1.35 → airbyte_source_github-2.1.36rc1}/source_github/schemas/stargazers.json +0 -0
- {airbyte_source_github-2.1.35 → airbyte_source_github-2.1.36rc1}/source_github/schemas/tags.json +0 -0
- {airbyte_source_github-2.1.35 → airbyte_source_github-2.1.36rc1}/source_github/schemas/team_members.json +0 -0
- {airbyte_source_github-2.1.35 → airbyte_source_github-2.1.36rc1}/source_github/schemas/team_memberships.json +0 -0
- {airbyte_source_github-2.1.35 → airbyte_source_github-2.1.36rc1}/source_github/schemas/teams.json +0 -0
- {airbyte_source_github-2.1.35 → airbyte_source_github-2.1.36rc1}/source_github/schemas/users.json +0 -0
- {airbyte_source_github-2.1.35 → airbyte_source_github-2.1.36rc1}/source_github/schemas/workflow_jobs.json +0 -0
- {airbyte_source_github-2.1.35 → airbyte_source_github-2.1.36rc1}/source_github/schemas/workflow_runs.json +0 -0
- {airbyte_source_github-2.1.35 → airbyte_source_github-2.1.36rc1}/source_github/schemas/workflows.json +0 -0
- {airbyte_source_github-2.1.35 → airbyte_source_github-2.1.36rc1}/source_github/spec.json +0 -0
- {airbyte_source_github-2.1.35 → airbyte_source_github-2.1.36rc1}/source_github/streams.py +0 -0
- {airbyte_source_github-2.1.35 → airbyte_source_github-2.1.36rc1}/source_github/utils.py +0 -0
|
@@ -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.
|
|
6
|
+
version = "2.1.36-rc.1"
|
|
7
7
|
name = "airbyte-source-github"
|
|
8
8
|
description = "Source implementation for GitHub."
|
|
9
9
|
authors = [ "Airbyte <contact@airbyte.io>",]
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
|
|
3
|
+
#
|
|
4
|
+
|
|
5
|
+
import sys
|
|
6
|
+
import traceback
|
|
7
|
+
from datetime import datetime
|
|
8
|
+
from typing import List
|
|
9
|
+
|
|
10
|
+
from orjson import orjson
|
|
11
|
+
|
|
12
|
+
from airbyte_cdk.entrypoint import AirbyteEntrypoint, launch, logger
|
|
13
|
+
from airbyte_cdk.exception_handler import init_uncaught_exception_handler
|
|
14
|
+
from airbyte_cdk.models import AirbyteErrorTraceMessage, AirbyteMessage, AirbyteMessageSerializer, AirbyteTraceMessage, TraceType, Type
|
|
15
|
+
from source_github import SourceGithub
|
|
16
|
+
from source_github.config_migrations import MigrateBranch, MigrateRepository
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def _run_migrations(args: List[str], source: SourceGithub) -> None:
|
|
20
|
+
MigrateRepository.migrate(args, source)
|
|
21
|
+
MigrateBranch.migrate(args, source)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def _get_source(args: List[str]):
|
|
25
|
+
catalog_path = AirbyteEntrypoint.extract_catalog(args)
|
|
26
|
+
config_path = AirbyteEntrypoint.extract_config(args)
|
|
27
|
+
state_path = AirbyteEntrypoint.extract_state(args)
|
|
28
|
+
try:
|
|
29
|
+
return SourceGithub(
|
|
30
|
+
SourceGithub.read_catalog(catalog_path) if catalog_path else None,
|
|
31
|
+
SourceGithub.read_config(config_path) if config_path else None,
|
|
32
|
+
SourceGithub.read_state(state_path) if state_path else None,
|
|
33
|
+
)
|
|
34
|
+
except Exception as error:
|
|
35
|
+
print(
|
|
36
|
+
orjson.dumps(
|
|
37
|
+
AirbyteMessageSerializer.dump(
|
|
38
|
+
AirbyteMessage(
|
|
39
|
+
type=Type.TRACE,
|
|
40
|
+
trace=AirbyteTraceMessage(
|
|
41
|
+
type=TraceType.ERROR,
|
|
42
|
+
emitted_at=int(datetime.now().timestamp() * 1000),
|
|
43
|
+
error=AirbyteErrorTraceMessage(
|
|
44
|
+
message=f"Error starting the sync. This could be due to an invalid configuration or catalog. Please contact Support for assistance. Error: {error}",
|
|
45
|
+
stack_trace=traceback.format_exc(),
|
|
46
|
+
),
|
|
47
|
+
),
|
|
48
|
+
)
|
|
49
|
+
)
|
|
50
|
+
).decode()
|
|
51
|
+
)
|
|
52
|
+
return None
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def run() -> None:
|
|
56
|
+
init_uncaught_exception_handler(logger)
|
|
57
|
+
_args = sys.argv[1:]
|
|
58
|
+
# Run config migrations before constructing the source so that
|
|
59
|
+
# self._config inside YamlDeclarativeSource sees the migrated config.
|
|
60
|
+
_run_migrations(_args, SourceGithub())
|
|
61
|
+
source = _get_source(_args)
|
|
62
|
+
if source:
|
|
63
|
+
launch(source, _args)
|
|
@@ -3,11 +3,21 @@
|
|
|
3
3
|
#
|
|
4
4
|
import logging
|
|
5
5
|
from os import getenv
|
|
6
|
-
from typing import Any, List, Mapping, MutableMapping, Optional, Tuple
|
|
6
|
+
from typing import Any, Iterator, List, Mapping, MutableMapping, Optional, Tuple
|
|
7
7
|
from urllib.parse import urlparse
|
|
8
8
|
|
|
9
|
-
from airbyte_cdk.models import
|
|
9
|
+
from airbyte_cdk.models import (
|
|
10
|
+
AirbyteCatalog,
|
|
11
|
+
AirbyteConnectionStatus,
|
|
12
|
+
AirbyteMessage,
|
|
13
|
+
AirbyteStateMessage,
|
|
14
|
+
ConfiguredAirbyteCatalog,
|
|
15
|
+
FailureType,
|
|
16
|
+
Status,
|
|
17
|
+
)
|
|
10
18
|
from airbyte_cdk.sources import AbstractSource
|
|
19
|
+
from airbyte_cdk.sources.declarative.yaml_declarative_source import YamlDeclarativeSource
|
|
20
|
+
from airbyte_cdk.sources.source import TState
|
|
11
21
|
from airbyte_cdk.sources.streams import Stream
|
|
12
22
|
from airbyte_cdk.sources.streams.http.requests_native_auth import MultipleTokenAuthenticator
|
|
13
23
|
from airbyte_cdk.utils.traced_exception import AirbyteTracedException
|
|
@@ -59,9 +69,70 @@ from .streams import (
|
|
|
59
69
|
from .utils import read_full_refresh
|
|
60
70
|
|
|
61
71
|
|
|
62
|
-
class SourceGithub(AbstractSource):
|
|
72
|
+
class SourceGithub(YamlDeclarativeSource, AbstractSource):
|
|
63
73
|
continue_sync_on_stream_failure = True
|
|
64
74
|
|
|
75
|
+
def __init__(
|
|
76
|
+
self,
|
|
77
|
+
catalog: Optional[ConfiguredAirbyteCatalog] = None,
|
|
78
|
+
config: Optional[Mapping[str, Any]] = None,
|
|
79
|
+
state: Optional[TState] = None,
|
|
80
|
+
) -> None:
|
|
81
|
+
super().__init__(catalog=catalog, config=config, state=state, path_to_yaml="manifest.yaml")
|
|
82
|
+
|
|
83
|
+
def check(self, logger: logging.Logger, config: Mapping[str, Any]) -> AirbyteConnectionStatus:
|
|
84
|
+
check_succeeded, error = self.check_connection(logger, config)
|
|
85
|
+
if not check_succeeded:
|
|
86
|
+
return AirbyteConnectionStatus(status=Status.FAILED, message=repr(error))
|
|
87
|
+
return AirbyteConnectionStatus(status=Status.SUCCEEDED)
|
|
88
|
+
|
|
89
|
+
def read(
|
|
90
|
+
self,
|
|
91
|
+
logger: logging.Logger,
|
|
92
|
+
config: Mapping[str, Any],
|
|
93
|
+
catalog: ConfiguredAirbyteCatalog,
|
|
94
|
+
state: Optional[List[AirbyteStateMessage]] = None,
|
|
95
|
+
) -> Iterator[AirbyteMessage]:
|
|
96
|
+
"""Route manifest streams to `ConcurrentDeclarativeSource` and Python streams to `AbstractSource`.
|
|
97
|
+
|
|
98
|
+
CDK v7 removed the `_group_streams` mechanism that CDK v6 had. This override
|
|
99
|
+
replicates that behavior: manifest-backed `AbstractStream` objects are read
|
|
100
|
+
concurrently, while regular Python `Stream` objects are read through
|
|
101
|
+
`AbstractSource.read()`.
|
|
102
|
+
|
|
103
|
+
The concurrent streams come from `super().streams()` (the manifest), which is
|
|
104
|
+
empty today and does no network work. The synchronous streams are resolved by
|
|
105
|
+
`AbstractSource.read()` itself, so `SourceGithub.streams()` (which performs live
|
|
106
|
+
org/repo resolution) is only invoked once per sync. As streams are migrated from
|
|
107
|
+
Python to the manifest, they automatically move from the synchronous to the
|
|
108
|
+
concurrent path.
|
|
109
|
+
"""
|
|
110
|
+
concurrent_streams = super().streams(config=self._config or config)
|
|
111
|
+
concurrent_stream_names = {stream.name for stream in concurrent_streams}
|
|
112
|
+
|
|
113
|
+
concurrent_catalog = ConfiguredAirbyteCatalog(streams=[s for s in catalog.streams if s.stream.name in concurrent_stream_names])
|
|
114
|
+
if concurrent_catalog.streams:
|
|
115
|
+
selected = self._select_streams(streams=concurrent_streams, configured_catalog=concurrent_catalog)
|
|
116
|
+
if selected:
|
|
117
|
+
yield from self._concurrent_source.read(selected)
|
|
118
|
+
|
|
119
|
+
synchronous_catalog = ConfiguredAirbyteCatalog(streams=[s for s in catalog.streams if s.stream.name not in concurrent_stream_names])
|
|
120
|
+
if synchronous_catalog.streams:
|
|
121
|
+
yield from AbstractSource.read(self, logger, config, synchronous_catalog, state)
|
|
122
|
+
|
|
123
|
+
def discover(self, logger: logging.Logger, config: Mapping[str, Any]) -> AirbyteCatalog:
|
|
124
|
+
"""Return the union of Python `Stream` objects and manifest-backed streams.
|
|
125
|
+
|
|
126
|
+
`ConcurrentDeclarativeSource.discover()` only reports manifest streams, so this
|
|
127
|
+
override adds the Python streams from `SourceGithub.streams()`. As streams move
|
|
128
|
+
into the manifest they leave the Python list and are reported via
|
|
129
|
+
`super().streams()`, keeping the discovered catalog complete throughout the migration.
|
|
130
|
+
"""
|
|
131
|
+
effective_config = self._config or config
|
|
132
|
+
streams = [stream.as_airbyte_stream() for stream in self.streams(config=effective_config)]
|
|
133
|
+
streams += [stream.as_airbyte_stream() for stream in super().streams(config=effective_config)]
|
|
134
|
+
return AirbyteCatalog(streams=streams)
|
|
135
|
+
|
|
65
136
|
@staticmethod
|
|
66
137
|
def _get_org_repositories(
|
|
67
138
|
config: Mapping[str, Any], authenticator: MultipleTokenAuthenticator, is_check_connection: bool = False
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
#
|
|
2
|
-
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
|
|
3
|
-
#
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import sys
|
|
7
|
-
|
|
8
|
-
from airbyte_cdk.entrypoint import launch
|
|
9
|
-
from source_github import SourceGithub
|
|
10
|
-
from source_github.config_migrations import MigrateBranch, MigrateRepository
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
def run():
|
|
14
|
-
source = SourceGithub()
|
|
15
|
-
MigrateRepository.migrate(sys.argv[1:], source)
|
|
16
|
-
MigrateBranch.migrate(sys.argv[1:], source)
|
|
17
|
-
launch(source, sys.argv[1:])
|
|
File without changes
|
|
File without changes
|
{airbyte_source_github-2.1.35 → airbyte_source_github-2.1.36rc1}/source_github/backoff_strategies.py
RENAMED
|
File without changes
|
{airbyte_source_github-2.1.35 → airbyte_source_github-2.1.36rc1}/source_github/config_migrations.py
RENAMED
|
File without changes
|
|
File without changes
|
{airbyte_source_github-2.1.35 → airbyte_source_github-2.1.36rc1}/source_github/errors_handlers.py
RENAMED
|
File without changes
|
{airbyte_source_github-2.1.35 → airbyte_source_github-2.1.36rc1}/source_github/github_schema.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{airbyte_source_github-2.1.35 → airbyte_source_github-2.1.36rc1}/source_github/schemas/branches.json
RENAMED
|
File without changes
|
|
File without changes
|
{airbyte_source_github-2.1.35 → airbyte_source_github-2.1.36rc1}/source_github/schemas/comments.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{airbyte_source_github-2.1.35 → airbyte_source_github-2.1.36rc1}/source_github/schemas/commits.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{airbyte_source_github-2.1.35 → airbyte_source_github-2.1.36rc1}/source_github/schemas/events.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{airbyte_source_github-2.1.35 → airbyte_source_github-2.1.36rc1}/source_github/schemas/issues.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{airbyte_source_github-2.1.35 → airbyte_source_github-2.1.36rc1}/source_github/schemas/projects.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{airbyte_source_github-2.1.35 → airbyte_source_github-2.1.36rc1}/source_github/schemas/releases.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{airbyte_source_github-2.1.35 → airbyte_source_github-2.1.36rc1}/source_github/schemas/reviews.json
RENAMED
|
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
|
{airbyte_source_github-2.1.35 → airbyte_source_github-2.1.36rc1}/source_github/schemas/tags.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{airbyte_source_github-2.1.35 → airbyte_source_github-2.1.36rc1}/source_github/schemas/teams.json
RENAMED
|
File without changes
|
{airbyte_source_github-2.1.35 → airbyte_source_github-2.1.36rc1}/source_github/schemas/users.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|