Skip to content

Commit 851ef11

Browse files
authored
✨Source ExchangeRatesApi: Make Connector Compatible with Builder (#38135)
1 parent 040f141 commit 851ef11

File tree

19 files changed

+2198
-733
lines changed

19 files changed

+2198
-733
lines changed

airbyte-integrations/connectors/source-exchange-rates/.dockerignore

-6
This file was deleted.

airbyte-integrations/connectors/source-exchange-rates/Dockerfile

-38
This file was deleted.

airbyte-integrations/connectors/source-exchange-rates/README.md

+52-27
Original file line numberDiff line numberDiff line change
@@ -5,74 +5,99 @@ For information about how to use this connector within Airbyte, see [the documen
55

66
## Local development
77

8-
#### Create credentials
8+
### Prerequisites
9+
10+
* Python (`^3.9`)
11+
* Poetry (`^1.7`) - installation instructions [here](https://python-poetry.org/docs/#installation)
12+
13+
14+
15+
### Installing the connector
16+
17+
From this connector directory, run:
18+
```bash
19+
poetry install --with dev
20+
```
21+
22+
23+
### Create credentials
924

1025
**If you are a community contributor**, follow the instructions in the [documentation](https://docs.airbyte.com/integrations/sources/exchange-rates)
11-
to generate the necessary credentials. Then create a file `secrets/config.json` conforming to the `source_exchange_rates/spec.yaml` file.
26+
to generate the necessary credentials. Then create a file `secrets/config.json` conforming to the `spec` inside `src/source_exchange_rates/mnifest.yaml` file.
1227
Note that any directory named `secrets` is gitignored across the entire Airbyte repo, so there is no danger of accidentally checking in sensitive information.
1328
See `integration_tests/sample_config.json` for a sample config file.
1429

15-
**If you are an Airbyte core member**, copy the credentials in Lastpass under the secret name `source exchange-rates test creds`
16-
and place them into `secrets/config.json`.
1730

18-
### Locally running the connector docker image
31+
### Locally running the connector
1932

20-
#### Build
33+
```
34+
poetry run source-exchange-rates spec
35+
poetry run source-exchange-rates check --config secrets/config.json
36+
poetry run source-exchange-rates discover --config secrets/config.json
37+
poetry run source-exchange-rates read --config secrets/config.json --catalog integration_tests/configured_catalog.json
38+
```
2139

22-
**Via [`airbyte-ci`](https://github.com/airbytehq/airbyte/blob/master/airbyte-ci/connectors/pipelines/README.md) (recommended):**
40+
### Running tests
2341

24-
```bash
25-
airbyte-ci connectors --name=source-exchange-rates build
26-
```
42+
To run tests locally, from the connector directory run:
2743

28-
An image will be built with the tag `airbyte/source-exchange-rates:dev`.
44+
```
45+
poetry run pytest tests
46+
```
2947

30-
**Via `docker build`:**
48+
### Building the docker image
3149

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:
3252
```bash
33-
docker build -t airbyte/source-exchange-rates:dev .
53+
airbyte-ci connectors --name=source-exchange-rates build
3454
```
3555

36-
#### Run
56+
An image will be available on your host with the tag `airbyte/source-exchange-rates:dev`.
3757

38-
Then run any of the connector commands as follows:
3958

59+
### Running as a docker container
60+
61+
Then run any of the connector commands as follows:
4062
```
4163
docker run --rm airbyte/source-exchange-rates:dev spec
4264
docker run --rm -v $(pwd)/secrets:/secrets airbyte/source-exchange-rates:dev check --config /secrets/config.json
4365
docker run --rm -v $(pwd)/secrets:/secrets airbyte/source-exchange-rates:dev discover --config /secrets/config.json
4466
docker run --rm -v $(pwd)/secrets:/secrets -v $(pwd)/integration_tests:/integration_tests airbyte/source-exchange-rates:dev read --config /secrets/config.json --catalog /integration_tests/configured_catalog.json
4567
```
4668

47-
## Testing
69+
### Running our CI test suite
4870

4971
You can run our full test suite locally using [`airbyte-ci`](https://github.com/airbytehq/airbyte/blob/master/airbyte-ci/connectors/pipelines/README.md):
50-
5172
```bash
5273
airbyte-ci connectors --name=source-exchange-rates test
5374
```
5475

5576
### Customizing acceptance Tests
5677

57-
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.
5879
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.
5980

60-
## Dependency Management
81+
### Dependency Management
6182

62-
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.
63-
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+
```
6488

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

68-
### Publishing a new version of the connector
91+
## Publishing a new version of the connector
6992

7093
You've checked out the repo, implemented a million dollar feature, and you're ready to share your changes with the world. Now what?
71-
7294
1. Make sure your changes are passing our test suite: `airbyte-ci connectors --name=source-exchange-rates test`
73-
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`
7498
3. Make sure the `metadata.yaml` content is up to date.
75-
4. Make the connector documentation and its changelog is up to date (`docs/integrations/sources/exchange-rates.md`).
99+
4. Make sure the connector documentation and its changelog is up to date (`docs/integrations/sources/exchange-rates.md`).
76100
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).
77101
6. Pat yourself on the back for being an awesome contributor.
78102
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
@@ -1,3 +1,3 @@
11
#
2-
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
2+
# Copyright (c) 2024 Airbyte, Inc., all rights reserved.
33
#
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#
2-
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
2+
# Copyright (c) 2024 Airbyte, Inc., all rights reserved.
33
#

airbyte-integrations/connectors/source-exchange-rates/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

airbyte-integrations/connectors/source-exchange-rates/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_exchange_rates.run import run

airbyte-integrations/connectors/source-exchange-rates/metadata.yaml

+6-1
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,15 @@ data:
1212
enabled: true
1313
cloud:
1414
enabled: true
15+
connectorBuildOptions:
16+
# Please update to the latest version of the connector base image.
17+
# https://hub.docker.com/r/airbyte/python-connector-base
18+
# Please use the full address with sha256 hash to guarantee build reproducibility.
19+
baseImage: docker.io/airbyte/python-connector-base:1.2.0@sha256:c22a9d97464b69d6ef01898edf3f8612dc11614f05a84984451dde195f337db9
1520
connectorSubtype: api
1621
connectorType: source
1722
definitionId: e2b40e36-aa0e-4bed-b41b-bcea6fa348b1
18-
dockerImageTag: 1.3.0
23+
dockerImageTag: 1.3.1
1924
dockerRepository: airbyte/source-exchange-rates
2025
githubIssueLabel: source-exchange-rates
2126
icon: exchangeratesapi.svg

0 commit comments

Comments
 (0)