1
0
mirror of synced 2025-12-25 02:09:19 -05:00

source-kyve: [autopull] base image + poetry + up_to_date (#38514)

Co-authored-by: Danylo Jablonski <150933663+DanyloGL@users.noreply.github.com>
This commit is contained in:
Natik Gadzhi
2024-05-29 06:15:20 -07:00
committed by GitHub
parent 90597a3e15
commit d0fb0cbbe9
7 changed files with 1143 additions and 103 deletions

View File

@@ -1,38 +0,0 @@
FROM python:3.9.13-alpine3.15 as base
# build and load all requirements
FROM base as builder
WORKDIR /airbyte/integration_code
# upgrade pip to the latest version
RUN apk --no-cache upgrade \
&& pip install --upgrade pip \
&& apk --no-cache add tzdata build-base
COPY setup.py ./
# install necessary packages to a temporary folder
RUN pip install --prefix=/install .
# build a clean environment
FROM base
WORKDIR /airbyte/integration_code
# copy all loaded and built libraries to a pure basic image
COPY --from=builder /install /usr/local
# add default timezone settings
COPY --from=builder /usr/share/zoneinfo/Etc/UTC /etc/localtime
RUN echo "Etc/UTC" > /etc/timezone
# bash is installed for more convenient debugging.
RUN apk --no-cache add bash
# copy payload code only
COPY main.py ./
COPY source_kyve ./source_kyve
ENV AIRBYTE_ENTRYPOINT "python /airbyte/integration_code/main.py"
ENTRYPOINT ["python", "/airbyte/integration_code/main.py"]
LABEL io.airbyte.version=0.2.0
LABEL io.airbyte.name=airbyte/source-kyve

View File

@@ -1,30 +1,91 @@
# KYVE
# Kyve source connector
This page contains the setup guide and reference information for the **KYVE** source connector.
The KYVE Data Pipeline enables easy import of KYVE data into any data warehouse or destination
supported by [Airbyte](https://airbyte.com/). With the `ELT` format, data analysts and engineers can now confidently source KYVE data without worrying about its validity or reliability.
This is the repository for the Kyve source connector, written in Python.
For information about how to use this connector within Airbyte, see [the documentation](https://docs.airbyte.com/integrations/sources/kyve).
For information about how to set up an end-to-end pipeline with this connector, see [the documentation](https://docs.kyve.network/data_engineers/accessing_data/elt_pipeline/overview).
## Local development
## Source configuration setup
### Prerequisites
* Python (~=3.9)
* Poetry (~=1.7) - installation instructions [here](https://python-poetry.org/docs/#installation)
1. In order to create an ELT pipeline with KYVE source you should specify the **`Pool-ID`** of the [KYVE storage pool](https://app.kyve.network/#/pools) from which you want to retrieve data.
2. You can specify a specific **`Bundle-Start-ID`** in case you want to narrow the records that will be retrieved from the pool. You can find the valid bundles in the KYVE app (e.g. [Cosmos Hub pool](https://app.kyve.network/#/pools/0/bundles)).
### Installing the connector
From this connector directory, run:
```bash
poetry install --with dev
```
3. In order to extract the validated data from KYVE, you can specify the endpoint which will be requested **`KYVE-API URL Base`**. By default, the official KYVE **`mainnet`** endpoint will be used, providing the data of [these pools](https://app.kyve.network/#/pools).
**_Note:_**
KYVE Network consists of three individual networks: _Korellia_ is the `devnet` used for development purposes, _Kaon_ is the `testnet` used for testing purposes, and **`mainnet`** is the official network. Although through Kaon and Korellia validated data can be used for development purposes, it is recommended to only trust the data validated on Mainnet.
### Create credentials
**If you are a community contributor**, follow the instructions in the [documentation](https://docs.airbyte.com/integrations/sources/kyve)
to generate the necessary credentials. Then create a file `secrets/config.json` conforming to the `source_kyve/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.
## Multiple pools
You can fetch with one source configuration more than one pool simultaneously. You just need to specify the **`Pool-IDs`** and the **`Bundle-Start-IDs`** for the KYVE storage pool you want to archive separated with comma.
### Locally running the connector
```
poetry run source-kyve spec
poetry run source-kyve check --config secrets/config.json
poetry run source-kyve discover --config secrets/config.json
poetry run source-kyve read --config secrets/config.json --catalog sample_files/configured_catalog.json
```
## Changelog
### Running unit tests
To run unit tests locally, from the connector directory run:
```
poetry run pytest unit_tests
```
| Version | Date | Subject |
| :------ | :------- | :--------------------------------------------------- |
| 0.1.0 | 25-05-23 | Initial release of KYVE source connector |
| 0.2.0 | 10-11-23 | Update KYVE source to support to Mainnet and Testnet |
### 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-kyve build
```
An image will be available on your host with the tag `airbyte/source-kyve:dev`.
### Running as a docker container
Then run any of the connector commands as follows:
```
docker run --rm airbyte/source-kyve:dev spec
docker run --rm -v $(pwd)/secrets:/secrets airbyte/source-kyve:dev check --config /secrets/config.json
docker run --rm -v $(pwd)/secrets:/secrets airbyte/source-kyve:dev discover --config /secrets/config.json
docker run --rm -v $(pwd)/secrets:/secrets -v $(pwd)/integration_tests:/integration_tests airbyte/source-kyve:dev read --config /secrets/config.json --catalog /integration_tests/configured_catalog.json
```
### 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-kyve 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
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-kyve 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`
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/kyve.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.

View File

@@ -2,7 +2,7 @@ data:
connectorSubtype: api
connectorType: source
definitionId: 60a1efcc-c31c-4c63-b508-5b48b6a9f4a6
dockerImageTag: 0.2.0
dockerImageTag: 0.2.1
maxSecondsBetweenMessages: 7200
dockerRepository: airbyte/source-kyve
githubIssueLabel: source-kyve
@@ -41,4 +41,6 @@ data:
secretStore:
type: GSM
alias: airbyte-connector-testing-secret-store
connectorBuildOptions:
baseImage: docker.io/airbyte/python-connector-base:1.2.0@sha256:c22a9d97464b69d6ef01898edf3f8612dc11614f05a84984451dde195f337db9
metadataSpecVersion: "1.0"

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,28 @@
[build-system]
requires = [ "poetry-core>=1.0.0",]
build-backend = "poetry.core.masonry.api"
[tool.poetry]
version = "0.2.1"
name = "source-kyve"
description = "Source implementation for KYVE."
authors = [ "KYVE Core Team <security@kyve.network>",]
license = "MIT"
readme = "README.md"
documentation = "https://docs.airbyte.com/integrations/sources/kyve"
homepage = "https://airbyte.com"
repository = "https://github.com/airbytehq/airbyte"
[[tool.poetry.packages]]
include = "source_kyve"
[tool.poetry.dependencies]
python = "^3.9,<3.12"
airbyte-cdk = "0.80.0"
[tool.poetry.scripts]
source-kyve = "source_kyve.run:run"
[tool.poetry.group.dev.dependencies]
requests-mock = "^1.9.3"
pytest = "^6.2"
pytest-mock = "^3.6.1"

View File

@@ -1,46 +0,0 @@
#
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
#
from setuptools import find_packages, setup
MAIN_REQUIREMENTS = [
"airbyte-cdk~=0.2",
]
TEST_REQUIREMENTS = [
"requests-mock~=1.9.3",
"pytest~=6.2",
"pytest-mock~=3.6.1",
]
setup(
entry_points={
"console_scripts": [
"source-kyve=source_kyve.run:run",
],
},
name="source_kyve",
description="Source implementation for KYVE.",
author="KYVE Core Team",
author_email="security@kyve.network",
packages=find_packages(),
install_requires=MAIN_REQUIREMENTS,
package_data={
"": [
# Include yaml files in the package (if any)
"*.yml",
"*.yaml",
# Include all json files in the package, up to 4 levels deep
"*.json",
"*/*.json",
"*/*/*.json",
"*/*/*/*.json",
"*/*/*/*/*.json",
]
},
extras_require={
"tests": TEST_REQUIREMENTS,
},
)

View File

@@ -26,5 +26,6 @@ You can fetch with one source configuration more than one pool simultaneously. Y
| Version | Date | Pull Request | Subject |
| :------ | :--------- | :----------- | :--------------------------------------------------- |
| 0.2.1 | 2024-05-21 | [38514](https://github.com/airbytehq/airbyte/pull/38514) | [autopull] base image + poetry + up_to_date |
| 0.2.0 | 2023-11-10 | | Update KYVE source to support to Mainnet and Testnet |
| 0.1.0 | 2023-05-25 | | Initial release of KYVE source connector |