Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🎉 New Source: Pocket [low-code CDK] #18655

Merged
merged 21 commits into from
Nov 10, 2022
Merged

🎉 New Source: Pocket [low-code CDK] #18655

merged 21 commits into from
Nov 10, 2022

Conversation

Xabilahu
Copy link
Contributor

What

New Source: Pocket. https://getpocket.com

Screenshot from 2022-10-30 03-11-32

🚨 User Impact 🚨

Are there any breaking changes? What is the end result perceived by the user? If yes, please merge this PR with the 🚨🚨 emoji so changelog authors can further highlight this if needed.

Pre-merge Checklist

Expand the relevant checklist and delete the others.

New Connector

Community member or Airbyter

  • Community member? Grant edit access to maintainers (instructions)
  • Secrets in the connector's spec are annotated with airbyte_secret
  • Unit & integration tests added and passing. Community members, please provide proof of success locally e.g: screenshot or copy-paste unit, integration, and acceptance test output. To run acceptance tests for a Python connector, follow instructions in the README. For java connectors run ./gradlew :airbyte-integrations:connectors:<name>:integrationTest.
  • Code reviews completed
  • Documentation updated
    • Connector's README.md
    • Connector's bootstrap.md. See description and examples
    • docs/integrations/<source or destination>/<name>.md including changelog. See changelog example
    • docs/integrations/README.md
    • airbyte-integrations/builds.md
  • PR name follows PR naming conventions

Airbyter

If this is a community PR, the Airbyte engineer reviewing this PR is responsible for the below items.

  • Create a non-forked branch based on this PR and test the below items on it
  • Build is successful
  • If new credentials are required for use in CI, add them to GSM. Instructions.
  • /test connector=connectors/<name> command is passing
  • New Connector version released on Dockerhub by running the /publish command described here
  • After the connector is published, connector added to connector index as described here
  • Seed specs have been re-generated by building the platform and committing the changes to the seed spec files, as described here
Updating a connector

Community member or Airbyter

  • Grant edit access to maintainers (instructions)
  • Secrets in the connector's spec are annotated with airbyte_secret
  • Unit & integration tests added and passing. Community members, please provide proof of success locally e.g: screenshot or copy-paste unit, integration, and acceptance test output. To run acceptance tests for a Python connector, follow instructions in the README. For java connectors run ./gradlew :airbyte-integrations:connectors:<name>:integrationTest.
  • Code reviews completed
  • Documentation updated
    • Connector's README.md
    • Connector's bootstrap.md. See description and examples
    • Changelog updated in docs/integrations/<source or destination>/<name>.md including changelog. See changelog example
  • PR name follows PR naming conventions

Airbyter

If this is a community PR, the Airbyte engineer reviewing this PR is responsible for the below items.

  • Create a non-forked branch based on this PR and test the below items on it
  • Build is successful
  • If new credentials are required for use in CI, add them to GSM. Instructions.
  • /test connector=connectors/<name> command is passing
  • New Connector version released on Dockerhub and connector version bumped by running the /publish command described here
Connector Generator
  • Issue acceptance criteria met
  • PR name follows PR naming conventions
  • If adding a new generator, add it to the list of scaffold modules being tested
  • The generator test modules (all connectors with -scaffold in their name) have been updated with the latest scaffold by running ./gradlew :airbyte-integrations:connector-templates:generator:testScaffoldTemplates then checking in your changes
  • Documentation which references the generator is updated as needed

Tests

Unit

Screenshot from 2022-10-30 03-12-05

Integration

Put your integration tests output here.

Acceptance

Screenshot from 2022-10-30 02-44-59

@github-actions github-actions bot added area/connectors Connector related issues area/documentation Improvements or additions to documentation labels Oct 30, 2022
@Xabilahu
Copy link
Contributor Author

secrets/config.json being used for integ tests is:

{
  "consumer_key": "REPLACE-ME",
  "access_token": "REPLACE-ME"
}

Instructions on how to get them in docs/integrations/sources/pocket.md

@vincentkoc
Copy link
Contributor

vincentkoc commented Oct 30, 2022

/test connector=connectors/source-pocket

🕑 connectors/source-pocket https://github.com/airbytehq/airbyte/actions/runs/3356258058
❌ connectors/source-pocket https://github.com/airbytehq/airbyte/actions/runs/3356258058
🐛 https://gradle.com/s/ktlpbfva6k5io

Build Failed

Test summary info:

=========================== short test summary info ============================
ERROR test_core.py::TestSpec::test_config_match_spec[inputs0] - FileNotFoundE...
ERROR test_core.py::TestConnection::test_check[inputs0] - FileNotFoundError: ...
ERROR test_core.py::TestDiscovery::test_discover[inputs0] - FileNotFoundError...
ERROR test_core.py::TestDiscovery::test_defined_cursors_exist_in_schema[inputs0]
ERROR test_core.py::TestDiscovery::test_defined_refs_exist_in_schema[inputs0]
ERROR test_core.py::TestDiscovery::test_defined_keyword_exist_in_schema[inputs0-allOf]
ERROR test_core.py::TestDiscovery::test_defined_keyword_exist_in_schema[inputs0-not]
ERROR test_core.py::TestDiscovery::test_primary_keys_exist_in_schema[inputs0]
ERROR test_core.py::TestDiscovery::test_streams_has_sync_modes[inputs0] - Fil...
ERROR test_core.py::TestDiscovery::test_additional_properties_is_true[inputs0]
ERROR test_core.py::TestBasicRead::test_read[inputs0] - FileNotFoundError: [E...
ERROR test_core.py::TestBasicRead::test_airbyte_trace_message_on_failure[inputs0]
ERROR test_full_refresh.py::TestFullRefresh::test_sequential_reads[inputs0]
SKIPPED [1] ../usr/local/lib/python3.9/site-packages/source_acceptance_test/plugin.py:63: Skipping TestIncremental.test_two_sequential_reads: This connector does not implement incremental sync
SKIPPED [1] ../usr/local/lib/python3.9/site-packages/source_acceptance_test/tests/test_core.py:51: The previous connector image could not be retrieved.
SKIPPED [1] ../usr/local/lib/python3.9/site-packages/source_acceptance_test/tests/test_core.py:229: The previous connector image could not be retrieved.
================== 11 passed, 3 skipped, 13 errors in 11.10s ===================

@Xabilahu
Copy link
Contributor Author

/test connector=connectors/source-pocket

🕑 connectors/source-pocket https://github.com/airbytehq/airbyte/actions/runs/3356258058
❌ connectors/source-pocket https://github.com/airbytehq/airbyte/actions/runs/3356258058
🐛 https://gradle.com/s/ktlpbfva6k5io

Build Failed

Test summary info:

=========================== short test summary info ============================
ERROR test_core.py::TestSpec::test_config_match_spec[inputs0] - FileNotFoundE...
ERROR test_core.py::TestConnection::test_check[inputs0] - FileNotFoundError: ...
ERROR test_core.py::TestDiscovery::test_discover[inputs0] - FileNotFoundError...
ERROR test_core.py::TestDiscovery::test_defined_cursors_exist_in_schema[inputs0]
ERROR test_core.py::TestDiscovery::test_defined_refs_exist_in_schema[inputs0]
ERROR test_core.py::TestDiscovery::test_defined_keyword_exist_in_schema[inputs0-allOf]
ERROR test_core.py::TestDiscovery::test_defined_keyword_exist_in_schema[inputs0-not]
ERROR test_core.py::TestDiscovery::test_primary_keys_exist_in_schema[inputs0]
ERROR test_core.py::TestDiscovery::test_streams_has_sync_modes[inputs0] - Fil...
ERROR test_core.py::TestDiscovery::test_additional_properties_is_true[inputs0]
ERROR test_core.py::TestBasicRead::test_read[inputs0] - FileNotFoundError: [E...
ERROR test_core.py::TestBasicRead::test_airbyte_trace_message_on_failure[inputs0]
ERROR test_full_refresh.py::TestFullRefresh::test_sequential_reads[inputs0]
SKIPPED [1] ../usr/local/lib/python3.9/site-packages/source_acceptance_test/plugin.py:63: Skipping TestIncremental.test_two_sequential_reads: This connector does not implement incremental sync
SKIPPED [1] ../usr/local/lib/python3.9/site-packages/source_acceptance_test/tests/test_core.py:51: The previous connector image could not be retrieved.
SKIPPED [1] ../usr/local/lib/python3.9/site-packages/source_acceptance_test/tests/test_core.py:229: The previous connector image could not be retrieved.
================== 11 passed, 3 skipped, 13 errors in 11.10s ===================

It seems like it's missing the secrets/config.json. @koconder, did you create it in Github Secrets?

@vincentkoc
Copy link
Contributor

@Xabilahu this is normal as there is no test config file for this connection yet on airbyte side. Please hang tight as i review.

Copy link
Member

@marcosmarxm marcosmarxm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @Xabilahu, Marcos from Airbyte here 👋 . We received more than 25 new contributions along the weekend. One is yours 🎉 thank so much for! Our team is limited and maybe the review process can take longer than expected. As described in the Airbyte's Hacktoberfest your contribution was submitted before November 2nd and it is eligible to win the prize. The review process will validate other requirements. I ask to you patience until someone from the team review it.

Because I reviewed some contributions for Hacktoberfest so far I saw some common patterns you can check in advance:

  • Make sure you have added connector documentation to /docs/integrations/
  • Remove the file catalog from /integration_tests
  • Edit the sample_config.json inside /integration_tests
  • For the configured_catalog you can use only json_schema: {}
  • Add title to all properties in the spec.yaml
  • Make sure the documentationUrl in the spec.yaml redirect to Airbyte's future connector page, eg: connector Airtable the documentationUrl: https://docs.airbyte.com/integrations/sources/airtable
  • Review now new line at EOF (end-of-file) for all files.

If possible send to me a DM in Slack with the tests credentials, this process will make easier to us run integration tests and publish your connector. If you only has production keys, make sure to create a bootstrap.md explaining how to get the keys.

@Xabilahu
Copy link
Contributor Author

Hi @marcosmarxm, thanks for the update! Below the status of the checklist:

  • Make sure you have added connector documentation to /docs/integrations/
  • Remove the file catalog from /integration_tests
  • Edit the sample_config.json inside /integration_tests
  • For the configured_catalog you can use only json_schema: {}
  • Add title to all properties in the spec.yaml
  • Make sure the documentationUrl in the spec.yaml redirect to Airbyte's future connector page, eg: connector Airtable the documentationUrl: https://docs.airbyte.com/integrations/sources/airtable
  • Review now new line at EOF (end-of-file) for all files.

Also created the bootstrap.md file.

Copy link
Contributor

@vincentkoc vincentkoc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Xabilahu looks good, i made a few small changes. I have my API keys and will test locally shortly.

vincentkoc
vincentkoc previously approved these changes Nov 3, 2022
@vincentkoc
Copy link
Contributor

@Xabilahu @marcosmarxm all local tests passing, will get this finalised soon

@vincentkoc
Copy link
Contributor

FYI @Xabilahu

Unit Test

> Task :airbyte-integrations:connectors:source-pocket:unitTest
Name                         Stmts   Miss  Cover
------------------------------------------------
source_pocket/extractor.py      19      0   100%
source_pocket/__init__.py        3      0   100%
source_pocket/source.py          4      1    75%
------------------------------------------------
TOTAL                           26      1    96%

Acceptance Test:

=========================== short test summary info ============================
FAILED test_core.py::TestDiscovery::test_primary_keys_exist_in_schema[inputs0]
FAILED test_core.py::TestBasicRead::test_read[inputs0] - Failed: Timeout >300.0s
FAILED test_full_refresh.py::TestFullRefresh::test_sequential_reads[inputs0]
SKIPPED [1] ../usr/local/lib/python3.9/site-packages/source_acceptance_test/plugin.py:63: Skipping TestIncremental.test_two_sequential_reads: This connector does not implement incremental sync
SKIPPED [1] ../usr/local/lib/python3.9/site-packages/source_acceptance_test/tests/test_core.py:51: The previous connector image could not be retrieved.
SKIPPED [1] ../usr/local/lib/python3.9/site-packages/source_acceptance_test/tests/test_core.py:229: The previous connector image could not be retrieved.
============= 3 failed, 21 passed, 3 skipped in 431.34s (0:07:11) ==============

@Xabilahu
Copy link
Contributor Author

Xabilahu commented Nov 3, 2022

Looking at the code from .venv/lib/python3.9/site-packages/airbyte_cdk/sources/declarative_stream.py, I found out that if no schema_loader is declared in the definition YAML file, then it defaults to EmptySchemaLoader. Code below:

@dataclass
class DeclarativeStream(Stream, JsonSchemaMixin):

...

    def __post_init__(self, options: Mapping[str, Any]):
        self.stream_cursor_field = self.stream_cursor_field or []
        self.transformations = self.transformations or []
        self._schema_loader = self.schema_loader if self.schema_loader else EmptySchemaLoader(config=self.config, options=options)

I tested to create an environment from scracth with the following commands,:

python -m venv .venv
source .venv/bin/activate
pip install airbyte-cdk~=0.2 --no-cache

And, in fact, the code is the same as above. This seems like a breaking change in airbyte-cdk==0.5.2

@vincentkoc
Copy link
Contributor

@Xabilahu let me know if you need any assistance and able to work-around this or this is a bug elsewhere.

@Xabilahu
Copy link
Contributor Author

Xabilahu commented Nov 3, 2022

@Xabilahu let me know if you need any assistance and able to work-around this or this is a bug elsewhere.

@koconder I added schema_loader property as a workaround to unblock this PR.

@vincentkoc
Copy link
Contributor

@Xabilahu still an issue, see below. Are you able to run gradle command i gave you?

=========================== short test summary info ============================
FAILED test_core.py::TestBasicRead::test_read[inputs0] - Failed: Timeout >300.0s
FAILED test_full_refresh.py::TestFullRefresh::test_sequential_reads[inputs0]
SKIPPED [1] ../usr/local/lib/python3.9/site-packages/source_acceptance_test/plugin.py:63: Skipping TestIncremental.test_two_sequential_reads: This connector does not implement incremental sync
SKIPPED [1] ../usr/local/lib/python3.9/site-packages/source_acceptance_test/tests/test_core.py:51: The previous connector image could not be retrieved.
SKIPPED [1] ../usr/local/lib/python3.9/site-packages/source_acceptance_test/tests/test_core.py:229: The previous connector image could not be retrieved.
============= 2 failed, 22 passed, 3 skipped in 418.23s (0:06:58) ==============

One of the issues, not sure where/what/why

JSONDecodeError: Extra data: line 1 column 5 (char 4)

@Xabilahu
Copy link
Contributor Author

Xabilahu commented Nov 4, 2022

@koconder, as I told you in a previous comment, I'm not able to replicate those failures that you show. For me, the build passes successfully:

> ./gradlew :airbyte-integrations:connectors:source-pocket:sourceAcceptanceTest

=========================== short test summary info ============================
SKIPPED [1] ../usr/local/lib/python3.9/site-packages/source_acceptance_test/plugin.py:63: Skipping TestIncremental.test_two_sequential_reads: This connector does not implement incremental sync
SKIPPED [1] ../usr/local/lib/python3.9/site-packages/source_acceptance_test/tests/test_core.py:51: The previous connector image could not be retrieved.
SKIPPED [1] ../usr/local/lib/python3.9/site-packages/source_acceptance_test/tests/test_core.py:229: The previous connector image could not be retrieved.
======================== 24 passed, 3 skipped in 59.39s ========================

Can you please show your secrets/config.json?

@vincentkoc
Copy link
Contributor

@Xabilahu can you contact me on Airbyte slack, I'll share my test credentials there with you.

@Xabilahu
Copy link
Contributor Author

Xabilahu commented Nov 4, 2022

The issue is that the config used for acceptance tests tries to sync a huge amount of data, which doesn't fit into the 300s limit for tests.

@vincentkoc
Copy link
Contributor

As mentioned, i will see if we can adjust the tests before I finalize this PR to save the issue from re-occurring with others that will test again in future.

@sajarin sajarin added the bounty-XL Maintainer program: claimable extra large bounty PR label Nov 7, 2022
@Xabilahu
Copy link
Contributor Author

Xabilahu commented Nov 9, 2022

@koconder any updates? Do you need help?

@vincentkoc
Copy link
Contributor

@Xabilahu we will add the config to the Github Actions and attempt to finalise the acceptance tests. Once done we can merge and publish the connector :)

@vincentkoc
Copy link
Contributor

vincentkoc commented Nov 10, 2022

/test connector=connectors/source-pocket

🕑 connectors/source-pocket https://github.com/airbytehq/airbyte/actions/runs/3436131474
✅ connectors/source-pocket https://github.com/airbytehq/airbyte/actions/runs/3436131474
Python tests coverage:

Name                         Stmts   Miss  Cover
------------------------------------------------
source_pocket/extractor.py      19      0   100%
source_pocket/__init__.py        3      0   100%
source_pocket/source.py          4      1    75%
------------------------------------------------
TOTAL                           26      1    96%
	 Name                                                 Stmts   Miss  Cover   Missing
	 ----------------------------------------------------------------------------------
	 source_acceptance_test/base.py                          12      4    67%   16-19
	 source_acceptance_test/config.py                       139      5    96%   87, 93, 235, 239-240
	 source_acceptance_test/conftest.py                     196     92    53%   35, 41-43, 48, 54, 60, 66, 72-74, 93, 98-100, 106-108, 114-115, 120-121, 126, 132, 141-150, 156-161, 176, 200, 231, 237, 243-248, 256-261, 269-282, 287-293, 300-311, 318-334
	 source_acceptance_test/plugin.py                        69     25    64%   22-23, 31, 36, 120-140, 144-148
	 source_acceptance_test/tests/test_core.py              353    110    69%   53, 64-72, 77-84, 88-89, 93-94, 192, 230-247, 256-264, 268-273, 279, 312-317, 355-362, 405-407, 410, 475-483, 495-498, 503, 559-560, 566, 569, 605-615, 628-653
	 source_acceptance_test/tests/test_incremental.py       158     14    91%   52-59, 64-77, 240
	 source_acceptance_test/utils/asserts.py                 37      2    95%   57-58
	 source_acceptance_test/utils/common.py                  94     10    89%   16-17, 32-38, 72, 75
	 source_acceptance_test/utils/compare.py                 62     23    63%   21-51, 68, 97-99
	 source_acceptance_test/utils/connector_runner.py       112     50    55%   23-26, 32, 36, 39-68, 71-73, 76-78, 81-83, 86-88, 91-93, 96-114, 148-150
	 source_acceptance_test/utils/json_schema_helper.py     105     13    88%   30-31, 38, 41, 65-68, 96, 120, 190-192
	 ----------------------------------------------------------------------------------
	 TOTAL                                                 1516    348    77%

Build Passed

Test summary info:

=========================== short test summary info ============================
SKIPPED [1] ../usr/local/lib/python3.9/site-packages/source_acceptance_test/plugin.py:63: Skipping TestIncremental.test_two_sequential_reads: This connector does not implement incremental sync
SKIPPED [1] ../usr/local/lib/python3.9/site-packages/source_acceptance_test/tests/test_core.py:65: The previous connector image could not be retrieved.
SKIPPED [1] ../usr/local/lib/python3.9/site-packages/source_acceptance_test/tests/test_core.py:257: The previous connector image could not be retrieved.
======================== 25 passed, 3 skipped in 25.99s ========================

@vincentkoc vincentkoc dismissed marcosmarxm’s stale review November 10, 2022 10:51

maintainer will review those changes

@vincentkoc
Copy link
Contributor

vincentkoc commented Nov 10, 2022

/publish connector=connectors/source-pocket

🕑 Publishing the following connectors:
connectors/source-pocket
https://github.com/airbytehq/airbyte/actions/runs/3436246668


Connector Did it publish? Were definitions generated?
connectors/source-pocket

if you have connectors that successfully published but failed definition generation, follow step 4 here ▶️

@sajarin sajarin merged commit 45ad415 into airbytehq:master Nov 10, 2022
@Xabilahu Xabilahu deleted the pocket branch November 10, 2022 17:59
akashkulk pushed a commit that referenced this pull request Dec 2, 2022
* Pocket Source Connector initial implementation

* Update changelog with PR id

* Style fixes & bootstrap.md

* Delete abnormal_state.json

* Update setup.py

* Update invalid_config.json

* Delete sample_state.json

* Update retrieve.json

* Update acceptance.py

* Rename Pocket Extractor test

* Add `schema_loader` as a workaround to prevent `EmptySchemaLoader`

* auto-bump connector version

Co-authored-by: Vincent Koc <koconder@users.noreply.github.com>
Co-authored-by: Vincent Koc <koconder@gmail.com>
Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
Co-authored-by: Octavia Squidington III <octavia-squidington-iii@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/connectors Connector related issues area/documentation Improvements or additions to documentation bounty bounty-XL Maintainer program: claimable extra large bounty PR community connectors/source/pocket hacktober low-code
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

7 participants