|
1 | 1 | # Chartmogul Source
|
2 | 2 |
|
3 |
| -This is the repository for the Chartmogul 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/chartmogul). |
| 3 | +This is the repository for the Chartmogul configuration based source connector. |
| 4 | +For information about how to use this connector within Airbyte, see [the documentation](https://docs.airbyte.com/integrations/sources/chartmogul). |
5 | 5 |
|
6 | 6 | ## Local development
|
7 | 7 |
|
8 | 8 | ### Prerequisites
|
9 | 9 |
|
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) |
11 | 12 |
|
12 |
| -#### Minimum Python version required `= 3.7.0` |
13 | 13 |
|
14 |
| -#### Build & Activate Virtual Environment and install dependencies |
15 | 14 |
|
16 |
| -From this connector directory, create a virtual environment: |
| 15 | +### Installing the connector |
17 | 16 |
|
| 17 | +From this connector directory, run: |
| 18 | +```bash |
| 19 | +poetry install --with dev |
18 | 20 | ```
|
19 |
| -python3 -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]' |
29 |
| -``` |
30 |
| - |
31 |
| -If you are in an IDE, follow your IDE's instructions to activate the virtualenv. |
32 | 21 |
|
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. |
37 | 22 |
|
38 |
| -#### Create credentials |
| 23 | +### Create credentials |
39 | 24 |
|
40 |
| -**If you are a community contributor**, follow the instructions in the [documentation](https://docs.airbyte.io/integrations/sources/chartmogul) |
41 |
| -to generate the necessary credentials. Then create a file `secrets/config.json` conforming to the `source_chartmogul/spec.json` file. |
| 25 | +**If you are a community contributor**, follow the instructions in the [documentation](https://docs.airbyte.com/integrations/sources/chartmogul) |
| 26 | +to generate the necessary credentials. Then create a file `secrets/config.json` conforming to the `src/source_chartmogul/spec.yaml` file. |
42 | 27 | Note that any directory named `secrets` is gitignored across the entire Airbyte repo, so there is no danger of accidentally checking in sensitive information.
|
43 |
| -See `integration_tests/sample_config.json` for a sample config file. |
| 28 | +See `sample_files/sample_config.json` for a sample config file. |
44 | 29 |
|
45 |
| -**If you are an Airbyte core member**, copy the credentials in Lastpass under the secret name `source chartmogul test creds` |
46 |
| -and place them into `secrets/config.json`. |
47 | 30 |
|
48 | 31 | ### Locally running the connector
|
49 | 32 |
|
50 | 33 | ```
|
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 |
| 34 | +poetry run source-chartmogul spec |
| 35 | +poetry run source-chartmogul check --config secrets/config.json |
| 36 | +poetry run source-chartmogul discover --config secrets/config.json |
| 37 | +poetry run source-chartmogul read --config secrets/config.json --catalog integration_tests/configured_catalog.json |
55 | 38 | ```
|
56 | 39 |
|
57 |
| -### Locally running the connector docker image |
| 40 | +### Running tests |
58 | 41 |
|
59 |
| -#### Build |
| 42 | +To run tests locally, from the connector directory run: |
| 43 | + |
| 44 | +``` |
| 45 | +poetry run pytest tests |
| 46 | +``` |
60 | 47 |
|
61 |
| -**Via [`airbyte-ci`](https://github.com/airbytehq/airbyte/blob/master/airbyte-ci/connectors/pipelines/README.md) (recommended):** |
| 48 | +### Building the docker image |
62 | 49 |
|
| 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: |
63 | 52 | ```bash
|
64 | 53 | airbyte-ci connectors --name=source-chartmogul build
|
65 | 54 | ```
|
66 | 55 |
|
67 |
| -An image will be built with the tag `airbyte/source-chartmogul:dev`. |
| 56 | +An image will be available on your host with the tag `airbyte/source-chartmogul:dev`. |
68 | 57 |
|
69 |
| -**Via `docker build`:** |
70 | 58 |
|
71 |
| -```bash |
72 |
| -docker build -t airbyte/source-chartmogul:dev . |
73 |
| -``` |
74 |
| - |
75 |
| -#### Run |
| 59 | +### Running as a docker container |
76 | 60 |
|
77 | 61 | Then run any of the connector commands as follows:
|
78 |
| - |
79 | 62 | ```
|
80 | 63 | docker run --rm airbyte/source-chartmogul:dev spec
|
81 | 64 | docker run --rm -v $(pwd)/secrets:/secrets airbyte/source-chartmogul:dev check --config /secrets/config.json
|
82 | 65 | docker run --rm -v $(pwd)/secrets:/secrets airbyte/source-chartmogul:dev discover --config /secrets/config.json
|
83 | 66 | docker run --rm -v $(pwd)/secrets:/secrets -v $(pwd)/integration_tests:/integration_tests airbyte/source-chartmogul:dev read --config /secrets/config.json --catalog /integration_tests/configured_catalog.json
|
84 | 67 | ```
|
85 | 68 |
|
86 |
| -## Testing |
| 69 | +### Running our CI test suite |
87 | 70 |
|
88 | 71 | You can run our full test suite locally using [`airbyte-ci`](https://github.com/airbytehq/airbyte/blob/master/airbyte-ci/connectors/pipelines/README.md):
|
89 |
| - |
90 | 72 | ```bash
|
91 | 73 | airbyte-ci connectors --name=source-chartmogul test
|
92 | 74 | ```
|
93 | 75 |
|
94 | 76 | ### Customizing acceptance Tests
|
95 | 77 |
|
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. |
| 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. |
97 | 79 | 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.
|
98 | 80 |
|
99 |
| -## Dependency Management |
| 81 | +### Dependency Management |
100 | 82 |
|
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: |
| 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 | +``` |
103 | 88 |
|
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 |
| 89 | +Please commit the changes to `pyproject.toml` and `poetry.lock` files. |
106 | 90 |
|
107 |
| -### Publishing a new version of the connector |
| 91 | +## Publishing a new version of the connector |
108 | 92 |
|
109 | 93 | You've checked out the repo, implemented a million dollar feature, and you're ready to share your changes with the world. Now what?
|
110 |
| - |
111 | 94 | 1. Make sure your changes are passing our test suite: `airbyte-ci connectors --name=source-chartmogul 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). |
| 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` |
113 | 98 | 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/chartmogul.md`). |
| 99 | +4. Make sure the connector documentation and its changelog is up to date (`docs/integrations/sources/chartmogul.md`). |
115 | 100 | 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).
|
116 | 101 | 6. Pat yourself on the back for being an awesome contributor.
|
117 | 102 | 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. |
0 commit comments