Skip to content

Commit 4d20f83

Browse files
committed
feat: Improvements as per first round of feedback.
1 parent 6b4dde4 commit 4d20f83

File tree

5 files changed

+46
-12
lines changed

5 files changed

+46
-12
lines changed

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ WORKDIR /app
88
COPY pyproject.toml .
99
COPY poetry.lock .
1010
RUN pip3 install --no-cache-dir poetry
11-
RUN poetry install
11+
RUN poetry install --no-dev --no-interaction --no-ansi
1212

1313
# Copy the rest of the code
1414
COPY plugin plugin
@@ -17,7 +17,7 @@ COPY main.py .
1717
# (Optional) Expose any ports your app uses
1818
EXPOSE 7777
1919

20-
ENTRYPOINT ["python3", "main.py"]
20+
ENTRYPOINT ["poetry", "run", "main"]
2121

2222
# Specify the command to run when the container starts
2323
CMD ["serve", "--address", "[::]:7777", "--log-format", "json", "--log-level", "info"]

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,20 @@ Adding these to the CloudQuery config spec can be done by editing the `Spec` `da
5959
### Plugin
6060
Finally, you need to edit the `plugin.py` file to set the plugin name and version, and add the `Tables` to the `get_tables` function.
6161

62+
### Test run
63+
To test your plugin you can run it locally.
64+
65+
To automatically manage your virtual environment and install the dependencies listed in the `pyproject.toml` you can use `poetry`.
66+
Poetry is an improved package & environment manager for Python that uses the standardised `pyproject.toml`, if you don't have it installed you can pull it with `pip install poetry`.
67+
68+
To install the dependencies into a new virtual environment run `poetry install`.
69+
If you have additional dependencies you can add them with `poetry add {package_name}` which will add them to the `pyproject.toml` and install them into the virtual environment.
70+
71+
Then to run the plugin `poetry run main serve`, which will launch the plugin manually as a GRPC service.
72+
73+
With that running you can adjust the `TestConfig.yaml` to match your plugin and run `cloudquery sync`.
74+
This should result in the creation of a sqlite database `db.sqlite` where you can validate your tables are as expected.
75+
6276

6377
## Links
6478

TestConfig.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
kind: source
2+
spec:
3+
name: "comics"
4+
registry: "grpc"
5+
path: "localhost:7777"
6+
tables: ['*']
7+
destinations: ["sqlite"]
8+
spec:
9+
base_url: https://xkcd.com
10+
---
11+
kind: destination
12+
spec:
13+
name: sqlite
14+
path: cloudquery/sqlite
15+
version: "v2.4.11"
16+
spec:
17+
connection_string: ./db.sqlite

poetry.lock

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,18 @@ version = "0.1.0"
44
description = ""
55
authors = ["Plaintextnerds <[email protected]>"]
66
readme = "README.md"
7-
packages = [{include = "example"}]
7+
packages = [{include = "plugin"}]
88

99
[tool.poetry.dependencies]
1010
python = "^3.9,<3.13"
11-
cloudquery-plugin-sdk = "^0.1.5"
11+
cloudquery-plugin-sdk = "^0.1.6"
1212
pydantic = "^2.4"
1313
pyarrow = "^12.0"
1414
requests = "^2.31.0"
1515

16+
[tool.poetry.scripts]
17+
main = "main:main"
18+
1619

1720
[build-system]
1821
requires = ["poetry-core"]

0 commit comments

Comments
 (0)