Skip to content

Commit

Permalink
Source Appstore Singer #7652 - migrate to the CDK
Browse files Browse the repository at this point in the history
  • Loading branch information
vitaliizazmic committed Nov 4, 2021
1 parent cddfeea commit 7d1140b
Show file tree
Hide file tree
Showing 10 changed files with 52 additions and 45 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
*
!Dockerfile
!Dockerfile.test
!main.py
!source_appstore_singer
!setup.py
!secrets
41 changes: 31 additions & 10 deletions airbyte-integrations/connectors/source-appstore-singer/Dockerfile
Original file line number Diff line number Diff line change
@@ -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

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -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)
}
Original file line number Diff line number Diff line change
Expand Up @@ -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__":
Expand Down
Original file line number Diff line number Diff line change
@@ -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 .
23 changes: 13 additions & 10 deletions airbyte-integrations/connectors/source-appstore-singer/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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="[email protected]",
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,
},
)
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 7d1140b

Please sign in to comment.