Skip to content

Commit 783662f

Browse files
committed
chore: Migrate from pip/setuptools to uv package manager
Switch to uv for Python package management with exclude-newer=1week to prevent supply chain attacks. Consolidate setup.py/setup.cfg into pyproject.toml, update CI workflows, Dockerfile, and Makefile.
1 parent 9940a93 commit 783662f

File tree

12 files changed

+857
-112
lines changed

12 files changed

+857
-112
lines changed

.github/workflows/lint.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ jobs:
1414
runs-on: ubuntu-latest
1515
steps:
1616
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
17+
- name: Install uv
18+
uses: astral-sh/setup-uv@0c5e2b8115b80b4c7c5ddf6ffdd634974642d182 # v5
1719
- name: Set up Python
1820
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
1921
with:
2022
python-version: "3.13"
2123
- name: Install dependencies
22-
run: |
23-
pip install --upgrade pip
24-
pip install -r requirements.txt
24+
run: uv sync
2525
- name: Check formatting
2626
run: make fmt-check

.github/workflows/publish.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,13 @@ jobs:
1717
steps:
1818
- name: Checkout
1919
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
20+
- name: Install uv
21+
uses: astral-sh/setup-uv@0c5e2b8115b80b4c7c5ddf6ffdd634974642d182 # v5
2022
- name: Set up Python
2123
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
2224
with:
2325
python-version: "3.13"
24-
- name: Install dependencies
25-
run: |
26-
pip install --upgrade pip
27-
pip install -r requirements.txt
28-
pip install build
2926
- name: Build package
30-
run: python -m build
27+
run: uv build
3128
- name: Publish package distributions to PyPI
3229
uses: pypa/gh-action-pypi-publish@release/v1

.github/workflows/unittests.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ jobs:
1818
- # Required for the package command tests to work
1919
name: Set up Docker Buildx
2020
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3
21+
- name: Install uv
22+
uses: astral-sh/setup-uv@0c5e2b8115b80b4c7c5ddf6ffdd634974642d182 # v5
2123
- name: Set up Python
2224
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
2325
with:
2426
python-version: "3.13"
2527
- name: Install dependencies
26-
run: |
27-
pip install --upgrade pip
28-
pip install -r requirements.txt
28+
run: uv sync
2929
- name: Run tests
3030
run: make test

Dockerfile

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
FROM python:3.13-slim
22

3+
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
4+
35
WORKDIR /app
46

5-
# Copy the code and install dependencies
6-
COPY requirements.txt .
7-
COPY setup.cfg .
8-
COPY setup.py .
7+
# Copy dependency files and install
8+
COPY pyproject.toml uv.lock ./
9+
RUN uv sync --frozen --no-dev --no-install-project
10+
11+
# Copy the code and install the project
912
COPY cloudquery cloudquery
1013
COPY main.py .
11-
RUN pip3 install --no-cache-dir -r requirements.txt
14+
RUN uv sync --frozen --no-dev
1215

1316
EXPOSE 7777
1417

15-
ENTRYPOINT ["python3", "main.py"]
18+
ENTRYPOINT ["uv", "run", "python3", "main.py"]
1619

17-
CMD ["serve", "--address", "[::]:7777", "--log-format", "json", "--log-level", "info"]
20+
CMD ["serve", "--address", "[::]:7777", "--log-format", "json", "--log-level", "info"]

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
test:
2-
pytest .
2+
uv run pytest .
33

44
fmt:
5-
black .
5+
uv run black .
66

77
fmt-check:
8-
black --check .
8+
uv run black --check .

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ This is the high-level package to use for developing CloudQuery plugins in Pytho
55
## Installation
66

77
```commandline
8-
pip install cloudquery-plugin-sdk
8+
uv add cloudquery-plugin-sdk
99
```
1010

1111
## Links

pyproject.toml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
[build-system]
2+
requires = ["setuptools>=75.0"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "cloudquery-plugin-sdk"
7+
version = "0.1.54"
8+
description = "CloudQuery Plugin SDK for Python"
9+
readme = "README.md"
10+
license = "MPL-2.0"
11+
requires-python = ">=3.11"
12+
authors = [
13+
{ name = "CloudQuery LTD", email = "pypi-packages@cloudquery.io" },
14+
]
15+
classifiers = [
16+
"Intended Audience :: Developers",
17+
"License :: OSI Approved :: Apache Software License",
18+
"Programming Language :: Python",
19+
"Programming Language :: Python :: 3",
20+
"Programming Language :: Python :: 3.11",
21+
"Programming Language :: Python :: 3.12",
22+
"Programming Language :: Python :: 3.13",
23+
"Operating System :: OS Independent",
24+
"Topic :: Internet",
25+
]
26+
dependencies = [
27+
"cloudquery-plugin-pb>=0.0.54",
28+
"grpcio>=1.78.0",
29+
"grpcio-tools>=1.78.0",
30+
"Jinja2>=3.1.6",
31+
"MarkupSafe>=3.0.3",
32+
"numpy>=2.4.2",
33+
"packaging>=26.0",
34+
"pandas>=3.0.0",
35+
"protobuf>=6.31.1",
36+
"pyarrow>=23.0.0",
37+
"python-dateutil>=2.8.1",
38+
"pytz>=2025.2",
39+
"six>=1.17.0",
40+
"structlog>=25.5.0",
41+
"tomli>=2.4.0",
42+
"tzdata>=2025.3",
43+
]
44+
45+
[project.urls]
46+
Homepage = "https://github.com/cloudquery/plugin-sdk-python"
47+
48+
[dependency-groups]
49+
dev = [
50+
"black>=26.3.1",
51+
"pytest>=9.0.2",
52+
]
53+
54+
[tool.setuptools.packages.find]
55+
include = ["cloudquery*"]
56+
57+
[tool.setuptools.package-data]
58+
cloudquery = ["sdk/py.typed"]
59+
60+
[tool.pytest.ini_options]
61+
python_files = "tests/*.py"
62+
63+
[tool.uv]
64+
exclude-newer = "1 week"

pytest.ini

Lines changed: 0 additions & 2 deletions
This file was deleted.

requirements.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

setup.cfg

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)