diff --git a/airbyte-integrations/connectors/source-appstore-singer/.dockerignore b/airbyte-integrations/connectors/source-appstore-singer/.dockerignore index 5276be16e32a..fabf490b08f8 100644 --- a/airbyte-integrations/connectors/source-appstore-singer/.dockerignore +++ b/airbyte-integrations/connectors/source-appstore-singer/.dockerignore @@ -1,6 +1,6 @@ * !Dockerfile -!Dockerfile.test +!main.py !source_appstore_singer !setup.py !secrets diff --git a/airbyte-integrations/connectors/source-appstore-singer/Dockerfile b/airbyte-integrations/connectors/source-appstore-singer/Dockerfile index 4e7af33e6a15..2ebe70909645 100644 --- a/airbyte-integrations/connectors/source-appstore-singer/Dockerfile +++ b/airbyte-integrations/connectors/source-appstore-singer/Dockerfile @@ -1,17 +1,38 @@ -FROM airbyte/integration-base-singer:0.1.1 +FROM python:3.7.11-alpine3.14 as base -# Bash is installed for more convenient debugging. -RUN apt-get update && apt-get install -y bash git && rm -rf /var/lib/apt/lists/* +# build and load all requirements +FROM base as builder +WORKDIR /airbyte/integration_code + +# upgrade pip to the latest version +RUN apk --no-cache upgrade \ + && pip install --upgrade pip \ + && apk --no-cache add tzdata build-base -ENV CODE_PATH="source_appstore_singer" -ENV AIRBYTE_IMPL_MODULE="source_appstore_singer" -ENV AIRBYTE_IMPL_PATH="SourceAppstoreSinger" -ENV AIRBYTE_ENTRYPOINT "/airbyte/base.sh" -WORKDIR /airbyte/integration_code -COPY $CODE_PATH ./$CODE_PATH COPY setup.py ./ -RUN pip install . +# install necessary packages to a temporary folder +RUN pip install --prefix=/install . + +# build a clean environment +FROM base +WORKDIR /airbyte/integration_code + +# copy all loaded and built libraries to a pure basic image +COPY --from=builder /install /usr/local +# add default timezone settings +COPY --from=builder /usr/share/zoneinfo/Etc/UTC /etc/localtime +RUN echo "Etc/UTC" > /etc/timezone + +# bash is installed for more convenient debugging. +RUN apk --no-cache add bash + +# copy payload code only +COPY main.py ./ +COPY source_drift ./source_drift + +ENV AIRBYTE_ENTRYPOINT "python /airbyte/integration_code/main.py" +ENTRYPOINT ["python", "/airbyte/integration_code/main.py"] LABEL io.airbyte.version=0.2.4 LABEL io.airbyte.name=airbyte/source-appstore-singer diff --git a/airbyte-integrations/connectors/source-appstore-singer/airbyte_protocol b/airbyte-integrations/connectors/source-appstore-singer/airbyte_protocol deleted file mode 120000 index 66a1be0f906f..000000000000 --- a/airbyte-integrations/connectors/source-appstore-singer/airbyte_protocol +++ /dev/null @@ -1 +0,0 @@ -../../bases/airbyte-protocol/airbyte_protocol \ No newline at end of file diff --git a/airbyte-integrations/connectors/source-appstore-singer/base_python b/airbyte-integrations/connectors/source-appstore-singer/base_python deleted file mode 120000 index ebf099aa6bdf..000000000000 --- a/airbyte-integrations/connectors/source-appstore-singer/base_python +++ /dev/null @@ -1 +0,0 @@ -../../bases/base-python/base_python \ No newline at end of file diff --git a/airbyte-integrations/connectors/source-appstore-singer/base_singer b/airbyte-integrations/connectors/source-appstore-singer/base_singer deleted file mode 120000 index 873ffcbc1ac3..000000000000 --- a/airbyte-integrations/connectors/source-appstore-singer/base_singer +++ /dev/null @@ -1 +0,0 @@ -../../bases/base-singer/base_singer \ No newline at end of file diff --git a/airbyte-integrations/connectors/source-appstore-singer/build.gradle b/airbyte-integrations/connectors/source-appstore-singer/build.gradle index 50d457098ea8..a240672639fb 100644 --- a/airbyte-integrations/connectors/source-appstore-singer/build.gradle +++ b/airbyte-integrations/connectors/source-appstore-singer/build.gradle @@ -1,22 +1,9 @@ plugins { id 'airbyte-python' id 'airbyte-docker' -// id 'airbyte-standard-source-test-file' + id 'airbyte-source-acceptance-test' } airbytePython { moduleDirectory 'source_appstore_singer' } - -// https://github.com/airbytehq/airbyte/issues/1651 -//airbyteStandardSourceTestFile { -// // For more information on standard source tests, see https://docs.airbyte.io/connector-development/testing-connectors -// specPath = "source_appstore_singer/spec.json" -// configPath = "secrets/config.json" -// configuredCatalogPath = "sample_files/configured_catalog.json" -//} - -dependencies { - implementation files(project(':airbyte-integrations:bases:base-standard-source-test-file').airbyteDocker.outputs) - implementation files(project(':airbyte-integrations:bases:base-singer').airbyteDocker.outputs) -} diff --git a/airbyte-integrations/connectors/source-appstore-singer/main_dev.py b/airbyte-integrations/connectors/source-appstore-singer/main.py similarity index 84% rename from airbyte-integrations/connectors/source-appstore-singer/main_dev.py rename to airbyte-integrations/connectors/source-appstore-singer/main.py index 37e509533d32..38c9705f5bcd 100644 --- a/airbyte-integrations/connectors/source-appstore-singer/main_dev.py +++ b/airbyte-integrations/connectors/source-appstore-singer/main.py @@ -5,7 +5,7 @@ import sys -from base_python.entrypoint import launch +from airbyte_cdk.entrypoint import launch from source_appstore_singer import SourceAppstoreSinger if __name__ == "__main__": diff --git a/airbyte-integrations/connectors/source-appstore-singer/requirements.txt b/airbyte-integrations/connectors/source-appstore-singer/requirements.txt index a0f3f089952f..7b9114ed5867 100644 --- a/airbyte-integrations/connectors/source-appstore-singer/requirements.txt +++ b/airbyte-integrations/connectors/source-appstore-singer/requirements.txt @@ -1,5 +1,2 @@ # This file is autogenerated -- only edit if you know what you are doing. Use setup.py for declaring dependencies. --e ../../bases/airbyte-protocol --e ../../bases/base-singer --e ../../bases/base-python -e . diff --git a/airbyte-integrations/connectors/source-appstore-singer/setup.py b/airbyte-integrations/connectors/source-appstore-singer/setup.py index fc5b766e7cfd..9cd85bc0d3fd 100644 --- a/airbyte-integrations/connectors/source-appstore-singer/setup.py +++ b/airbyte-integrations/connectors/source-appstore-singer/setup.py @@ -5,20 +5,23 @@ from setuptools import find_packages, setup +MAIN_REQUIREMENTS = ["airbyte-cdk~=0.1", "appstoreconnect==0.9.0", "pyjwt==1.6.4", + "tap-appstore @ https://github.com/airbytehq/tap-appstore/tarball/v0.2.1-airbyte"] + +TEST_REQUIREMENTS = [ + "pytest~=6.1", + "pytest-mock~=3.6.1", +] + setup( name="source_appstore_singer", description="Source implementation for Appstore, built on the Singer tap implementation.", author="Airbyte", author_email="contact@airbyte.io", packages=find_packages(), - install_requires=[ - "airbyte-protocol", - "appstoreconnect==0.9.0", - "base-singer", - "base-python", - "pyjwt==1.6.4", # required by appstore connect - "pytest==6.1.2", - "tap-appstore @ https://github.com/airbytehq/tap-appstore/tarball/v0.2.1-airbyte", - ], - package_data={"": ["*.json"]}, + install_requires=MAIN_REQUIREMENTS, + package_data={"": ["*.json", "schemas/*.json", "schemas/shared/*.json"]}, + extras_require={ + "tests": TEST_REQUIREMENTS, + }, ) diff --git a/airbyte-integrations/connectors/source-appstore-singer/source_appstore_singer/source.py b/airbyte-integrations/connectors/source-appstore-singer/source_appstore_singer/source.py index 5b8aac17b1b9..6dae461651b7 100644 --- a/airbyte-integrations/connectors/source-appstore-singer/source_appstore_singer/source.py +++ b/airbyte-integrations/connectors/source-appstore-singer/source_appstore_singer/source.py @@ -7,10 +7,12 @@ from datetime import date, timedelta from typing import Dict -from airbyte_protocol import AirbyteConnectionStatus +from airbyte_cdk.models.airbyte_protocol import AirbyteConnectionStatus from appstoreconnect import Api -from base_python import AirbyteLogger -from base_singer import SingerSource, Status, SyncMode, SyncModeInfo +from airbyte_cdk.logger import AirbyteLogger +from airbyte_cdk.models import Status, SyncMode +from airbyte_cdk.sources.singer.singer_helpers import SyncModeInfo +from airbyte_cdk.sources.singer.source import SingerSource class SourceAppstoreSinger(SingerSource):