Skip to content

Commit

Permalink
Merge pull request #1 from davinchia/davinchia/create-pypi-module
Browse files Browse the repository at this point in the history
Davinchia/create pypi module
  • Loading branch information
davinchia authored Apr 30, 2021
2 parents 4c33c04 + 2d02ccb commit c5570f4
Show file tree
Hide file tree
Showing 8 changed files with 209 additions and 23 deletions.
23 changes: 20 additions & 3 deletions .github/workflows/publish-cdk-command.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: publish-cdk
name: Publish CDK
on:
workflow_dispatch:
inputs:
Expand All @@ -10,8 +10,25 @@ jobs:
publish-cdk:
runs-on: ubuntu-latest
steps:
- name: Echo
run: echo 'Hello World!'
- name: Link comment to workflow run
if: github.event.inputs.comment-id
uses: peter-evans/create-or-update-comment@v1
with:
comment-id: ${{ github.event.inputs.comment-id }}
body: |
> :clock2: ${{github.event.inputs.connector}} https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}
- name: Checkout Airbyte
uses: actions/checkout@v2
- name: Publish Python Package
uses: mariamrf/[email protected]
with:
python_version: '3.7.9'
pip_version: '21.1'
subdir: 'airbyte-cdk/python/'
env:
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }}
TWINE_REPOSITORY_URL: 'https://test.pypi.org/legacy/'
- name: Add Success Comment
if: github.event.inputs.comment-id && success()
uses: peter-evans/create-or-update-comment@v1
Expand Down
19 changes: 19 additions & 0 deletions airbyte-cdk/python/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright (c) 2020 Airbyte

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
43 changes: 43 additions & 0 deletions airbyte-cdk/python/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Airbyte Python Connector Development Framework (CDK)

The Airbyte Python CDK is a framework for rapidly developing production-grade Airbyte connectors.
The CDK currently offers helpers specific for creating Airbyte source connectors for:
* HTTP APIs (REST APIs, GraphQL, etc..)
* Singer Taps
* Generic Python sources (anything not covered by the above)

The CDK provides an improved developer experience by providing basic implementation structure and abstracting away low-level glue boilerplate.

This document is a general introduction to the CDK. Readers should have basic familiarity with the [Airbyte Specification](https://docs.airbyte.io/architecture/airbyte-specification) before proceeding.

## Getting started
Generate an empty connector using the code generator. First clone the Airbyte repository then from the repository root run
```
cd airbyte-integrations/connector-templates/generator
npm run generate
```

then follow the interactive prompt. Next, find all `TODO`s in the generated project directory -- they're accompanied by lots of comments explaining what you'll need to do in order to implement your connector. Upon completing all TODOs properly, you should have a functioning connector.

Additionally, you can follow [this tutorial](docs/tutorials/http_api_source.md) for a complete walkthrough of creating an HTTP connector using the Airbyte CDK.

### Concepts & Documentation
See the [overview docs](docs/concepts/overview.md) for a tour through what the API offers.

### Airbyte Specification
Find the reference docs for the Airbyte Specification (the interface for how sources and destinations interact) [here](https://docs.airbyte.io/architecture/airbyte-specification).

### Example Connectors

**HTTP Connectors**:
* [Exchangerates API](https://github.com/airbytehq/airbyte/blob/master/airbyte-integrations/connectors/source-exchange-rates/source_exchange_rates/source.py)
* [Stripe](https://github.com/airbytehq/airbyte/blob/master/airbyte-integrations/connectors/source-stripe/source_stripe/source.py)
* [Slack](https://github.com/airbytehq/airbyte/blob/master/airbyte-integrations/connectors/source-slack/source_slack/source.py)

**Singer connectors**:
* [Salesforce](https://github.com/airbytehq/airbyte/blob/master/airbyte-integrations/connectors/source-salesforce-singer/source_salesforce_singer/source.py)
* [Github](https://github.com/airbytehq/airbyte/blob/master/airbyte-integrations/connectors/source-github-singer/source_github_singer/source.py)

**Simple Python connectors using the barebones `Source` abstraction**:
* [Google Sheets](https://github.com/airbytehq/airbyte/blob/master/airbyte-integrations/connectors/source-google-sheets/google_sheets_source/google_sheets_source.py)
* [Mailchimp](https://github.com/airbytehq/airbyte/blob/master/airbyte-integrations/connectors/source-mailchimp/source_mailchimp/source.py)
8 changes: 8 additions & 0 deletions airbyte-cdk/python/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Defines Python build system settings.
[build-system]
requires = [
"setuptools>=42",
"wheel"
]

build-backend = "setuptools.build_meta"
67 changes: 53 additions & 14 deletions airbyte-cdk/python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,63 @@



import setuptools
import pathlib
from setuptools import setup, find_packages

setuptools.setup(
# The directory containing this file
HERE = pathlib.Path(__file__).parent

# The text of the README file
README = (HERE / "README.md").read_text()

setup(
name="airbyte-cdk",
version="0.1.0",
description="The Airbyte Connector Development Kit",
version="0.0.2",
description="Contains machinery to make it easy to write an Airbyte Connector in Python.",
long_description=README,
long_description_content_type="text/markdown",
author="Airbyte",
author_email="[email protected]",
license="MIT",
url="https://github.com/airbytehq/airbyte",
packages=setuptools.find_packages(),
package_data={"": ["models/yaml/*.yaml"]},
classifiers=[
# This information is used when browsing on PyPi.

# Dev Status
'Development Status :: 3 - Alpha',

# Project Audience
'Intended Audience :: Developers',
'Topic :: Scientific/Engineering',
'Topic :: Software Development :: Libraries :: Python Modules',

'License :: OSI Approved :: MIT License',

# Python Version Support
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
],
keywords='airbyte connectors-development-kit cdk',
project_urls={
'Documentation': 'https://docs.airbyte.io/',
'Source': 'https://github.com/airbytehq/airbyte',
'Tracker': 'https://github.com/airbytehq/airbyte/issues',
},
packages=find_packages(exclude=("unit_tests",)),
install_requires=[
"backoff",
"jsonschema==2.6.0",
"pendulum",
"pydantic==1.6.1",
"pytest",
"PyYAML==5.4",
"requests",
]
"PyYAML==5.4",
"pydantic==1.6.1",
"airbyte-protocol",
"jsonschema==2.6.0",
"requests",
"backoff",
"pytest",
"pendulum",
],
python_requires='>=3.7.9',
entry_points={
"console_scripts": ["base-python=base_python.entrypoint:main"],
},
)
19 changes: 19 additions & 0 deletions airbyte-integrations/bases/base-python/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright (c) 2020 Airbyte

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
8 changes: 8 additions & 0 deletions airbyte-integrations/bases/base-python/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Defines Python build system settings.
[build-system]
requires = [
"setuptools>=42",
"wheel"
]

build-backend = "setuptools.build_meta"
45 changes: 39 additions & 6 deletions airbyte-integrations/bases/base-python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,48 @@
# SOFTWARE.


import setuptools
import pathlib

setuptools.setup(
name="base-python",
description="Contains machinery to make it easy to write an integration in python.",
from setuptools import find_packages, setup

# The directory containing this file
HERE = pathlib.Path(__file__).parent

# The text of the README file
README = (HERE / "README.md").read_text()

setup(
name="airbyte-base-python",
version="0.0.2",
description="Contains machinery to make it easy to write an Airbyte Connector in Python.",
long_description=README,
long_description_content_type="text/markdown",
author="Airbyte",
author_email="[email protected]",
license="MIT",
url="https://github.com/airbytehq/airbyte",
packages=setuptools.find_packages(),
package_data={"": ["models/yaml/*.yaml"]},
classifiers=[
# This information is used when browsing on PyPi.
# Dev Status
"Development Status :: 3 - Alpha",
# Project Audience
"Intended Audience :: Developers",
"Topic :: Scientific/Engineering",
"Topic :: Software Development :: Libraries :: Python Modules",
"License :: OSI Approved :: MIT License",
# Python Version Support
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
],
keywords="airbyte connectors-development-kit cdk",
project_urls={
"Documentation": "https://docs.airbyte.io/",
"Source": "https://github.com/airbytehq/airbyte",
"Tracker": "https://github.com/airbytehq/airbyte/issues",
},
packages=find_packages(exclude=("unit_tests",)),
install_requires=[
"PyYAML==5.4",
"pydantic==1.6.1",
Expand All @@ -41,6 +73,7 @@
"pytest",
"pendulum",
],
python_requires=">=3.7.9",
entry_points={
"console_scripts": ["base-python=base_python.entrypoint:main"],
},
Expand Down

0 comments on commit c5570f4

Please sign in to comment.