Skip to content

Commit debca39

Browse files
btkcodedevgirardalazebnyi
authored
✨Source Pivotal-Tracker: Migrate Python CDK to Low-code CDK (#36953)
Co-authored-by: Alexandre Girard <[email protected]> Co-authored-by: Serhii Lazebnyi <[email protected]>
1 parent 0405990 commit debca39

28 files changed

+2137
-1378
lines changed

airbyte-integrations/connectors/source-pivotal-tracker/.dockerignore

-6
This file was deleted.

airbyte-integrations/connectors/source-pivotal-tracker/Dockerfile

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

3-
This is the repository for the Pivotal Tracker source connector, written in Python.
4-
For information about how to use this connector within Airbyte, see [the documentation](https://docs.airbyte.io/integrations/sources/pivotal-tracker).
3+
This is the repository for the Pivotal Tracker configuration based source connector.
4+
For information about how to use this connector within Airbyte, see [the documentation](https://docs.airbyte.com/integrations/sources/pivotal-tracker).
55

66
## Local development
77

88
### Prerequisites
99

10-
**To iterate on this connector, make sure to complete this prerequisites section.**
10+
* Python (`^3.9`)
11+
* Poetry (`^1.7`) - installation instructions [here](https://python-poetry.org/docs/#installation)
1112

12-
#### Minimum Python version required `= 3.7.0`
1313

14-
#### Build & Activate Virtual Environment and install dependencies
1514

16-
From this connector directory, create a virtual environment:
15+
### Installing the connector
1716

18-
```
19-
python -m venv .venv
20-
```
21-
22-
This will generate a virtualenv for this module in `.venv/`. Make sure this venv is active in your
23-
development environment of choice. To activate it from the terminal, run:
24-
25-
```
26-
source .venv/bin/activate
27-
pip install -r requirements.txt
28-
pip install '.[tests]'
17+
From this connector directory, run:
18+
```bash
19+
poetry install --with dev
2920
```
3021

31-
If you are in an IDE, follow your IDE's instructions to activate the virtualenv.
3222

33-
Note that while we are installing dependencies from `requirements.txt`, you should only edit `setup.py` for your dependencies. `requirements.txt` is
34-
used for editable installs (`pip install -e`) to pull in Python dependencies from the monorepo and will call `setup.py`.
35-
If this is mumbo jumbo to you, don't worry about it, just put your deps in `setup.py` but install using `pip install -r requirements.txt` and everything
36-
should work as you expect.
23+
### Create credentials
3724

38-
#### Create credentials
39-
40-
**If you are a community contributor**, follow the instructions in the [documentation](https://docs.airbyte.io/integrations/sources/pivotal-tracker)
41-
to generate the necessary credentials. Then create a file `secrets/config.json` conforming to the `source_pivotal_tracker/spec.json` file.
25+
**If you are a community contributor**, follow the instructions in the [documentation](https://docs.airbyte.com/integrations/sources/pivotal-tracker)
26+
to generate the necessary credentials. Then create a file `secrets/config.json` conforming to the `spec` inside `manifest.yaml` file.
4227
Note that any directory named `secrets` is gitignored across the entire Airbyte repo, so there is no danger of accidentally checking in sensitive information.
4328
See `integration_tests/sample_config.json` for a sample config file.
4429

45-
**If you are an Airbyte core member**, copy the credentials in Lastpass under the secret name `source pivotal-tracker test creds`
46-
and place them into `secrets/config.json`.
4730

4831
### Locally running the connector
4932

33+
5034
```
51-
python main.py spec
52-
python main.py check --config secrets/config.json
53-
python main.py discover --config secrets/config.json
54-
python main.py read --config secrets/config.json --catalog integration_tests/configured_catalog.json
35+
poetry run source-pivotal-tracker spec
36+
poetry run source-pivotal-tracker check --config secrets/config.json
37+
poetry run source-pivotal-tracker discover --config secrets/config.json
38+
poetry run source-pivotal-tracker read --config secrets/config.json --catalog integration_tests/configured_catalog.json
5539
```
5640

57-
### Locally running the connector docker image
41+
### Running tests
5842

59-
#### Build
43+
To run tests locally, from the connector directory run:
6044

61-
**Via [`airbyte-ci`](https://github.com/airbytehq/airbyte/blob/master/airbyte-ci/connectors/pipelines/README.md) (recommended):**
45+
```
46+
poetry run pytest tests
47+
```
6248

49+
### Building the docker image
50+
51+
1. Install [`airbyte-ci`](https://github.com/airbytehq/airbyte/blob/master/airbyte-ci/connectors/pipelines/README.md)
52+
2. Run the following command to build the docker image:
6353
```bash
6454
airbyte-ci connectors --name=source-pivotal-tracker build
6555
```
6656

67-
An image will be built with the tag `airbyte/source-pivotal-tracker:dev`.
68-
69-
**Via `docker build`:**
57+
An image will be available on your host with the tag `airbyte/source-pivotal-tracker:dev`.
7058

71-
```bash
72-
docker build -t airbyte/source-pivotal-tracker:dev .
73-
```
7459

75-
#### Run
60+
### Running as a docker container
7661

7762
Then run any of the connector commands as follows:
7863

@@ -83,7 +68,7 @@ docker run --rm -v $(pwd)/secrets:/secrets airbyte/source-pivotal-tracker:dev di
8368
docker run --rm -v $(pwd)/secrets:/secrets -v $(pwd)/integration_tests:/integration_tests airbyte/source-pivotal-tracker:dev read --config /secrets/config.json --catalog /integration_tests/configured_catalog.json
8469
```
8570

86-
## Testing
71+
### Running our CI test suite
8772

8873
You can run our full test suite locally using [`airbyte-ci`](https://github.com/airbytehq/airbyte/blob/master/airbyte-ci/connectors/pipelines/README.md):
8974

@@ -93,25 +78,30 @@ airbyte-ci connectors --name=source-pivotal-tracker test
9378

9479
### Customizing acceptance Tests
9580

96-
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.
81+
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.
9782
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.
9883

99-
## Dependency Management
84+
### Dependency Management
10085

101-
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.
102-
We split dependencies between two groups, dependencies that are:
86+
All of your dependencies should be managed via Poetry.
87+
To add a new dependency, run:
88+
```bash
89+
poetry add <package-name>
90+
```
10391

104-
- required for your connector to work need to go to `MAIN_REQUIREMENTS` list.
105-
- required for the testing need to go to `TEST_REQUIREMENTS` list
92+
Please commit the changes to `pyproject.toml` and `poetry.lock` files.
10693

107-
### Publishing a new version of the connector
94+
## Publishing a new version of the connector
10895

10996
You've checked out the repo, implemented a million dollar feature, and you're ready to share your changes with the world. Now what?
11097

11198
1. Make sure your changes are passing our test suite: `airbyte-ci connectors --name=source-pivotal-tracker test`
112-
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).
99+
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)):
100+
- bump the `dockerImageTag` value in in `metadata.yaml`
101+
- bump the `version` value in `pyproject.toml`
113102
3. Make sure the `metadata.yaml` content is up to date.
114-
4. Make the connector documentation and its changelog is up to date (`docs/integrations/sources/pivotal-tracker.md`).
103+
4. Make sure the connector documentation and its changelog is up to date (`docs/integrations/sources/pivotal-tracker.md`).
115104
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).
116105
6. Pat yourself on the back for being an awesome contributor.
117106
7. Someone from Airbyte will take a look at your PR and iterate with you to merge it into master.
107+
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
@@ -0,0 +1,3 @@
1+
#
2+
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
3+
#
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,35 @@
11
# See [Connector Acceptance Tests](https://docs.airbyte.com/connector-development/testing-connectors/connector-acceptance-tests-reference)
22
# for more information about how to configure these tests
33
connector_image: airbyte/source-pivotal-tracker:dev
4-
tests:
4+
acceptance_tests:
55
spec:
6-
- spec_path: "source_pivotal_tracker/spec.json"
6+
tests:
7+
- spec_path: "source_pivotal_tracker/spec.yaml"
78
connection:
8-
- config_path: "secrets/config.json"
9-
status: "succeed"
10-
- config_path: "integration_tests/invalid_config.json"
11-
status: "failed"
9+
tests:
10+
- config_path: "secrets/config.json"
11+
status: "succeed"
12+
- config_path: "integration_tests/invalid_config.json"
13+
status: "failed"
1214
discovery:
13-
- config_path: "secrets/config.json"
15+
tests:
16+
- config_path: "secrets/config.json"
1417
basic_read:
15-
- config_path: "secrets/config.json"
16-
configured_catalog_path: "integration_tests/configured_catalog.json"
17-
empty_streams: []
18+
tests:
19+
- config_path: "secrets/config.json"
20+
configured_catalog_path: "integration_tests/configured_catalog.json"
21+
empty_streams: []
22+
# expect_records:
23+
# path: "integration_tests/expected_records.jsonl"
24+
# exact_order: no
25+
incremental:
26+
bypass_reason: "This connector does not implement incremental sync"
27+
# tests:
28+
# - config_path: "secrets/config.json"
29+
# configured_catalog_path: "integration_tests/configured_catalog.json"
30+
# future_state:
31+
# future_state_path: "integration_tests/abnormal_state.json"
1832
full_refresh:
19-
- config_path: "secrets/config.json"
20-
configured_catalog_path: "integration_tests/configured_catalog.json"
33+
tests:
34+
- config_path: "secrets/config.json"
35+
configured_catalog_path: "integration_tests/configured_catalog.json"
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#
2-
# Copyright (c) 2021 Airbyte, Inc., all rights reserved.
2+
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
33
#

airbyte-integrations/connectors/source-pivotal-tracker/integration_tests/acceptance.py

+2
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,6 @@
1111
@pytest.fixture(scope="session", autouse=True)
1212
def connector_setup():
1313
"""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
1415
yield
16+
# TODO: clean up test dependencies

0 commit comments

Comments
 (0)