Skip to content

Commit bce549a

Browse files
authored
✨Source Chartmogul: Make Connector Compatible with Builder (#38145)
1 parent 8db8a96 commit bce549a

26 files changed

+1906
-603
lines changed

airbyte-integrations/connectors/source-chartmogul/Dockerfile

-38
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,117 +1,103 @@
11
# Chartmogul Source
22

3-
This is the repository for the Chartmogul source connector, written in Python.
4-
For information about how to use this connector within Airbyte, see [the documentation](https://docs.airbyte.io/integrations/sources/chartmogul).
3+
This is the repository for the Chartmogul configuration based source connector.
4+
For information about how to use this connector within Airbyte, see [the documentation](https://docs.airbyte.com/integrations/sources/chartmogul).
55

66
## Local development
77

88
### Prerequisites
99

10-
**To iterate on this connector, make sure to complete this prerequisites section.**
10+
* Python (`^3.9`)
11+
* Poetry (`^1.7`) - installation instructions [here](https://python-poetry.org/docs/#installation)
1112

12-
#### Minimum Python version required `= 3.7.0`
1313

14-
#### Build & Activate Virtual Environment and install dependencies
1514

16-
From this connector directory, create a virtual environment:
15+
### Installing the connector
1716

17+
From this connector directory, run:
18+
```bash
19+
poetry install --with dev
1820
```
19-
python3 -m venv .venv
20-
```
21-
22-
This will generate a virtualenv for this module in `.venv/`. Make sure this venv is active in your
23-
development environment of choice. To activate it from the terminal, run:
24-
25-
```
26-
source .venv/bin/activate
27-
pip install -r requirements.txt
28-
pip install '.[tests]'
29-
```
30-
31-
If you are in an IDE, follow your IDE's instructions to activate the virtualenv.
3221

33-
Note that while we are installing dependencies from `requirements.txt`, you should only edit `setup.py` for your dependencies. `requirements.txt` is
34-
used for editable installs (`pip install -e`) to pull in Python dependencies from the monorepo and will call `setup.py`.
35-
If this is mumbo jumbo to you, don't worry about it, just put your deps in `setup.py` but install using `pip install -r requirements.txt` and everything
36-
should work as you expect.
3722

38-
#### Create credentials
23+
### Create credentials
3924

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

45-
**If you are an Airbyte core member**, copy the credentials in Lastpass under the secret name `source chartmogul test creds`
46-
and place them into `secrets/config.json`.
4730

4831
### Locally running the connector
4932

5033
```
51-
python main.py spec
52-
python main.py check --config secrets/config.json
53-
python main.py discover --config secrets/config.json
54-
python main.py read --config secrets/config.json --catalog integration_tests/configured_catalog.json
34+
poetry run source-chartmogul spec
35+
poetry run source-chartmogul check --config secrets/config.json
36+
poetry run source-chartmogul discover --config secrets/config.json
37+
poetry run source-chartmogul read --config secrets/config.json --catalog integration_tests/configured_catalog.json
5538
```
5639

57-
### Locally running the connector docker image
40+
### Running tests
5841

59-
#### Build
42+
To run tests locally, from the connector directory run:
43+
44+
```
45+
poetry run pytest tests
46+
```
6047

61-
**Via [`airbyte-ci`](https://github.com/airbytehq/airbyte/blob/master/airbyte-ci/connectors/pipelines/README.md) (recommended):**
48+
### Building the docker image
6249

50+
1. Install [`airbyte-ci`](https://github.com/airbytehq/airbyte/blob/master/airbyte-ci/connectors/pipelines/README.md)
51+
2. Run the following command to build the docker image:
6352
```bash
6453
airbyte-ci connectors --name=source-chartmogul build
6554
```
6655

67-
An image will be built with the tag `airbyte/source-chartmogul:dev`.
56+
An image will be available on your host with the tag `airbyte/source-chartmogul:dev`.
6857

69-
**Via `docker build`:**
7058

71-
```bash
72-
docker build -t airbyte/source-chartmogul:dev .
73-
```
74-
75-
#### Run
59+
### Running as a docker container
7660

7761
Then run any of the connector commands as follows:
78-
7962
```
8063
docker run --rm airbyte/source-chartmogul:dev spec
8164
docker run --rm -v $(pwd)/secrets:/secrets airbyte/source-chartmogul:dev check --config /secrets/config.json
8265
docker run --rm -v $(pwd)/secrets:/secrets airbyte/source-chartmogul:dev discover --config /secrets/config.json
8366
docker run --rm -v $(pwd)/secrets:/secrets -v $(pwd)/integration_tests:/integration_tests airbyte/source-chartmogul:dev read --config /secrets/config.json --catalog /integration_tests/configured_catalog.json
8467
```
8568

86-
## Testing
69+
### Running our CI test suite
8770

8871
You can run our full test suite locally using [`airbyte-ci`](https://github.com/airbytehq/airbyte/blob/master/airbyte-ci/connectors/pipelines/README.md):
89-
9072
```bash
9173
airbyte-ci connectors --name=source-chartmogul test
9274
```
9375

9476
### Customizing acceptance Tests
9577

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

99-
## Dependency Management
81+
### Dependency Management
10082

101-
All of your dependencies should go in `setup.py`, NOT `requirements.txt`. The requirements file is only used to connect internal Airbyte dependencies in the monorepo for local development.
102-
We split dependencies between two groups, dependencies that are:
83+
All of your dependencies should be managed via Poetry.
84+
To add a new dependency, run:
85+
```bash
86+
poetry add <package-name>
87+
```
10388

104-
- required for your connector to work need to go to `MAIN_REQUIREMENTS` list.
105-
- required for the testing need to go to `TEST_REQUIREMENTS` list
89+
Please commit the changes to `pyproject.toml` and `poetry.lock` files.
10690

107-
### Publishing a new version of the connector
91+
## Publishing a new version of the connector
10892

10993
You've checked out the repo, implemented a million dollar feature, and you're ready to share your changes with the world. Now what?
110-
11194
1. Make sure your changes are passing our test suite: `airbyte-ci connectors --name=source-chartmogul test`
112-
2. Bump the connector version in `metadata.yaml`: increment the `dockerImageTag` value. Please follow [semantic versioning for connectors](https://docs.airbyte.com/contributing-to-airbyte/resources/pull-requests-handbook/#semantic-versioning-for-connectors).
95+
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)):
96+
- bump the `dockerImageTag` value in in `metadata.yaml`
97+
- bump the `version` value in `pyproject.toml`
11398
3. Make sure the `metadata.yaml` content is up to date.
114-
4. Make the connector documentation and its changelog is up to date (`docs/integrations/sources/chartmogul.md`).
99+
4. Make sure the connector documentation and its changelog is up to date (`docs/integrations/sources/chartmogul.md`).
115100
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).
116101
6. Pat yourself on the back for being an awesome contributor.
117102
7. Someone from Airbyte will take a look at your PR and iterate with you to merge it into master.
103+
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 numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#
2+
# Copyright (c) 2024 Airbyte, Inc., all rights reserved.
3+
#
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#
2-
# Copyright (c) 2021 Airbyte, Inc., all rights reserved.
2+
# Copyright (c) 2024 Airbyte, Inc., all rights reserved.
33
#

airbyte-integrations/connectors/source-chartmogul/integration_tests/acceptance.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
2+
# Copyright (c) 2024 Airbyte, Inc., all rights reserved.
33
#
44

55

Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
{"stream":"customers","data":{"id":72038151,"uuid":"cus_e6e6b1e6-72d4-11ec-ac99-47c8cf90d52c","external_id":"cus_0001","name":"Adam Smith","email":"[email protected]","status":"Past Due","customer-since":"2015-11-01T00:00:00+00:00","attributes":{"custom":{},"clearbit":{},"stripe":{},"tags":[]},"data_source_uuid":"ds_2dbe3b80-72d4-11ec-bdef-0f585abe5bf3","data_source_uuids":["ds_2dbe3b80-72d4-11ec-bdef-0f585abe5bf3"],"external_ids":["cus_0001"],"company":"Airbyte","country":"US","state":"CA","city":"San Francisco","zip":"94121","lead_created_at":"2022-01-11T00:00:00.000Z","free_trial_started_at":"2022-01-11T00:00:00.000Z","address":{"country":"United States","state":"California","city":"San Francisco","address_zip":"94121"},"mrr":4100,"arr":49200,"billing-system-url":null,"chartmogul-url":"https://app.chartmogul.com/#/customers/72038151-Airbyte","billing-system-type":"Import API","currency":"USD","currency-sign":"$", "owner": null},"emitted_at":1668512244585}
2-
{"stream":"activities","data":{"description":"purchased the Bronze Plan plan with $10.00 discount applied","activity-mrr-movement":4100,"activity-mrr":4100,"activity-arr":49200,"date":"2015-11-01T00:00:00+00:00","type":"new_biz","currency":"USD","subscription-external-id":"sub_0001","plan-external-id":"bb8dcfe0-5505-013a-5d44-263d116b0774","customer-name":"Airbyte","customer-uuid":"cus_e6e6b1e6-72d4-11ec-ac99-47c8cf90d52c","customer-external-id":"cus_0001","billing-connector-uuid":"ds_2dbe3b80-72d4-11ec-bdef-0f585abe5bf3","uuid":"02a72371-72b1-440e-9816-d61435fd2e45"},"emitted_at":1668512245112}
1+
{"stream":"customers","data":{"id":72038151,"uuid":"cus_e6e6b1e6-72d4-11ec-ac99-47c8cf90d52c","external_id":"cus_0001","name":"Adam Smith","email":"[email protected]","status":"Past Due","customer-since":"2015-11-01T00:00:00+00:00","attributes":{"custom":{},"clearbit":{},"stripe":{},"tags":[]},"data_source_uuid":"ds_2dbe3b80-72d4-11ec-bdef-0f585abe5bf3","data_source_uuids":["ds_2dbe3b80-72d4-11ec-bdef-0f585abe5bf3"],"external_ids":["cus_0001"],"company":"Airbyte","country":"US","state":"CA","city":"San Francisco","zip":"94121","lead_created_at":"2022-01-11T00:00:00.000Z","free_trial_started_at":"2022-01-11T00:00:00.000Z","address":{"country":"United States","state":"California","city":"San Francisco","address_zip":"94121"},"mrr":4100,"arr":49200,"billing-system-url":null,"chartmogul-url":"https://app.chartmogul.com/#/customers/72038151-Airbyte","billing-system-type":"Import API","currency":"USD","currency-sign":"$","owner": null},"emitted_at":1668512244585}
2+
{"stream":"activities","data":{"description":"purchased the Bronze Plan plan with $10.00 discount applied","activity-mrr-movement":4100,"activity-mrr":4100,"activity-arr":49200,"date":"2015-11-01T00:00:00+00:00","type":"new_biz","currency":"USD","subscription-external-id":"sub_0001","plan-external-id":"bb8dcfe0-5505-013a-5d44-263d116b0774","customer-name":"Airbyte","customer-uuid":"cus_e6e6b1e6-72d4-11ec-ac99-47c8cf90d52c","customer-external-id":"cus_0001","billing-connector-uuid":"ds_2dbe3b80-72d4-11ec-bdef-0f585abe5bf3","uuid":"1f366f3c-39e5-5061-ab9d-c1705ae21188"},"emitted_at":1668512245112}
33
{"stream":"customer_daily_count","data":{"date":"2022-01-01","customers":1,"percentage-change":0},"emitted_at":1668512245914}

airbyte-integrations/connectors/source-chartmogul/main.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
2+
# Copyright (c) 2024 Airbyte, Inc., all rights reserved.
33
#
44

55
from source_chartmogul.run import run

airbyte-integrations/connectors/source-chartmogul/metadata.yaml

+22-16
Original file line numberDiff line numberDiff line change
@@ -5,32 +5,38 @@ data:
55
allowedHosts:
66
hosts:
77
- api.chartmogul.com
8+
registries:
9+
oss:
10+
enabled: true
11+
cloud:
12+
enabled: true
13+
remoteRegistries:
14+
pypi:
15+
enabled: true
16+
packageName: airbyte-source-chartmogul
17+
connectorBuildOptions:
18+
# Please update to the latest version of the connector base image.
19+
# https://hub.docker.com/r/airbyte/python-connector-base
20+
# Please use the full address with sha256 hash to guarantee build reproducibility.
21+
baseImage: docker.io/airbyte/python-connector-base:1.2.0@sha256:c22a9d97464b69d6ef01898edf3f8612dc11614f05a84984451dde195f337db9
822
connectorSubtype: api
923
connectorType: source
1024
definitionId: b6604cbd-1b12-4c08-8767-e140d0fb0877
11-
dockerImageTag: 1.0.0
12-
releases:
13-
breakingChanges:
14-
1.0.0:
15-
message: "This version separates the `customer_count` stream into multiple streams (daily, weekly, monthly, quarterly). Users previously using the `customer_count` stream will need to run a reset to enable the new streams and continue syncing."
16-
upgradeDeadline: "2023-11-29"
25+
dockerImageTag: 1.0.1
1726
dockerRepository: airbyte/source-chartmogul
18-
documentationUrl: https://docs.airbyte.com/integrations/sources/chartmogul
1927
githubIssueLabel: source-chartmogul
2028
icon: chartmogul.svg
2129
license: MIT
2230
name: Chartmogul
23-
remoteRegistries:
24-
pypi:
25-
enabled: true
26-
packageName: airbyte-source-chartmogul
27-
registries:
28-
cloud:
29-
enabled: true
30-
oss:
31-
enabled: true
31+
releaseDate: 2022-01-10
32+
releases:
33+
breakingChanges:
34+
1.0.0:
35+
message: "This version separates the `customer_count` stream into multiple streams (daily, weekly, monthly, quarterly). Users previously using the `customer_count` stream will need to run a reset to enable the new streams and continue syncing."
36+
upgradeDeadline: "2023-11-29"
3237
releaseStage: beta
3338
supportLevel: community
39+
documentationUrl: https://docs.airbyte.com/integrations/sources/chartmogul
3440
tags:
3541
- language:python
3642
- cdk:low-code

0 commit comments

Comments
 (0)