Skip to content

Commit 6b2669b

Browse files
josixmarcosmarxmoctavia-squidington-iii
authored andcommitted
🎉 New Source: ClickUp (#17770)
* feat(connectors): add source clickup api template * feat(connectors/clickup-api): add /user and /team endpoint configs * docs(clickup-connectors): add clickup source doc * feat: add tasks stream and list stream to ClickUp API * feat: add space stream and folder stream to clikcup api * feat: update acceptance-test-config.yml w/ version in 0.2.12 https://github.com/airbytehq/airbyte/tree/459856b73cfebe659741cccdd83590ba0dff2493/airbyte-integrations/bases/source-acceptance-test#migrating-acceptance-test-configyml-to-latest-configuration-format * docs: add descripiton for optional configs fields * fix: fix list.json schema * fix: add ignore_fields to ignore changing value in full_refresh of acceptance-tests * add clickup to source def * auto-bump connector version Co-authored-by: marcosmarxm <[email protected]> Co-authored-by: Octavia Squidington III <[email protected]> Co-authored-by: Marcos Marx <[email protected]>
1 parent d9b8fae commit 6b2669b

30 files changed

+1016
-0
lines changed

airbyte-config/init/src/main/resources/seed/source_definitions.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,13 @@
216216
icon: cliskhouse.svg
217217
sourceType: database
218218
releaseStage: alpha
219+
- name: ClickUp
220+
sourceDefinitionId: 311a7a27-3fb5-4f7e-8265-5e4afe258b66
221+
dockerRepository: airbyte/source-clickup-api
222+
dockerImageTag: 0.1.0
223+
documentationUrl: https://docs.airbyte.com/integrations/sources/click-up
224+
sourceType: api
225+
releaseStage: alpha
219226
- name: Close.com
220227
sourceDefinitionId: dfffecb7-9a13-43e9-acdc-b92af7997ca9
221228
dockerRepository: airbyte/source-close-com

airbyte-config/init/src/main/resources/seed/source_specs.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2233,6 +2233,46 @@
22332233
supportsNormalization: false
22342234
supportsDBT: false
22352235
supported_destination_sync_modes: []
2236+
- dockerImage: "airbyte/source-clickup-api:0.1.0"
2237+
spec:
2238+
documentationUrl: "https://docsurl.com"
2239+
connectionSpecification:
2240+
$schema: "http://json-schema.org/draft-07/schema#"
2241+
title: "ClickUp Api Spec"
2242+
type: "object"
2243+
required:
2244+
- "api_token"
2245+
additionalProperties: true
2246+
properties:
2247+
api_token:
2248+
type: "string"
2249+
description: "Every ClickUp API call required authentication. This field\
2250+
\ is your personal API token. See <a href=\"https://clickup.com/api/developer-portal/authentication/#personal-token\"\
2251+
>here</a>."
2252+
airbyte_secret: true
2253+
team_id:
2254+
type: "string"
2255+
description: "The ID of your team in ClickUp. Retrieve it from the `/team`\
2256+
\ of the ClickUp API. See <a href=\"https://clickup.com/api/clickupreference/operation/GetAuthorizedTeams/\"\
2257+
>here</a>."
2258+
space_id:
2259+
type: "string"
2260+
description: "The ID of your space in your workspace. Retrieve it from the\
2261+
\ `/team/{team_id}/space` of the ClickUp API. See <a href=\"https://clickup.com/api/clickupreference/operation/GetSpaces/\"\
2262+
>here</a>."
2263+
folder_id:
2264+
type: "string"
2265+
description: "The ID of your folder in your space. Retrieve it from the\
2266+
\ `/space/{space_id}/folder` of the ClickUp API. See <a href=\"https://clickup.com/api/clickupreference/operation/GetFolders/\"\
2267+
>here</a>."
2268+
list_id:
2269+
type: "string"
2270+
description: "The ID of your list in your folder. Retrieve it from the `/folder/{folder_id}/list`\
2271+
\ of the ClickUp API. See <a href=\"https://clickup.com/api/clickupreference/operation/GetLists/\"\
2272+
>here</a>."
2273+
supportsNormalization: false
2274+
supportsDBT: false
2275+
supported_destination_sync_modes: []
22362276
- dockerImage: "airbyte/source-close-com:0.1.0"
22372277
spec:
22382278
documentationUrl: "https://docs.airbyte.com/integrations/sources/close-com"
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
*
2+
!Dockerfile
3+
!main.py
4+
!source_clickup_api
5+
!setup.py
6+
!secrets
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
FROM python:3.9.11-alpine3.15 as base
2+
3+
# build and load all requirements
4+
FROM base as builder
5+
WORKDIR /airbyte/integration_code
6+
7+
# upgrade pip to the latest version
8+
RUN apk --no-cache upgrade \
9+
&& pip install --upgrade pip \
10+
&& apk --no-cache add tzdata build-base
11+
12+
13+
COPY setup.py ./
14+
# install necessary packages to a temporary folder
15+
RUN pip install --prefix=/install .
16+
17+
# build a clean environment
18+
FROM base
19+
WORKDIR /airbyte/integration_code
20+
21+
# copy all loaded and built libraries to a pure basic image
22+
COPY --from=builder /install /usr/local
23+
# add default timezone settings
24+
COPY --from=builder /usr/share/zoneinfo/Etc/UTC /etc/localtime
25+
RUN echo "Etc/UTC" > /etc/timezone
26+
27+
# bash is installed for more convenient debugging.
28+
RUN apk --no-cache add bash
29+
30+
# copy payload code only
31+
COPY main.py ./
32+
COPY source_clickup_api ./source_clickup_api
33+
34+
ENV AIRBYTE_ENTRYPOINT "python /airbyte/integration_code/main.py"
35+
ENTRYPOINT ["python", "/airbyte/integration_code/main.py"]
36+
37+
LABEL io.airbyte.version=0.1.0
38+
LABEL io.airbyte.name=airbyte/source-clickup-api
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# Clickup Api Source
2+
3+
This is the repository for the Clickup Api configuration based source connector.
4+
For information about how to use this connector within Airbyte, see [the documentation](https://docs.airbyte.io/integrations/sources/clickup-api).
5+
6+
## Local development
7+
8+
#### Building via Gradle
9+
You can also build the connector in Gradle. This is typically used in CI and not needed for your development workflow.
10+
11+
To build using Gradle, from the Airbyte repository root, run:
12+
```
13+
./gradlew :airbyte-integrations:connectors:source-clickup-api:build
14+
```
15+
16+
#### Create credentials
17+
**If you are a community contributor**, follow the instructions in the [documentation](https://docs.airbyte.io/integrations/sources/clickup-api)
18+
to generate the necessary credentials. Then create a file `secrets/config.json` conforming to the `source_clickup_api/spec.yaml` file.
19+
Note that any directory named `secrets` is gitignored across the entire Airbyte repo, so there is no danger of accidentally checking in sensitive information.
20+
See `integration_tests/sample_config.json` for a sample config file.
21+
22+
**If you are an Airbyte core member**, copy the credentials in Lastpass under the secret name `source clickup-api test creds`
23+
and place them into `secrets/config.json`.
24+
25+
### Locally running the connector docker image
26+
27+
#### Build
28+
First, make sure you build the latest Docker image:
29+
```
30+
docker build . -t airbyte/source-clickup-api:dev
31+
```
32+
33+
You can also build the connector image via Gradle:
34+
```
35+
./gradlew :airbyte-integrations:connectors:source-clickup-api:airbyteDocker
36+
```
37+
When building via Gradle, the docker image name and tag, respectively, are the values of the `io.airbyte.name` and `io.airbyte.version` `LABEL`s in
38+
the Dockerfile.
39+
40+
#### Run
41+
Then run any of the connector commands as follows:
42+
```
43+
docker run --rm airbyte/source-clickup-api:dev spec
44+
docker run --rm -v $(pwd)/secrets:/secrets airbyte/source-clickup-api:dev check --config /secrets/config.json
45+
docker run --rm -v $(pwd)/secrets:/secrets airbyte/source-clickup-api:dev discover --config /secrets/config.json
46+
docker run --rm -v $(pwd)/secrets:/secrets -v $(pwd)/integration_tests:/integration_tests airbyte/source-clickup-api:dev read --config /secrets/config.json --catalog /integration_tests/configured_catalog.json
47+
```
48+
## Testing
49+
50+
#### Acceptance Tests
51+
Customize `acceptance-test-config.yml` file to configure tests. See [Source Acceptance Tests](https://docs.airbyte.io/connector-development/testing-connectors/source-acceptance-tests-reference) for more information.
52+
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.
53+
54+
To run your integration tests with docker
55+
56+
### Using gradle to run tests
57+
All commands should be run from airbyte project root.
58+
To run unit tests:
59+
```
60+
./gradlew :airbyte-integrations:connectors:source-clickup-api:unitTest
61+
```
62+
To run acceptance and custom integration tests:
63+
```
64+
./gradlew :airbyte-integrations:connectors:source-clickup-api:integrationTest
65+
```
66+
67+
## Dependency Management
68+
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.
69+
We split dependencies between two groups, dependencies that are:
70+
* required for your connector to work need to go to `MAIN_REQUIREMENTS` list.
71+
* required for the testing need to go to `TEST_REQUIREMENTS` list
72+
73+
### Publishing a new version of the connector
74+
You've checked out the repo, implemented a million dollar feature, and you're ready to share your changes with the world. Now what?
75+
1. Make sure your changes are passing unit and integration tests.
76+
1. Bump the connector version in `Dockerfile` -- just increment the value of the `LABEL io.airbyte.version` appropriately (we use [SemVer](https://semver.org/)).
77+
1. Create a Pull Request.
78+
1. Pat yourself on the back for being an awesome contributor.
79+
1. Someone from Airbyte will take a look at your PR and iterate with you to merge it into master.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#
2+
# Copyright (c) 2022 Airbyte, Inc., all rights reserved.
3+
#
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
acceptance_tests:
2+
basic_read:
3+
tests:
4+
- config_path: secrets/config.json
5+
empty_streams: []
6+
connection:
7+
tests:
8+
- config_path: secrets/config.json
9+
status: succeed
10+
- config_path: integration_tests/invalid_config.json
11+
status: failed
12+
discovery:
13+
tests:
14+
- config_path: secrets/config.json
15+
full_refresh:
16+
tests:
17+
- config_path: secrets/config.json
18+
configured_catalog_path: integration_tests/configured_catalog.json
19+
ignored_fields:
20+
"team": ["members", "last_active"]
21+
spec:
22+
tests:
23+
- spec_path: source_clickup_api/spec.yaml
24+
timeout_seconds: 1200
25+
incremental:
26+
bypass_reason: "Incremental syncs are not supported on this connector."
27+
connector_image: airbyte/source-clickup-api:dev
28+
test_strictness_level: low
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env sh
2+
3+
# Build latest connector image
4+
docker build . -t $(cat acceptance-test-config.yml | grep "connector_image" | head -n 1 | cut -d: -f2-)
5+
6+
# Pull latest acctest image
7+
docker pull airbyte/source-acceptance-test:latest
8+
9+
# Run
10+
docker run --rm -it \
11+
-v /var/run/docker.sock:/var/run/docker.sock \
12+
-v /tmp:/tmp \
13+
-v $(pwd):/test_input \
14+
airbyte/source-acceptance-test \
15+
--acceptance-test-config /test_input
16+
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
plugins {
2+
id 'airbyte-python'
3+
id 'airbyte-docker'
4+
id 'airbyte-source-acceptance-test'
5+
}
6+
7+
airbytePython {
8+
moduleDirectory 'source_clickup_api'
9+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#
2+
# Copyright (c) 2022 Airbyte, Inc., all rights reserved.
3+
#
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"todo-stream-name": {
3+
"todo-field-name": "todo-abnormal-value"
4+
}
5+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#
2+
# Copyright (c) 2022 Airbyte, Inc., all rights reserved.
3+
#
4+
5+
6+
import pytest
7+
8+
pytest_plugins = ("source_acceptance_test.plugin",)
9+
10+
11+
@pytest.fixture(scope="session", autouse=True)
12+
def connector_setup():
13+
"""This fixture is a placeholder for external resources that acceptance test might require."""
14+
# TODO: setup test dependencies if needed. otherwise remove the TODO comments
15+
yield
16+
# TODO: clean up test dependencies
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
{
2+
"streams": [
3+
{
4+
"stream": {
5+
"name": "user",
6+
"json_schema": {},
7+
"supported_sync_modes": ["full_refresh"]
8+
},
9+
"sync_mode": "full_refresh",
10+
"destination_sync_mode": "overwrite"
11+
},
12+
{
13+
"stream": {
14+
"name": "team",
15+
"json_schema": {},
16+
"supported_sync_modes": ["full_refresh"]
17+
},
18+
"sync_mode": "full_refresh",
19+
"destination_sync_mode": "overwrite"
20+
},
21+
{
22+
"stream": {
23+
"name": "list",
24+
"json_schema": {},
25+
"supported_sync_modes": ["full_refresh"]
26+
},
27+
"sync_mode": "full_refresh",
28+
"destination_sync_mode": "overwrite"
29+
},
30+
{
31+
"stream": {
32+
"name": "task",
33+
"json_schema": {},
34+
"supported_sync_modes": ["full_refresh"]
35+
},
36+
"sync_mode": "full_refresh",
37+
"destination_sync_mode": "overwrite"
38+
},
39+
{
40+
"stream": {
41+
"name": "space",
42+
"json_schema": {},
43+
"supported_sync_modes": ["full_refresh"]
44+
},
45+
"sync_mode": "full_refresh",
46+
"destination_sync_mode": "overwrite"
47+
},
48+
{
49+
"stream": {
50+
"name": "folder",
51+
"json_schema": {},
52+
"supported_sync_modes": ["full_refresh"]
53+
},
54+
"sync_mode": "full_refresh",
55+
"destination_sync_mode": "overwrite"
56+
}
57+
]
58+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"api_token": "this should be an incomplete config file, used in standard tests"
3+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{ "api_token": "abcdefgh" }
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"todo-stream-name": {
3+
"todo-field-name": "value"
4+
}
5+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#
2+
# Copyright (c) 2022 Airbyte, Inc., all rights reserved.
3+
#
4+
5+
6+
import sys
7+
8+
from airbyte_cdk.entrypoint import launch
9+
from source_clickup_api import SourceClickupApi
10+
11+
if __name__ == "__main__":
12+
source = SourceClickupApi()
13+
launch(source, sys.argv[1:])
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
-e ../../bases/source-acceptance-test
2+
-e .
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#
2+
# Copyright (c) 2022 Airbyte, Inc., all rights reserved.
3+
#
4+
5+
6+
from setuptools import find_packages, setup
7+
8+
MAIN_REQUIREMENTS = [
9+
"airbyte-cdk~=0.4",
10+
]
11+
12+
TEST_REQUIREMENTS = [
13+
"pytest~=6.1",
14+
"pytest-mock~=3.6.1",
15+
"source-acceptance-test",
16+
]
17+
18+
setup(
19+
name="source_clickup_api",
20+
description="Source implementation for Clickup Api.",
21+
author="Airbyte",
22+
author_email="[email protected]",
23+
packages=find_packages(),
24+
install_requires=MAIN_REQUIREMENTS,
25+
package_data={"": ["*.json", "*.yaml", "schemas/*.json", "schemas/shared/*.json"]},
26+
extras_require={
27+
"tests": TEST_REQUIREMENTS,
28+
},
29+
)

0 commit comments

Comments
 (0)