airbyte-source-github 1.5.7__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 (93) hide show
  1. airbyte-source-github-1.5.7/PKG-INFO +144 -0
  2. airbyte-source-github-1.5.7/README.md +150 -0
  3. airbyte-source-github-1.5.7/airbyte_source_github.egg-info/PKG-INFO +144 -0
  4. airbyte-source-github-1.5.7/airbyte_source_github.egg-info/SOURCES.txt +92 -0
  5. airbyte-source-github-1.5.7/airbyte_source_github.egg-info/dependency_links.txt +1 -0
  6. airbyte-source-github-1.5.7/airbyte_source_github.egg-info/entry_points.txt +2 -0
  7. airbyte-source-github-1.5.7/airbyte_source_github.egg-info/requires.txt +9 -0
  8. airbyte-source-github-1.5.7/airbyte_source_github.egg-info/top_level.txt +3 -0
  9. airbyte-source-github-1.5.7/integration_tests/__init__.py +0 -0
  10. airbyte-source-github-1.5.7/integration_tests/abnormal_state.json +237 -0
  11. airbyte-source-github-1.5.7/integration_tests/acceptance.py +16 -0
  12. airbyte-source-github-1.5.7/integration_tests/configured_catalog.json +435 -0
  13. airbyte-source-github-1.5.7/integration_tests/configured_catalog_full_refresh_test.json +415 -0
  14. airbyte-source-github-1.5.7/integration_tests/invalid_config.json +5 -0
  15. airbyte-source-github-1.5.7/integration_tests/sample_config.json +5 -0
  16. airbyte-source-github-1.5.7/integration_tests/sample_state.json +137 -0
  17. airbyte-source-github-1.5.7/setup.cfg +139 -0
  18. airbyte-source-github-1.5.7/setup.py +37 -0
  19. airbyte-source-github-1.5.7/source_github/__init__.py +27 -0
  20. airbyte-source-github-1.5.7/source_github/config_migrations.py +106 -0
  21. airbyte-source-github-1.5.7/source_github/constants.py +9 -0
  22. airbyte-source-github-1.5.7/source_github/github_schema.py +41034 -0
  23. airbyte-source-github-1.5.7/source_github/graphql.py +327 -0
  24. airbyte-source-github-1.5.7/source_github/run.py +17 -0
  25. airbyte-source-github-1.5.7/source_github/schemas/assignees.json +63 -0
  26. airbyte-source-github-1.5.7/source_github/schemas/branches.json +48 -0
  27. airbyte-source-github-1.5.7/source_github/schemas/collaborators.json +80 -0
  28. airbyte-source-github-1.5.7/source_github/schemas/comments.json +104 -0
  29. airbyte-source-github-1.5.7/source_github/schemas/commit_comment_reactions.json +4 -0
  30. airbyte-source-github-1.5.7/source_github/schemas/commit_comments.json +53 -0
  31. airbyte-source-github-1.5.7/source_github/schemas/commits.json +126 -0
  32. airbyte-source-github-1.5.7/source_github/schemas/contributor_activity.json +109 -0
  33. airbyte-source-github-1.5.7/source_github/schemas/deployments.json +77 -0
  34. airbyte-source-github-1.5.7/source_github/schemas/events.json +63 -0
  35. airbyte-source-github-1.5.7/source_github/schemas/issue_comment_reactions.json +4 -0
  36. airbyte-source-github-1.5.7/source_github/schemas/issue_events.json +335 -0
  37. airbyte-source-github-1.5.7/source_github/schemas/issue_labels.json +30 -0
  38. airbyte-source-github-1.5.7/source_github/schemas/issue_milestones.json +61 -0
  39. airbyte-source-github-1.5.7/source_github/schemas/issue_reactions.json +28 -0
  40. airbyte-source-github-1.5.7/source_github/schemas/issue_timeline_events.json +1056 -0
  41. airbyte-source-github-1.5.7/source_github/schemas/issues.json +281 -0
  42. airbyte-source-github-1.5.7/source_github/schemas/organizations.json +197 -0
  43. airbyte-source-github-1.5.7/source_github/schemas/project_cards.json +50 -0
  44. airbyte-source-github-1.5.7/source_github/schemas/project_columns.json +38 -0
  45. airbyte-source-github-1.5.7/source_github/schemas/projects.json +50 -0
  46. airbyte-source-github-1.5.7/source_github/schemas/projects_v2.json +80 -0
  47. airbyte-source-github-1.5.7/source_github/schemas/pull_request_comment_reactions.json +28 -0
  48. airbyte-source-github-1.5.7/source_github/schemas/pull_request_commits.json +122 -0
  49. airbyte-source-github-1.5.7/source_github/schemas/pull_request_stats.json +84 -0
  50. airbyte-source-github-1.5.7/source_github/schemas/pull_requests.json +363 -0
  51. airbyte-source-github-1.5.7/source_github/schemas/releases.json +126 -0
  52. airbyte-source-github-1.5.7/source_github/schemas/repositories.json +313 -0
  53. airbyte-source-github-1.5.7/source_github/schemas/review_comments.json +118 -0
  54. airbyte-source-github-1.5.7/source_github/schemas/reviews.json +69 -0
  55. airbyte-source-github-1.5.7/source_github/schemas/shared/events/comment.json +188 -0
  56. airbyte-source-github-1.5.7/source_github/schemas/shared/events/commented.json +118 -0
  57. airbyte-source-github-1.5.7/source_github/schemas/shared/events/committed.json +56 -0
  58. airbyte-source-github-1.5.7/source_github/schemas/shared/events/cross_referenced.json +784 -0
  59. airbyte-source-github-1.5.7/source_github/schemas/shared/events/reviewed.json +139 -0
  60. airbyte-source-github-1.5.7/source_github/schemas/shared/reaction.json +27 -0
  61. airbyte-source-github-1.5.7/source_github/schemas/shared/reactions.json +35 -0
  62. airbyte-source-github-1.5.7/source_github/schemas/shared/user.json +59 -0
  63. airbyte-source-github-1.5.7/source_github/schemas/shared/user_graphql.json +26 -0
  64. airbyte-source-github-1.5.7/source_github/schemas/stargazers.json +19 -0
  65. airbyte-source-github-1.5.7/source_github/schemas/tags.json +32 -0
  66. airbyte-source-github-1.5.7/source_github/schemas/team_members.json +66 -0
  67. airbyte-source-github-1.5.7/source_github/schemas/team_memberships.json +24 -0
  68. airbyte-source-github-1.5.7/source_github/schemas/teams.json +50 -0
  69. airbyte-source-github-1.5.7/source_github/schemas/users.json +63 -0
  70. airbyte-source-github-1.5.7/source_github/schemas/workflow_jobs.json +109 -0
  71. airbyte-source-github-1.5.7/source_github/schemas/workflow_runs.json +449 -0
  72. airbyte-source-github-1.5.7/source_github/schemas/workflows.json +41 -0
  73. airbyte-source-github-1.5.7/source_github/source.py +339 -0
  74. airbyte-source-github-1.5.7/source_github/spec.json +179 -0
  75. airbyte-source-github-1.5.7/source_github/streams.py +1678 -0
  76. airbyte-source-github-1.5.7/source_github/utils.py +152 -0
  77. airbyte-source-github-1.5.7/unit_tests/__init__.py +3 -0
  78. airbyte-source-github-1.5.7/unit_tests/conftest.py +29 -0
  79. airbyte-source-github-1.5.7/unit_tests/projects_v2_pull_requests_query.json +3 -0
  80. airbyte-source-github-1.5.7/unit_tests/pull_request_stats_query.json +3 -0
  81. airbyte-source-github-1.5.7/unit_tests/responses/contributor_activity_response.json +33 -0
  82. airbyte-source-github-1.5.7/unit_tests/responses/graphql_reviews_responses.json +405 -0
  83. airbyte-source-github-1.5.7/unit_tests/responses/issue_timeline_events.json +166 -0
  84. airbyte-source-github-1.5.7/unit_tests/responses/issue_timeline_events_response.json +170 -0
  85. airbyte-source-github-1.5.7/unit_tests/responses/projects_v2_response.json +45 -0
  86. airbyte-source-github-1.5.7/unit_tests/responses/pull_request_comment_reactions.json +744 -0
  87. airbyte-source-github-1.5.7/unit_tests/responses/pull_request_stats_response.json +317 -0
  88. airbyte-source-github-1.5.7/unit_tests/test_migrations/test_config.json +8 -0
  89. airbyte-source-github-1.5.7/unit_tests/test_migrations/test_new_config.json +8 -0
  90. airbyte-source-github-1.5.7/unit_tests/test_multiple_token_authenticator.py +160 -0
  91. airbyte-source-github-1.5.7/unit_tests/test_source.py +326 -0
  92. airbyte-source-github-1.5.7/unit_tests/test_stream.py +1471 -0
  93. airbyte-source-github-1.5.7/unit_tests/utils.py +78 -0
@@ -0,0 +1,144 @@
1
+ Metadata-Version: 2.1
2
+ Name: airbyte-source-github
3
+ Version: 1.5.7
4
+ Summary: Source implementation for Github.
5
+ Author: Airbyte
6
+ Author-email: contact@airbyte.io
7
+ Description-Content-Type: text/markdown
8
+ Requires-Dist: airbyte-cdk
9
+ Requires-Dist: sgqlc
10
+ Provides-Extra: tests
11
+ Requires-Dist: requests-mock~=1.9.3; extra == "tests"
12
+ Requires-Dist: pytest-mock~=3.6.1; extra == "tests"
13
+ Requires-Dist: pytest~=6.2; extra == "tests"
14
+ Requires-Dist: responses~=0.23.1; extra == "tests"
15
+ Requires-Dist: freezegun~=1.2; extra == "tests"
16
+
17
+ # Github Source
18
+
19
+ This is the repository for the Github source connector, written in Python.
20
+ For information about how to use this connector within Airbyte, see [the documentation](https://docs.airbyte.io/integrations/sources/github).
21
+
22
+
23
+ **To iterate on this connector, make sure to complete this prerequisites section.**
24
+
25
+
26
+ From this connector directory, create a virtual environment:
27
+ ```
28
+ python -m venv .venv
29
+ ```
30
+
31
+ This will generate a virtualenv for this module in `.venv/`. Make sure this venv is active in your
32
+ development environment of choice. To activate it from the terminal, run:
33
+ ```
34
+ source .venv/bin/activate
35
+ pip install -r requirements.txt
36
+ pip install '.[tests]'
37
+ ```
38
+ If you are in an IDE, follow your IDE's instructions to activate the virtualenv.
39
+
40
+ Note that while we are installing dependencies from `requirements.txt`, you should only edit `setup.py` for your dependencies. `requirements.txt` is
41
+ used for editable installs (`pip install -e`) to pull in Python dependencies from the monorepo and will call `setup.py`.
42
+ If this is mumbo jumbo to you, don't worry about it, just put your deps in `setup.py` but install using `pip install -r requirements.txt` and everything
43
+ should work as you expect.
44
+
45
+ **If you are a community contributor**, follow the instructions in the [documentation](https://docs.airbyte.io/integrations/sources/github)
46
+ to generate the necessary credentials. Then create a file `secrets/config.json` conforming to the `source_github/spec.json` file.
47
+ Note that any directory named `secrets` is gitignored across the entire Airbyte repo, so there is no danger of accidentally checking in sensitive information.
48
+ See `integration_tests/sample_config.json` for a sample config file.
49
+
50
+ **If you are an Airbyte core member**, copy the credentials in Lastpass under the secret name `source github test creds`
51
+ and place them into `secrets/config.json`.
52
+
53
+ ```
54
+ python main.py spec
55
+ python main.py check --config secrets/config.json
56
+ python main.py discover --config secrets/config.json
57
+ python main.py read --config secrets/config.json --catalog integration_tests/configured_catalog.json
58
+ ```
59
+
60
+
61
+
62
+
63
+ The Airbyte way of building this connector is to use our `airbyte-ci` tool.
64
+ You can follow install instructions [here](https://github.com/airbytehq/airbyte/blob/master/airbyte-ci/connectors/pipelines/README.md#L1).
65
+ Then running the following command will build your connector:
66
+
67
+ ```bash
68
+ airbyte-ci connectors --name=source-github build
69
+ ```
70
+ Once the command is done, you will find your connector image in your local docker registry: `airbyte/source-github:dev`.
71
+
72
+ When contributing on our connector you might need to customize the build process to add a system dependency or set an env var.
73
+ You can customize our build process by adding a `build_customization.py` module to your connector.
74
+ This module should contain a `pre_connector_install` and `post_connector_install` async function that will mutate the base image and the connector container respectively.
75
+ It will be imported at runtime by our build process and the functions will be called if they exist.
76
+
77
+ Here is an example of a `build_customization.py` module:
78
+ ```python
79
+ from __future__ import annotations
80
+
81
+ from typing import TYPE_CHECKING
82
+
83
+ if TYPE_CHECKING:
84
+ from dagger import Container
85
+
86
+
87
+ async def pre_connector_install(base_image_container: Container) -> Container:
88
+ return await base_image_container.with_env_variable("MY_PRE_BUILD_ENV_VAR", "my_pre_build_env_var_value")
89
+
90
+ async def post_connector_install(connector_container: Container) -> Container:
91
+ return await connector_container.with_env_variable("MY_POST_BUILD_ENV_VAR", "my_post_build_env_var_value")
92
+ ```
93
+
94
+ This connector is built using our dynamic built process in `airbyte-ci`.
95
+ The base image used to build it is defined within the metadata.yaml file under the `connectorBuildOptions`.
96
+ The build logic is defined using [Dagger](https://dagger.io/) [here](https://github.com/airbytehq/airbyte/blob/master/airbyte-ci/connectors/pipelines/pipelines/builds/python_connectors.py).
97
+ It does not rely on a Dockerfile.
98
+
99
+ If you would like to patch our connector and build your own a simple approach would be to:
100
+
101
+ 1. Create your own Dockerfile based on the latest version of the connector image.
102
+ ```Dockerfile
103
+ FROM airbyte/source-github:latest
104
+
105
+ COPY . ./airbyte/integration_code
106
+ RUN pip install ./airbyte/integration_code
107
+
108
+ ```
109
+ Please use this as an example. This is not optimized.
110
+
111
+ 2. Build your image:
112
+ ```bash
113
+ docker build -t airbyte/source-github:dev .
114
+ docker run airbyte/source-github:dev spec
115
+ ```
116
+ Then run any of the connector commands as follows:
117
+ ```
118
+ docker run --rm airbyte/source-github:dev spec
119
+ docker run --rm -v $(pwd)/secrets:/secrets airbyte/source-github:dev check --config /secrets/config.json
120
+ docker run --rm -v $(pwd)/secrets:/secrets airbyte/source-github:dev discover --config /secrets/config.json
121
+ docker run --rm -v $(pwd)/secrets:/secrets -v $(pwd)/integration_tests:/integration_tests airbyte/source-github:dev read --config /secrets/config.json --catalog /integration_tests/configured_catalog.json
122
+ ```
123
+
124
+ You can run our full test suite locally using [`airbyte-ci`](https://github.com/airbytehq/airbyte/blob/master/airbyte-ci/connectors/pipelines/README.md):
125
+ ```bash
126
+ airbyte-ci connectors --name=source-github test
127
+ ```
128
+
129
+ Customize `acceptance-test-config.yml` file to configure tests. See [Connector Acceptance Tests](https://docs.airbyte.com/connector-development/testing-connectors/connector-acceptance-tests-reference) for more information.
130
+ If your connector requires to create or destroy resources for use during acceptance tests create fixtures for it and place them inside integration_tests/acceptance.py.
131
+
132
+ All of your dependencies should go in `setup.py`, NOT `requirements.txt`. The requirements file is only used to connect internal Airbyte dependencies in the monorepo for local development.
133
+ We split dependencies between two groups, dependencies that are:
134
+ * required for your connector to work need to go to `MAIN_REQUIREMENTS` list.
135
+ * required for the testing need to go to `TEST_REQUIREMENTS` list
136
+
137
+ You've checked out the repo, implemented a million dollar feature, and you're ready to share your changes with the world. Now what?
138
+ 1. Make sure your changes are passing our test suite: `airbyte-ci connectors --name=source-github test`
139
+ 2. Bump the connector version in `metadata.yaml`: increment the `dockerImageTag` value. Please follow [semantic versioning for connectors](https://docs.airbyte.com/contributing-to-airbyte/resources/pull-requests-handbook/#semantic-versioning-for-connectors).
140
+ 3. Make sure the `metadata.yaml` content is up to date.
141
+ 4. Make the connector documentation and its changelog is up to date (`docs/integrations/sources/github.md`).
142
+ 5. Create a Pull Request: use [our PR naming conventions](https://docs.airbyte.com/contributing-to-airbyte/resources/pull-requests-handbook/#pull-request-title-convention).
143
+ 6. Pat yourself on the back for being an awesome contributor.
144
+ 7. Someone from Airbyte will take a look at your PR and iterate with you to merge it into master.
@@ -0,0 +1,150 @@
1
+ # Github Source
2
+
3
+ This is the repository for the Github source connector, written in Python.
4
+ For information about how to use this connector within Airbyte, see [the documentation](https://docs.airbyte.io/integrations/sources/github).
5
+
6
+ ## Local development
7
+
8
+ ### Prerequisites
9
+ **To iterate on this connector, make sure to complete this prerequisites section.**
10
+
11
+ #### Minimum Python version required `= 3.7.0`
12
+
13
+ #### Build & Activate Virtual Environment and install dependencies
14
+ From this connector directory, create a virtual environment:
15
+ ```
16
+ python -m venv .venv
17
+ ```
18
+
19
+ This will generate a virtualenv for this module in `.venv/`. Make sure this venv is active in your
20
+ development environment of choice. To activate it from the terminal, run:
21
+ ```
22
+ source .venv/bin/activate
23
+ pip install -r requirements.txt
24
+ pip install '.[tests]'
25
+ ```
26
+ If you are in an IDE, follow your IDE's instructions to activate the virtualenv.
27
+
28
+ Note that while we are installing dependencies from `requirements.txt`, you should only edit `setup.py` for your dependencies. `requirements.txt` is
29
+ used for editable installs (`pip install -e`) to pull in Python dependencies from the monorepo and will call `setup.py`.
30
+ If this is mumbo jumbo to you, don't worry about it, just put your deps in `setup.py` but install using `pip install -r requirements.txt` and everything
31
+ should work as you expect.
32
+
33
+ #### Create credentials
34
+ **If you are a community contributor**, follow the instructions in the [documentation](https://docs.airbyte.io/integrations/sources/github)
35
+ to generate the necessary credentials. Then create a file `secrets/config.json` conforming to the `source_github/spec.json` file.
36
+ Note that any directory named `secrets` is gitignored across the entire Airbyte repo, so there is no danger of accidentally checking in sensitive information.
37
+ See `integration_tests/sample_config.json` for a sample config file.
38
+
39
+ **If you are an Airbyte core member**, copy the credentials in Lastpass under the secret name `source github test creds`
40
+ and place them into `secrets/config.json`.
41
+
42
+ ### Locally running the connector
43
+ ```
44
+ python main.py spec
45
+ python main.py check --config secrets/config.json
46
+ python main.py discover --config secrets/config.json
47
+ python main.py read --config secrets/config.json --catalog integration_tests/configured_catalog.json
48
+ ```
49
+
50
+ ### Locally running the connector docker image
51
+
52
+
53
+
54
+ #### Use `airbyte-ci` to build your connector
55
+ The Airbyte way of building this connector is to use our `airbyte-ci` tool.
56
+ You can follow install instructions [here](https://github.com/airbytehq/airbyte/blob/master/airbyte-ci/connectors/pipelines/README.md#L1).
57
+ Then running the following command will build your connector:
58
+
59
+ ```bash
60
+ airbyte-ci connectors --name=source-github build
61
+ ```
62
+ Once the command is done, you will find your connector image in your local docker registry: `airbyte/source-github:dev`.
63
+
64
+ ##### Customizing our build process
65
+ When contributing on our connector you might need to customize the build process to add a system dependency or set an env var.
66
+ You can customize our build process by adding a `build_customization.py` module to your connector.
67
+ This module should contain a `pre_connector_install` and `post_connector_install` async function that will mutate the base image and the connector container respectively.
68
+ It will be imported at runtime by our build process and the functions will be called if they exist.
69
+
70
+ Here is an example of a `build_customization.py` module:
71
+ ```python
72
+ from __future__ import annotations
73
+
74
+ from typing import TYPE_CHECKING
75
+
76
+ if TYPE_CHECKING:
77
+ # Feel free to check the dagger documentation for more information on the Container object and its methods.
78
+ # https://dagger-io.readthedocs.io/en/sdk-python-v0.6.4/
79
+ from dagger import Container
80
+
81
+
82
+ async def pre_connector_install(base_image_container: Container) -> Container:
83
+ return await base_image_container.with_env_variable("MY_PRE_BUILD_ENV_VAR", "my_pre_build_env_var_value")
84
+
85
+ async def post_connector_install(connector_container: Container) -> Container:
86
+ return await connector_container.with_env_variable("MY_POST_BUILD_ENV_VAR", "my_post_build_env_var_value")
87
+ ```
88
+
89
+ #### Build your own connector image
90
+ This connector is built using our dynamic built process in `airbyte-ci`.
91
+ The base image used to build it is defined within the metadata.yaml file under the `connectorBuildOptions`.
92
+ The build logic is defined using [Dagger](https://dagger.io/) [here](https://github.com/airbytehq/airbyte/blob/master/airbyte-ci/connectors/pipelines/pipelines/builds/python_connectors.py).
93
+ It does not rely on a Dockerfile.
94
+
95
+ If you would like to patch our connector and build your own a simple approach would be to:
96
+
97
+ 1. Create your own Dockerfile based on the latest version of the connector image.
98
+ ```Dockerfile
99
+ FROM airbyte/source-github:latest
100
+
101
+ COPY . ./airbyte/integration_code
102
+ RUN pip install ./airbyte/integration_code
103
+
104
+ # The entrypoint and default env vars are already set in the base image
105
+ # ENV AIRBYTE_ENTRYPOINT "python /airbyte/integration_code/main.py"
106
+ # ENTRYPOINT ["python", "/airbyte/integration_code/main.py"]
107
+ ```
108
+ Please use this as an example. This is not optimized.
109
+
110
+ 2. Build your image:
111
+ ```bash
112
+ docker build -t airbyte/source-github:dev .
113
+ # Running the spec command against your patched connector
114
+ docker run airbyte/source-github:dev spec
115
+ ```
116
+ #### Run
117
+ Then run any of the connector commands as follows:
118
+ ```
119
+ docker run --rm airbyte/source-github:dev spec
120
+ docker run --rm -v $(pwd)/secrets:/secrets airbyte/source-github:dev check --config /secrets/config.json
121
+ docker run --rm -v $(pwd)/secrets:/secrets airbyte/source-github:dev discover --config /secrets/config.json
122
+ docker run --rm -v $(pwd)/secrets:/secrets -v $(pwd)/integration_tests:/integration_tests airbyte/source-github:dev read --config /secrets/config.json --catalog /integration_tests/configured_catalog.json
123
+ ```
124
+
125
+ ## Testing
126
+ You can run our full test suite locally using [`airbyte-ci`](https://github.com/airbytehq/airbyte/blob/master/airbyte-ci/connectors/pipelines/README.md):
127
+ ```bash
128
+ airbyte-ci connectors --name=source-github test
129
+ ```
130
+
131
+ ### Customizing acceptance Tests
132
+ Customize `acceptance-test-config.yml` file to configure tests. See [Connector Acceptance Tests](https://docs.airbyte.com/connector-development/testing-connectors/connector-acceptance-tests-reference) for more information.
133
+ If your connector requires to create or destroy resources for use during acceptance tests create fixtures for it and place them inside integration_tests/acceptance.py.
134
+
135
+ ## Dependency Management
136
+ All of your dependencies should go in `setup.py`, NOT `requirements.txt`. The requirements file is only used to connect internal Airbyte dependencies in the monorepo for local development.
137
+ We split dependencies between two groups, dependencies that are:
138
+ * required for your connector to work need to go to `MAIN_REQUIREMENTS` list.
139
+ * required for the testing need to go to `TEST_REQUIREMENTS` list
140
+
141
+ ### Publishing a new version of the connector
142
+ You've checked out the repo, implemented a million dollar feature, and you're ready to share your changes with the world. Now what?
143
+ 1. Make sure your changes are passing our test suite: `airbyte-ci connectors --name=source-github test`
144
+ 2. Bump the connector version in `metadata.yaml`: increment the `dockerImageTag` value. Please follow [semantic versioning for connectors](https://docs.airbyte.com/contributing-to-airbyte/resources/pull-requests-handbook/#semantic-versioning-for-connectors).
145
+ 3. Make sure the `metadata.yaml` content is up to date.
146
+ 4. Make the connector documentation and its changelog is up to date (`docs/integrations/sources/github.md`).
147
+ 5. Create a Pull Request: use [our PR naming conventions](https://docs.airbyte.com/contributing-to-airbyte/resources/pull-requests-handbook/#pull-request-title-convention).
148
+ 6. Pat yourself on the back for being an awesome contributor.
149
+ 7. Someone from Airbyte will take a look at your PR and iterate with you to merge it into master.
150
+
@@ -0,0 +1,144 @@
1
+ Metadata-Version: 2.1
2
+ Name: airbyte-source-github
3
+ Version: 1.5.7
4
+ Summary: Source implementation for Github.
5
+ Author: Airbyte
6
+ Author-email: contact@airbyte.io
7
+ Description-Content-Type: text/markdown
8
+ Requires-Dist: airbyte-cdk
9
+ Requires-Dist: sgqlc
10
+ Provides-Extra: tests
11
+ Requires-Dist: requests-mock~=1.9.3; extra == "tests"
12
+ Requires-Dist: pytest-mock~=3.6.1; extra == "tests"
13
+ Requires-Dist: pytest~=6.2; extra == "tests"
14
+ Requires-Dist: responses~=0.23.1; extra == "tests"
15
+ Requires-Dist: freezegun~=1.2; extra == "tests"
16
+
17
+ # Github Source
18
+
19
+ This is the repository for the Github source connector, written in Python.
20
+ For information about how to use this connector within Airbyte, see [the documentation](https://docs.airbyte.io/integrations/sources/github).
21
+
22
+
23
+ **To iterate on this connector, make sure to complete this prerequisites section.**
24
+
25
+
26
+ From this connector directory, create a virtual environment:
27
+ ```
28
+ python -m venv .venv
29
+ ```
30
+
31
+ This will generate a virtualenv for this module in `.venv/`. Make sure this venv is active in your
32
+ development environment of choice. To activate it from the terminal, run:
33
+ ```
34
+ source .venv/bin/activate
35
+ pip install -r requirements.txt
36
+ pip install '.[tests]'
37
+ ```
38
+ If you are in an IDE, follow your IDE's instructions to activate the virtualenv.
39
+
40
+ Note that while we are installing dependencies from `requirements.txt`, you should only edit `setup.py` for your dependencies. `requirements.txt` is
41
+ used for editable installs (`pip install -e`) to pull in Python dependencies from the monorepo and will call `setup.py`.
42
+ If this is mumbo jumbo to you, don't worry about it, just put your deps in `setup.py` but install using `pip install -r requirements.txt` and everything
43
+ should work as you expect.
44
+
45
+ **If you are a community contributor**, follow the instructions in the [documentation](https://docs.airbyte.io/integrations/sources/github)
46
+ to generate the necessary credentials. Then create a file `secrets/config.json` conforming to the `source_github/spec.json` file.
47
+ Note that any directory named `secrets` is gitignored across the entire Airbyte repo, so there is no danger of accidentally checking in sensitive information.
48
+ See `integration_tests/sample_config.json` for a sample config file.
49
+
50
+ **If you are an Airbyte core member**, copy the credentials in Lastpass under the secret name `source github test creds`
51
+ and place them into `secrets/config.json`.
52
+
53
+ ```
54
+ python main.py spec
55
+ python main.py check --config secrets/config.json
56
+ python main.py discover --config secrets/config.json
57
+ python main.py read --config secrets/config.json --catalog integration_tests/configured_catalog.json
58
+ ```
59
+
60
+
61
+
62
+
63
+ The Airbyte way of building this connector is to use our `airbyte-ci` tool.
64
+ You can follow install instructions [here](https://github.com/airbytehq/airbyte/blob/master/airbyte-ci/connectors/pipelines/README.md#L1).
65
+ Then running the following command will build your connector:
66
+
67
+ ```bash
68
+ airbyte-ci connectors --name=source-github build
69
+ ```
70
+ Once the command is done, you will find your connector image in your local docker registry: `airbyte/source-github:dev`.
71
+
72
+ When contributing on our connector you might need to customize the build process to add a system dependency or set an env var.
73
+ You can customize our build process by adding a `build_customization.py` module to your connector.
74
+ This module should contain a `pre_connector_install` and `post_connector_install` async function that will mutate the base image and the connector container respectively.
75
+ It will be imported at runtime by our build process and the functions will be called if they exist.
76
+
77
+ Here is an example of a `build_customization.py` module:
78
+ ```python
79
+ from __future__ import annotations
80
+
81
+ from typing import TYPE_CHECKING
82
+
83
+ if TYPE_CHECKING:
84
+ from dagger import Container
85
+
86
+
87
+ async def pre_connector_install(base_image_container: Container) -> Container:
88
+ return await base_image_container.with_env_variable("MY_PRE_BUILD_ENV_VAR", "my_pre_build_env_var_value")
89
+
90
+ async def post_connector_install(connector_container: Container) -> Container:
91
+ return await connector_container.with_env_variable("MY_POST_BUILD_ENV_VAR", "my_post_build_env_var_value")
92
+ ```
93
+
94
+ This connector is built using our dynamic built process in `airbyte-ci`.
95
+ The base image used to build it is defined within the metadata.yaml file under the `connectorBuildOptions`.
96
+ The build logic is defined using [Dagger](https://dagger.io/) [here](https://github.com/airbytehq/airbyte/blob/master/airbyte-ci/connectors/pipelines/pipelines/builds/python_connectors.py).
97
+ It does not rely on a Dockerfile.
98
+
99
+ If you would like to patch our connector and build your own a simple approach would be to:
100
+
101
+ 1. Create your own Dockerfile based on the latest version of the connector image.
102
+ ```Dockerfile
103
+ FROM airbyte/source-github:latest
104
+
105
+ COPY . ./airbyte/integration_code
106
+ RUN pip install ./airbyte/integration_code
107
+
108
+ ```
109
+ Please use this as an example. This is not optimized.
110
+
111
+ 2. Build your image:
112
+ ```bash
113
+ docker build -t airbyte/source-github:dev .
114
+ docker run airbyte/source-github:dev spec
115
+ ```
116
+ Then run any of the connector commands as follows:
117
+ ```
118
+ docker run --rm airbyte/source-github:dev spec
119
+ docker run --rm -v $(pwd)/secrets:/secrets airbyte/source-github:dev check --config /secrets/config.json
120
+ docker run --rm -v $(pwd)/secrets:/secrets airbyte/source-github:dev discover --config /secrets/config.json
121
+ docker run --rm -v $(pwd)/secrets:/secrets -v $(pwd)/integration_tests:/integration_tests airbyte/source-github:dev read --config /secrets/config.json --catalog /integration_tests/configured_catalog.json
122
+ ```
123
+
124
+ You can run our full test suite locally using [`airbyte-ci`](https://github.com/airbytehq/airbyte/blob/master/airbyte-ci/connectors/pipelines/README.md):
125
+ ```bash
126
+ airbyte-ci connectors --name=source-github test
127
+ ```
128
+
129
+ Customize `acceptance-test-config.yml` file to configure tests. See [Connector Acceptance Tests](https://docs.airbyte.com/connector-development/testing-connectors/connector-acceptance-tests-reference) for more information.
130
+ If your connector requires to create or destroy resources for use during acceptance tests create fixtures for it and place them inside integration_tests/acceptance.py.
131
+
132
+ All of your dependencies should go in `setup.py`, NOT `requirements.txt`. The requirements file is only used to connect internal Airbyte dependencies in the monorepo for local development.
133
+ We split dependencies between two groups, dependencies that are:
134
+ * required for your connector to work need to go to `MAIN_REQUIREMENTS` list.
135
+ * required for the testing need to go to `TEST_REQUIREMENTS` list
136
+
137
+ You've checked out the repo, implemented a million dollar feature, and you're ready to share your changes with the world. Now what?
138
+ 1. Make sure your changes are passing our test suite: `airbyte-ci connectors --name=source-github test`
139
+ 2. Bump the connector version in `metadata.yaml`: increment the `dockerImageTag` value. Please follow [semantic versioning for connectors](https://docs.airbyte.com/contributing-to-airbyte/resources/pull-requests-handbook/#semantic-versioning-for-connectors).
140
+ 3. Make sure the `metadata.yaml` content is up to date.
141
+ 4. Make the connector documentation and its changelog is up to date (`docs/integrations/sources/github.md`).
142
+ 5. Create a Pull Request: use [our PR naming conventions](https://docs.airbyte.com/contributing-to-airbyte/resources/pull-requests-handbook/#pull-request-title-convention).
143
+ 6. Pat yourself on the back for being an awesome contributor.
144
+ 7. Someone from Airbyte will take a look at your PR and iterate with you to merge it into master.
@@ -0,0 +1,92 @@
1
+ README.md
2
+ setup.cfg
3
+ setup.py
4
+ airbyte_source_github.egg-info/PKG-INFO
5
+ airbyte_source_github.egg-info/SOURCES.txt
6
+ airbyte_source_github.egg-info/dependency_links.txt
7
+ airbyte_source_github.egg-info/entry_points.txt
8
+ airbyte_source_github.egg-info/requires.txt
9
+ airbyte_source_github.egg-info/top_level.txt
10
+ integration_tests/__init__.py
11
+ integration_tests/abnormal_state.json
12
+ integration_tests/acceptance.py
13
+ integration_tests/configured_catalog.json
14
+ integration_tests/configured_catalog_full_refresh_test.json
15
+ integration_tests/invalid_config.json
16
+ integration_tests/sample_config.json
17
+ integration_tests/sample_state.json
18
+ source_github/__init__.py
19
+ source_github/config_migrations.py
20
+ source_github/constants.py
21
+ source_github/github_schema.py
22
+ source_github/graphql.py
23
+ source_github/run.py
24
+ source_github/source.py
25
+ source_github/spec.json
26
+ source_github/streams.py
27
+ source_github/utils.py
28
+ source_github/schemas/assignees.json
29
+ source_github/schemas/branches.json
30
+ source_github/schemas/collaborators.json
31
+ source_github/schemas/comments.json
32
+ source_github/schemas/commit_comment_reactions.json
33
+ source_github/schemas/commit_comments.json
34
+ source_github/schemas/commits.json
35
+ source_github/schemas/contributor_activity.json
36
+ source_github/schemas/deployments.json
37
+ source_github/schemas/events.json
38
+ source_github/schemas/issue_comment_reactions.json
39
+ source_github/schemas/issue_events.json
40
+ source_github/schemas/issue_labels.json
41
+ source_github/schemas/issue_milestones.json
42
+ source_github/schemas/issue_reactions.json
43
+ source_github/schemas/issue_timeline_events.json
44
+ source_github/schemas/issues.json
45
+ source_github/schemas/organizations.json
46
+ source_github/schemas/project_cards.json
47
+ source_github/schemas/project_columns.json
48
+ source_github/schemas/projects.json
49
+ source_github/schemas/projects_v2.json
50
+ source_github/schemas/pull_request_comment_reactions.json
51
+ source_github/schemas/pull_request_commits.json
52
+ source_github/schemas/pull_request_stats.json
53
+ source_github/schemas/pull_requests.json
54
+ source_github/schemas/releases.json
55
+ source_github/schemas/repositories.json
56
+ source_github/schemas/review_comments.json
57
+ source_github/schemas/reviews.json
58
+ source_github/schemas/stargazers.json
59
+ source_github/schemas/tags.json
60
+ source_github/schemas/team_members.json
61
+ source_github/schemas/team_memberships.json
62
+ source_github/schemas/teams.json
63
+ source_github/schemas/users.json
64
+ source_github/schemas/workflow_jobs.json
65
+ source_github/schemas/workflow_runs.json
66
+ source_github/schemas/workflows.json
67
+ source_github/schemas/shared/reaction.json
68
+ source_github/schemas/shared/reactions.json
69
+ source_github/schemas/shared/user.json
70
+ source_github/schemas/shared/user_graphql.json
71
+ source_github/schemas/shared/events/comment.json
72
+ source_github/schemas/shared/events/commented.json
73
+ source_github/schemas/shared/events/committed.json
74
+ source_github/schemas/shared/events/cross_referenced.json
75
+ source_github/schemas/shared/events/reviewed.json
76
+ unit_tests/__init__.py
77
+ unit_tests/conftest.py
78
+ unit_tests/projects_v2_pull_requests_query.json
79
+ unit_tests/pull_request_stats_query.json
80
+ unit_tests/test_multiple_token_authenticator.py
81
+ unit_tests/test_source.py
82
+ unit_tests/test_stream.py
83
+ unit_tests/utils.py
84
+ unit_tests/responses/contributor_activity_response.json
85
+ unit_tests/responses/graphql_reviews_responses.json
86
+ unit_tests/responses/issue_timeline_events.json
87
+ unit_tests/responses/issue_timeline_events_response.json
88
+ unit_tests/responses/projects_v2_response.json
89
+ unit_tests/responses/pull_request_comment_reactions.json
90
+ unit_tests/responses/pull_request_stats_response.json
91
+ unit_tests/test_migrations/test_config.json
92
+ unit_tests/test_migrations/test_new_config.json
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ source-github = source_github.run:run
@@ -0,0 +1,9 @@
1
+ airbyte-cdk
2
+ sgqlc
3
+
4
+ [tests]
5
+ requests-mock~=1.9.3
6
+ pytest-mock~=3.6.1
7
+ pytest~=6.2
8
+ responses~=0.23.1
9
+ freezegun~=1.2
@@ -0,0 +1,3 @@
1
+ integration_tests
2
+ source_github
3
+ unit_tests