Package: airbyte-source-klaus-api
Klaus Api SourceThis is the repository for the Klaus Api source connector, written in Python.
For information about how to use this connector within Airbyte, seethe documentation.To iterate on this connector, make sure to complete this prerequisites section.From this connector directory, create a virtual environment:python -m venv .venvThis will generate a virtualenv for this module in.venv/. Make sure this venv is active in your
development environment of choice. To activate it from the terminal, run:source .venv/bin/activate
pip install -r requirements.txt
pip install '.[tests]'If you are in an IDE, follow your IDE's instructions to activate the virtualenv.Note that while we are installing dependencies fromrequirements.txt, you should only editsetup.pyfor your dependencies.requirements.txtis
used for editable installs (pip install -e) to pull in Python dependencies from the monorepo and will callsetup.py.
If this is mumbo jumbo to you, don't worry about it, just put your deps insetup.pybut install usingpip install -r requirements.txtand everything
should work as you expect.You can also build the connector in Gradle. This is typically used in CI and not needed for your development workflow.To build using Gradle, from the Airbyte repository root, run:./gradlew :airbyte-integrations:connectors:source-klaus-api:buildIf you are a community contributor, follow the instructions in thedocumentationto generate the necessary credentials. Then create a filesecrets/config.jsonconforming to thesource_klaus_api/spec.yamlfile.
Note that any directory namedsecretsis gitignored across the entire Airbyte repo, so there is no danger of accidentally checking in sensitive information.
Seeintegration_tests/sample_config.jsonfor a sample config file.If you are an Airbyte core member, copy the credentials in Lastpass under the secret namesource klaus-api test credsand place them intosecrets/config.json.python main.py spec
python main.py check --config secrets/config.json
python main.py discover --config secrets/config.json
python main.py read --config secrets/config.json --catalog integration_tests/configured_catalog.jsonFirst, make sure you build the latest Docker image:docker build . -t airbyte/source-klaus-api:devIf you want to build the Docker image with the CDK on your local machine (rather than the most recent package published to pypi), from the airbyte base directory run:CONNECTOR_TAG=<TAG_NAME>CONNECTOR_NAME=<CONNECTOR_NAME>shairbyte-integrations/scripts/build-connector-image-with-local-cdk.shYou can also build the connector image via Gradle:./gradlew :airbyte-integrations:connectors:source-klaus-api:airbyteDockerWhen building via Gradle, the docker image name and tag, respectively, are the values of theio.airbyte.nameandio.airbyte.versionLABELs in
the Dockerfile.Then run any of the connector commands as follows:docker run --rm airbyte/source-klaus-api:dev spec
docker run --rm -v $(pwd)/secrets:/secrets airbyte/source-klaus-api:dev check --config /secrets/config.json
docker run --rm -v $(pwd)/secrets:/secrets airbyte/source-klaus-api:dev discover --config /secrets/config.json
docker run --rm -v $(pwd)/secrets:/secrets -v $(pwd)/integration_tests:/integration_tests airbyte/source-klaus-api:dev read --config /secrets/config.json --catalog /integration_tests/configured_catalog.jsonMake sure to familiarize yourself withpytest test discoveryto know how your test files and methods should be named.
First install test dependencies into your virtual environment:pip install .[tests]To run unit tests locally, from the connector directory run:python -m pytest unit_testsThere are two types of integration tests: Acceptance Tests (Airbyte's test suite for all source connectors) and custom integration tests (which are specific to this connector).
Place custom tests insideintegration_tests/folder, then, from the connector root, runpython -m pytest integration_testsCustomizeacceptance-test-config.ymlfile to configure tests. SeeConnector Acceptance Testsfor 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.
To run your integration tests with acceptance tests, from the connector root, runpython -m pytest integration_tests -p integration_tests.acceptanceTo run your integration tests with dockerAll commands should be run from airbyte project root.
To run unit tests:./gradlew :airbyte-integrations:connectors:source-klaus-api:unitTestTo run acceptance and custom integration tests:./gradlew :airbyte-integrations:connectors:source-klaus-api:integrationTestAll of your dependencies should go insetup.py, NOTrequirements.txt. The requirements file is only used to connect internal Airbyte dependencies in the monorepo for local development.
We split dependencies between two groups, dependencies that are:required for your connector to work need to go toMAIN_REQUIREMENTSlist.required for the testing need to go toTEST_REQUIREMENTSlistYou've checked out the repo, implemented a million dollar feature, and you're ready to share your changes with the world. Now what?Make sure your changes are passing unit and integration tests.Bump the connector version inDockerfile-- just increment the value of theLABEL io.airbyte.versionappropriately (we useSemVer).Create a Pull Request.Pat yourself on the back for being an awesome contributor.Someone from Airbyte will take a look at your PR and iterate with you to merge it into master.