You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add README info about using your local CDK locally and in docker (#20082)
* Add README info about installing the local CDK locally and in Docker
* Add '|| true' to validate_dockerignore()
* Update airbyte-cdk/python/README.md
Co-authored-by: Sherif A. Nada <[email protected]>
Co-authored-by: Sherif A. Nada <[email protected]>
All tests are located in the `unit_tests` directory. Run `pytest --cov=airbyte_cdk unit_tests/` to run them. This also presents a test coverage report.
72
72
73
+
#### Building a connector with your local CDK
74
+
75
+
When developing a new feature in the CDK, you may find it helpful to run a connector that uses that new feature. You can test this in one of two ways:
76
+
* Running a connector locally
77
+
* Building and running a source via Docker
78
+
79
+
##### Installing your local CDK into a local Python connector
80
+
81
+
In order to get a local Python connector running your local CDK, do the following.
82
+
83
+
First, make sure you have your connector's virtual environment active:
84
+
```bash
85
+
# from the `airbyte/airbyte-integrations/connectors/<connector-directory>` directory
86
+
source .venv/bin/activate
87
+
88
+
# if you haven't installed dependencies for your connector already
89
+
pip install -e .
90
+
```
91
+
92
+
Then, navigate to the CDK and install it in editable mode:
93
+
```bash
94
+
cd ../../../airbyte-cdk/python
95
+
pip install -e .
96
+
```
97
+
98
+
You should see that `pip` has uninstalled the version of `airbyte-cdk` defined by your connector's `setup.py` and installed your local CDK. Any changes you make will be immediately reflected in your editor, so long as your editor's interpreter is set to your connector's virtual environment.
99
+
100
+
##### Building a Python connector in Docker with your local CDK installed
101
+
102
+
Create a symlink that connects `<connector-directory>/airbyte-cdk` to your local CDK installation:
103
+
```bash
104
+
# from the `airbyte/airbyte-integrations/connectors/<connector-directory>` directory
105
+
ln -s ../../../airbyte-cdk/python airbyte-cdk
106
+
```
107
+
108
+
Add the following lines to your connector's `Dockerfile`, before the line that installs dependencies via `pip install -e .`:
109
+
```Dockerfile
110
+
COPY airbyte-cdk airbyte-cdk
111
+
RUN pip install -e ./airbyte-cdk
112
+
```
113
+
114
+
Add the following to your connectors `build.gradle` file:
and the installation should use your local CDK. Note that the local CDK is injected at build time, so if you make changes, you will have to run the build command again to see them reflected.
127
+
**Note:** if your connector uses a `.dockerignore` file, it cannot have `exclude-all` or `exclude-except` patterns, i.e. the `.dockerignore` must specifically say which files to ignore without using any regex.
if [ -n"$excludes_all" ] || [ -n"$excludes_except" ];then
25
25
error "Cannot include exclusion exceptions when following symlinks. Please use an exclude pattern that doesn't use exclude-all (e.g: *) or exclude-except (e.g: !/some/pattern)"
0 commit comments