Skip to content

Commit b089ca3

Browse files
authored
chore: Migrate from pip/setuptools to uv package manager (#219)
Migrate to uv for Python package management with exclude-newer = 1 week to prevent supply chain attacks.
1 parent 977b3e2 commit b089ca3

11 files changed

Lines changed: 674 additions & 114 deletions

File tree

.github/workflows/lint.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,15 @@ jobs:
1414
runs-on: ubuntu-latest
1515
steps:
1616
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
17+
- name: Install uv
18+
uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8
19+
with:
20+
version: "0.11.2"
1721
- name: Set up Python
1822
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
1923
with:
2024
python-version: "3.13"
2125
- name: Install dependencies
22-
run: |
23-
pip install --upgrade pip
24-
pip install -r requirements.txt
26+
run: uv sync --frozen
2527
- name: Check formatting
2628
run: make fmt-check

.github/workflows/publish.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ jobs:
1717
steps:
1818
- name: Checkout
1919
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
20+
- name: Install uv
21+
uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8
22+
with:
23+
version: "0.11.2"
2024
- name: Set up Python
2125
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
2226
with:
2327
python-version: "3.13"
24-
- name: Install dependencies
25-
run: |
26-
pip install -r requirements.txt
27-
pip install build
2828
- name: Build package
29-
run: python -m build
29+
run: uv build
3030
- name: Publish package distributions to PyPI
3131
uses: pypa/gh-action-pypi-publish@release/v1

.github/workflows/regen.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,16 @@ jobs:
1919
permission-pull-requests: write
2020
- name: Checkout
2121
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
22+
- name: Install uv
23+
uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8
24+
with:
25+
version: "0.11.2"
2226
- name: Set up Python
2327
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
2428
with:
2529
python-version: '3.13'
2630
- name: Install dependencies
27-
run: |
28-
pip install --upgrade pip
29-
pip install -r requirements.txt
31+
run: uv sync --frozen
3032
- name: Generate code
3133
run: |
3234
make clone-proto

.github/workflows/unittest.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,15 @@ jobs:
1616
steps:
1717
- name: Checkout
1818
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
19+
- name: Install uv
20+
uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8
21+
with:
22+
version: "0.11.2"
1923
- name: Set up Python
2024
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
2125
with:
2226
python-version: "3.13"
2327
- name: Install dependencies
24-
run: |
25-
pip install --upgrade pip
26-
pip install -r requirements.txt
28+
run: uv sync --frozen
2729
- name: Run tests
2830
run: make test

Makefile

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

44
fmt:
5-
black . --exclude=cloudquery
5+
uv run black . --extend-exclude=cloudquery
66

77
fmt-check:
8-
black --check . --exclude=cloudquery
8+
uv run black --check . --extend-exclude=cloudquery
99

1010
clone-proto:
1111
git clone https://github.com/cloudquery/plugin-pb
@@ -15,8 +15,8 @@ gen-proto:
1515

1616
mkdir -p ./protos/cloudquery/plugin_v3
1717
cp ./plugin-pb/plugin/v3/*.proto ./protos/cloudquery/plugin_v3/.
18-
python -m grpc_tools.protoc -I./protos --python_out=. --pyi_out=. --grpc_python_out=. ./protos/cloudquery/plugin_v3/*.proto
18+
uv run python -m grpc_tools.protoc -I./protos --python_out=. --pyi_out=. --grpc_python_out=. ./protos/cloudquery/plugin_v3/*.proto
1919

2020
mkdir -p ./protos/cloudquery/discovery_v1
2121
cp ./plugin-pb/discovery/v1/*.proto ./protos/cloudquery/discovery_v1/.
22-
python -m grpc_tools.protoc -I./protos --python_out=. --pyi_out=. --grpc_python_out=. ./protos/cloudquery/discovery_v1/*.proto
22+
uv run python -m grpc_tools.protoc -I./protos --python_out=. --pyi_out=. --grpc_python_out=. ./protos/cloudquery/discovery_v1/*.proto

README.md

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,13 @@ This is a low-level auto-generated gRPC client and server for CloudQuery plugin
66

77
### Prerequisites
88

9-
- [Python 3.7+](https://www.python.org/downloads/)
10-
11-
we recommend using virtualenv to manage your python environment.
12-
13-
```bash
14-
virtualenv -p python3.7 venv # or any python >= 3.7
15-
source venv/bin/activate
16-
```
9+
- [Python 3.9+](https://www.python.org/downloads/)
10+
- [uv](https://docs.astral.sh/uv/)
1711

1812
### Install dependencies
1913

2014
```bash
21-
pip install -r requirements.txt
15+
uv sync
2216
```
2317

2418
### Regenerate gRPC code
@@ -27,4 +21,3 @@ pip install -r requirements.txt
2721
make clone-proto # This is needed only once
2822
make gen
2923
```
30-

pyproject.toml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
[build-system]
2+
requires = ["setuptools>=75.0"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "cloudquery-plugin-pb"
7+
version = "0.0.54"
8+
description = "CloudQuery Plugin client and server library"
9+
readme = "README.md"
10+
license = "MPL-2.0"
11+
requires-python = ">=3.9"
12+
authors = [
13+
{ name = "CloudQuery LTD", email = "[email protected]" },
14+
]
15+
classifiers = [
16+
"Intended Audience :: Developers",
17+
"Programming Language :: Python",
18+
"Programming Language :: Python :: 3",
19+
"Programming Language :: Python :: 3.9",
20+
"Programming Language :: Python :: 3.10",
21+
"Programming Language :: Python :: 3.11",
22+
"Programming Language :: Python :: 3.12",
23+
"Programming Language :: Python :: 3.13",
24+
"Operating System :: OS Independent",
25+
"Topic :: Internet",
26+
]
27+
dependencies = [
28+
"grpcio>=1.56.0",
29+
"grpcio-tools>=1.56.0",
30+
"protobuf>=6.30.0",
31+
"pyarrow>=13.0.0",
32+
]
33+
34+
[project.urls]
35+
Homepage = "https://github.com/cloudquery/plugin-pb-python"
36+
37+
[dependency-groups]
38+
dev = [
39+
"black>=26.3.1; python_version >= '3.10'",
40+
"pytest>=9.0.2; python_version >= '3.10'",
41+
]
42+
43+
[tool.setuptools.packages.find]
44+
include = ["cloudquery*"]
45+
46+
[tool.setuptools.package-data]
47+
cloudquery = [
48+
"plugin_v3/py.typed",
49+
"plugin_v3/*.pyi",
50+
"discovery_v1/py.typed",
51+
"discovery_v1/*.pyi",
52+
]
53+
54+
[tool.uv]
55+
exclude-newer = "1 week"

requirements.txt

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

setup.cfg

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

setup.py

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

0 commit comments

Comments
 (0)