Skip to content

Commit

Permalink
✨Source Customer.io: Make Connector Compatible with Builder (#38318)
Browse files Browse the repository at this point in the history
  • Loading branch information
btkcodedev committed Jun 27, 2024
1 parent 8182cd5 commit 3136f27
Show file tree
Hide file tree
Showing 18 changed files with 481 additions and 391 deletions.

This file was deleted.

33 changes: 26 additions & 7 deletions airbyte-integrations/connectors/source-customer-io/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,49 +7,59 @@ For information about how to use this connector within Airbyte, see [the documen
## Local development

### Prerequisites
* Python (~=3.9)
* Poetry (~=1.7) - installation instructions [here](https://python-poetry.org/docs/#installation)

* Python (`^3.9`)
* Poetry (`^1.7`) - installation instructions [here](https://python-poetry.org/docs/#installation)



### Installing the connector

From this connector directory, run:
```bash
poetry install --with dev
```


### Create credentials

**If you are a community contributor**, follow the instructions in the [documentation](https://docs.airbyte.com/integrations/sources/customer-io)
to generate the necessary credentials. Then create a file `secrets/config.json` conforming to the `source_customer_io/spec.yaml` file.
to generate the necessary credentials. Then create a file `secrets/config.json` conforming to the `src/source_customer_io/spec.yaml` file.
Note that any directory named `secrets` is gitignored across the entire Airbyte repo, so there is no danger of accidentally checking in sensitive information.
See `sample_files/sample_config.json` for a sample config file.


### Locally running the connector

```
poetry run source-customer-io spec
poetry run source-customer-io check --config secrets/config.json
poetry run source-customer-io discover --config secrets/config.json
poetry run source-customer-io read --config secrets/config.json --catalog sample_files/configured_catalog.json
poetry run source-customer-io read --config secrets/config.json --catalog integration_tests/configured_catalog.json
```

### Running unit tests
To run unit tests locally, from the connector directory run:
### Running tests

To run tests locally, from the connector directory run:

```
poetry run pytest unit_tests
poetry run pytest tests
```

### Building the docker image

1. Install [`airbyte-ci`](https://github.com/airbytehq/airbyte/blob/master/airbyte-ci/connectors/pipelines/README.md)
2. Run the following command to build the docker image:
```bash
airbyte-ci connectors --name=source-customer-io build
```

An image will be available on your host with the tag `airbyte/source-customer-io:dev`.
An image will be available on your host with the tag `airbyte/source-customer-io:dev`.


### Running as a docker container

Then run any of the connector commands as follows:
```
docker run --rm airbyte/source-customer-io:dev spec
Expand All @@ -59,16 +69,19 @@ docker run --rm -v $(pwd)/secrets:/secrets -v $(pwd)/integration_tests:/integrat
```

### Running our CI test suite

You can run our full test suite locally using [`airbyte-ci`](https://github.com/airbytehq/airbyte/blob/master/airbyte-ci/connectors/pipelines/README.md):
```bash
airbyte-ci connectors --name=source-customer-io test
```

### Customizing acceptance Tests

Customize `acceptance-test-config.yml` file to configure acceptance tests. See [Connector Acceptance Tests](https://docs.airbyte.com/connector-development/testing-connectors/connector-acceptance-tests-reference) for more information.
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.

### Dependency Management

All of your dependencies should be managed via Poetry.
To add a new dependency, run:
```bash
Expand All @@ -78,14 +91,20 @@ poetry add <package-name>
Please commit the changes to `pyproject.toml` and `poetry.lock` files.

## Publishing a new version of the connector

You've checked out the repo, implemented a million dollar feature, and you're ready to share your changes with the world. Now what?
1. Make sure your changes are passing our test suite: `airbyte-ci connectors --name=source-customer-io test`
2. Bump the connector version (please follow [semantic versioning for connectors](https://docs.airbyte.com/contributing-to-airbyte/resources/pull-requests-handbook/#semantic-versioning-for-connectors)):
- bump the `dockerImageTag` value in in `metadata.yaml`
- bump the `version` value in `pyproject.toml`
2. Bump the connector version (please follow [semantic versioning for connectors](https://docs.airbyte.com/contributing-to-airbyte/resources/pull-requests-handbook/#semantic-versioning-for-connectors)):
- bump the `dockerImageTag` value in in `metadata.yaml`
- bump the `version` value in `pyproject.toml`
3. Make sure the `metadata.yaml` content is up to date.
4. Make sure the connector documentation and its changelog is up to date (`docs/integrations/sources/customer-io.md`).
4. Make sure the connector documentation and its changelog is up to date (`docs/integrations/sources/customer-io.md`).
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).
6. Pat yourself on the back for being an awesome contributor.
7. Someone from Airbyte will take a look at your PR and iterate with you to merge it into master.
8. Once your PR is merged, the new version of the connector will be automatically published to Docker Hub and our connector registry.
8. Once your PR is merged, the new version of the connector will be automatically published to Docker Hub and our connector registry.
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
# Copyright (c) 2024 Airbyte, Inc., all rights reserved.
#
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
# Copyright (c) 2024 Airbyte, Inc., all rights reserved.
#
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
# Copyright (c) 2024 Airbyte, Inc., all rights reserved.
#


Expand All @@ -11,4 +11,6 @@
@pytest.fixture(scope="session", autouse=True)
def connector_setup():
"""This fixture is a placeholder for external resources that acceptance test might require."""
# TODO: setup test dependencies if needed. otherwise remove the TODO comments
yield
# TODO: clean up test dependencies
2 changes: 1 addition & 1 deletion airbyte-integrations/connectors/source-customer-io/main.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
# Copyright (c) 2024 Airbyte, Inc., all rights reserved.
#

from source_customer_io.run import run
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,15 @@ data:
enabled: false
cloud:
enabled: false
connectorBuildOptions:
# Please update to the latest version of the connector base image.
# https://hub.docker.com/r/airbyte/python-connector-base
# Please use the full address with sha256 hash to guarantee build reproducibility.
baseImage: docker.io/airbyte/python-connector-base:1.2.0@sha256:c22a9d97464b69d6ef01898edf3f8612dc11614f05a84984451dde195f337db9
connectorSubtype: api
connectorType: source
definitionId: 34f697bc-b989-4eda-b06f-d0f39b88825b
dockerImageTag: 0.2.4
dockerImageTag: 0.2.5
dockerRepository: airbyte/source-customer-io
githubIssueLabel: source-customer-io
icon: customer-io.svg
Expand Down
72 changes: 33 additions & 39 deletions airbyte-integrations/connectors/source-customer-io/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,16 @@ requires = [ "poetry-core>=1.0.0",]
build-backend = "poetry.core.masonry.api"

[tool.poetry]
version = "0.2.4"
version = "0.2.5"
name = "source-customer-io"
description = "Source implementation for Customer Io."
description = "Source implementation for customer-io."
authors = [ "Airbyte <contact@airbyte.io>",]
license = "MIT"
readme = "README.md"
documentation = "https://docs.airbyte.com/integrations/sources/customer-io"
homepage = "https://airbyte.com"
repository = "https://github.com/airbytehq/airbyte"
[[tool.poetry.packages]]
include = "source_customer_io"
packages = [ { include = "source_customer_io" }, {include = "main.py" } ]

[tool.poetry.dependencies]
python = "^3.9,<3.12"
Expand All @@ -23,5 +22,6 @@ airbyte-cdk = "^0"
source-customer-io = "source_customer_io.run:run"

[tool.poetry.group.dev.dependencies]
pytest = "^6.2"
pytest-mock = "^3.6.1"
requests-mock = "*"
pytest-mock = "*"
pytest = "*"
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
# Copyright (c) 2024 Airbyte, Inc., all rights reserved.
#


Expand Down
Loading

0 comments on commit 3136f27

Please sign in to comment.