Skip to content

Commit a4141f5

Browse files
btkcodedevgirarda
andauthored
✨Source CoinMarketCap: Make Connector Compatible with Builder (#38134)
Co-authored-by: Alexandre Girard <[email protected]>
1 parent 961d00a commit a4141f5

23 files changed

+1835
-421
lines changed

airbyte-integrations/connectors/source-coinmarketcap/.dockerignore

-6
This file was deleted.

airbyte-integrations/connectors/source-coinmarketcap/Dockerfile

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

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

66
## Local development
77

8-
#### Create credentials
8+
### Prerequisites
99

10-
**If you are a community contributor**, follow the instructions in the [documentation](https://docs.airbyte.io/integrations/sources/coinmarketcap)
11-
to generate the necessary credentials. Then create a file `secrets/config.json` conforming to the `source_coinmarketcap/spec.yaml` file.
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
24+
25+
**If you are a community contributor**, follow the instructions in the [documentation](https://docs.airbyte.com/integrations/sources/coinmarketcap)
26+
to generate the necessary credentials. Then create a file `secrets/config.json` conforming to the `spec` inside `src/source_coinmarketcap/manifest.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 coinmarketcap 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-coinmarketcap spec
35+
poetry run source-coinmarketcap check --config secrets/config.json
36+
poetry run source-coinmarketcap discover --config secrets/config.json
37+
poetry run source-coinmarketcap read --config secrets/config.json --catalog sample_files/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-coinmarketcap build
26-
```
42+
To run tests locally, from the connector directory run:
2743

28-
An image will be built with the tag `airbyte/source-coinmarketcap: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-coinmarketcap:dev .
53+
airbyte-ci connectors --name=source-coinmarketcap build
3454
```
3555

36-
#### Run
56+
An image will be available on your host with the tag `airbyte/source-coinmarketcap: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-coinmarketcap:dev spec
4264
docker run --rm -v $(pwd)/secrets:/secrets airbyte/source-coinmarketcap:dev check --config /secrets/config.json
4365
docker run --rm -v $(pwd)/secrets:/secrets airbyte/source-coinmarketcap:dev discover --config /secrets/config.json
4466
docker run --rm -v $(pwd)/secrets:/secrets -v $(pwd)/integration_tests:/integration_tests airbyte/source-coinmarketcap: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-coinmarketcap 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-coinmarketcap 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/coinmarketcap.md`).
99+
4. Make sure the connector documentation and its changelog is up to date (`docs/integrations/sources/coinmarketcap.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,5 +1,3 @@
1-
# See [Connector Acceptance Tests](https://docs.airbyte.com/connector-development/testing-connectors/connector-acceptance-tests-reference)
2-
# for more information about how to configure these tests
31
connector_image: airbyte/source-coinmarketcap:dev
42
acceptance_tests:
53
spec:
@@ -20,33 +18,24 @@ acceptance_tests:
2018
configured_catalog_path: "integration_tests/configured_catalog.json"
2119
empty_streams: []
2220
timeout_seconds: 1800
23-
# TODO uncomment this block to specify that the tests should assert the connector outputs the records provided in the input file a file
24-
# expect_records:
25-
# path: "integration_tests/expected_records.jsonl"
26-
# exact_order: no
2721
incremental:
2822
bypass_reason: "This connector does not implement incremental sync"
29-
# TODO uncomment this block this block if your connector implements incremental sync:
30-
# tests:
31-
# - config_path: "secrets/config.json"
32-
# configured_catalog_path: "integration_tests/configured_catalog.json"
33-
# future_state_path: "integration_tests/abnormal_state.json"
3423
full_refresh:
3524
tests:
3625
- config_path: "secrets/config.json"
3726
configured_catalog_path: "integration_tests/configured_catalog.json"
3827
timeout_seconds: 1800
3928
ignored_fields:
4029
categories:
41-
- "avg_price_change"
42-
- "market_cap"
43-
- "market_cap_change"
44-
- "volume"
45-
- "volume_change"
30+
- name: "avg_price_change"
31+
- name: "market_cap"
32+
- name: "market_cap_change"
33+
- name: "volume"
34+
- name: "volume_change"
4635
listing:
47-
- "cmc_rank"
48-
- "last_updated"
49-
- "self_reported_circulating_supply"
50-
- "self_reported_market_cap"
51-
- "tvl_ratio"
52-
- "quote"
36+
- name: "cmc_rank"
37+
- name: "last_updated"
38+
- name: "self_reported_circulating_supply"
39+
- name: "self_reported_market_cap"
40+
- name: "tvl_ratio"
41+
- name: "quote"
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-coinmarketcap/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-coinmarketcap/metadata.yaml

+19-10
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,31 @@
11
data:
2+
allowedHosts:
3+
hosts:
4+
- pro-api.coinmarketcap.com
5+
registries:
6+
oss:
7+
enabled: true
8+
cloud:
9+
enabled: true
10+
remoteRegistries:
11+
pypi:
12+
enabled: true
13+
packageName: airbyte-source-coinmarketcap
14+
connectorBuildOptions:
15+
# Please update to the latest version of the connector base image.
16+
# https://hub.docker.com/r/airbyte/python-connector-base
17+
# Please use the full address with sha256 hash to guarantee build reproducibility.
18+
baseImage: docker.io/airbyte/python-connector-base:1.2.0@sha256:c22a9d97464b69d6ef01898edf3f8612dc11614f05a84984451dde195f337db9
219
connectorSubtype: api
320
connectorType: source
421
definitionId: 239463f5-64bb-4d88-b4bd-18ce673fd572
5-
dockerImageTag: 0.1.1
22+
dockerImageTag: 0.1.2
623
dockerRepository: airbyte/source-coinmarketcap
724
githubIssueLabel: source-coinmarketcap
825
icon: coinmarketcap.svg
926
license: MIT
1027
name: CoinMarketCap
11-
remoteRegistries:
12-
pypi:
13-
enabled: true
14-
packageName: airbyte-source-coinmarketcap
15-
registries:
16-
cloud:
17-
enabled: true
18-
oss:
19-
enabled: true
28+
releaseDate: 2022-10-29
2029
releaseStage: alpha
2130
documentationUrl: https://docs.airbyte.com/integrations/sources/coinmarketcap
2231
tags:

0 commit comments

Comments
 (0)