Skip to content

Commit ec1e5ed

Browse files
committed
Switch from Poetry to uv
1 parent d38a36b commit ec1e5ed

File tree

5 files changed

+662
-69
lines changed

5 files changed

+662
-69
lines changed

.github/workflows/main.yml

Lines changed: 15 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,13 @@ jobs:
1515
- name: Setup Python
1616
uses: actions/setup-python@v5
1717

18-
- name: Install Poetry
19-
run: pip install poetry
20-
21-
- name: Cache dependencies
22-
uses: actions/cache@v4
23-
env:
24-
cache-name: cache-dependencies
18+
- name: Install uv
19+
uses: astral-sh/setup-uv@v2
2520
with:
26-
path: ~/.cache/pypoetry
27-
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('pyproject.toml') }}
28-
restore-keys: |
29-
${{ runner.os }}-${{ env.cache-name }}-
30-
${{ runner.os }}-
21+
enable-cache: true
3122

3223
- name: Install dependencies
33-
run: poetry install
24+
run: uv sync
3425

3526
- name: Register problem matcher
3627
run: echo "::add-matcher::.github/workflows/matchers/ruff.json"
@@ -39,7 +30,7 @@ jobs:
3930
run: rm .gitignore
4031

4132
- name: Run ruff format
42-
run: poetry run ruff format --check googleapiclient-stubs apiclient-stubs
33+
run: uv run ruff format --check googleapiclient-stubs apiclient-stubs
4334

4435
ruff-check:
4536
runs-on: ubuntu-latest
@@ -49,28 +40,19 @@ jobs:
4940
- name: Setup Python
5041
uses: actions/setup-python@v5
5142

52-
- name: Install Poetry
53-
run: pip install poetry
54-
55-
- name: Cache dependencies
56-
uses: actions/cache@v4
57-
env:
58-
cache-name: cache-dependencies
43+
- name: Install uv
44+
uses: astral-sh/setup-uv@v2
5945
with:
60-
path: ~/.cache/pypoetry
61-
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('poetry.lock') }}
62-
restore-keys: |
63-
${{ runner.os }}-${{ env.cache-name }}-
64-
${{ runner.os }}-
46+
enable-cache: true
6547

6648
- name: Install dependencies
67-
run: poetry install
49+
run: uv sync
6850

6951
- name: Delete .gitignore (https://github.com/astral-sh/ruff/issues/8753)
7052
run: rm .gitignore
7153

7254
- name: Run ruff check
73-
run: poetry run ruff check --output-format github googleapiclient-stubs apiclient-stubs
55+
run: uv run ruff check --output-format github googleapiclient-stubs apiclient-stubs
7456

7557
mypy:
7658
runs-on: ubuntu-latest
@@ -80,26 +62,17 @@ jobs:
8062
- name: Setup Python
8163
uses: actions/setup-python@v5
8264

83-
- name: Install Poetry
84-
run: pip install poetry
85-
86-
- name: Cache dependencies
87-
uses: actions/cache@v4
88-
env:
89-
cache-name: cache-dependencies
65+
- name: Install uv
66+
uses: astral-sh/setup-uv@v2
9067
with:
91-
path: ~/.cache/pypoetry
92-
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('pyproject.toml') }}
93-
restore-keys: |
94-
${{ runner.os }}-${{ env.cache-name }}-
95-
${{ runner.os }}-
68+
enable-cache: true
9669

9770
- name: Install dependencies
98-
run: poetry install
71+
run: uv sync
9972

10073
- name: Register problem matchers
10174
run: echo "::add-matcher::.github/workflows/matchers/mypy.json"
10275

10376
- name: Run Mypy
10477
run: |
105-
poetry run mypy googleapiclient-stubs apiclient-stubs
78+
uv run mypy googleapiclient-stubs apiclient-stubs

.github/workflows/publish.yml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,14 @@ jobs:
1010
steps:
1111
- uses: actions/checkout@v4
1212

13-
- name: Set up Python
14-
uses: actions/setup-python@v5
13+
# - name: Set up Python
14+
# uses: actions/setup-python@v5
1515

16-
- name: Install Poetry
17-
run: pip install poetry
16+
- name: Install uv
17+
uses: astral-sh/setup-uv@v2
18+
19+
- name: Build
20+
run: uv build
1821

19-
- name: Build and publish
20-
run: poetry publish --build --username __token__ --password "$PYPI_TOKEN"
21-
env:
22-
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
22+
- name: Publish
23+
run: uv publish

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@
77
!/apiclient-stubs/
88
!/apiclient-stubs/**
99
!/pyproject.toml
10+
!/uv.lock
1011
!/README.md
1112
!/LICENSE

pyproject.toml

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
1-
[tool.poetry]
1+
[project]
22
name = "google-api-python-client-stubs"
3-
version = "1.27.0"
3+
version = "1.28.0a0"
44
description = "Type stubs for google-api-python-client"
5-
authors = ["Henrik Bruådal <[email protected]>"]
5+
authors = [
6+
{ name = "Henrik Bruådal", email = "[email protected]" },
7+
]
68
readme = "README.md"
79
license = "Apache-2.0"
810
repository = "https://github.com/henribru/google-api-python-client-stubs"
9-
packages = [
10-
{ include = "googleapiclient-stubs" },
11-
{ include = "apiclient-stubs" },
12-
]
1311
classifiers = [
1412
"Typing :: Stubs Only",
1513
]
14+
dependencies = [
15+
"google-api-python-client>=2.141.0",
16+
"types-httplib2>=0.22.0.2",
17+
"typing-extensions>=3.10.0",
18+
]
19+
requires-python = ">=3.7"
1620

17-
[tool.poetry.dependencies]
18-
python = "^3.7"
19-
google-api-python-client = ">=2.141.0"
20-
typing-extensions = ">=3.10.0"
21-
types-httplib2 = ">=0.22.0.2"
22-
23-
[tool.poetry.group.dev.dependencies]
24-
mypy = {version = "^1.9.0", python = "^3.8"}
25-
stubdefaulter = "^0.1.0"
26-
ruff = "^0.3.3"
21+
[tool.uv]
22+
dev-dependencies = [
23+
"mypy>=1.11.2 ; python_full_version >= '3.8'",
24+
"ruff>=0.6.8",
25+
"stubdefaulter>=0.1.0",
26+
]
2727

2828
[tool.ruff.lint]
2929
select = ["UP", "I"]
@@ -38,6 +38,9 @@ known-first-party = [
3838
[tool.mypy]
3939
warn_unused_ignores = true
4040

41+
[tool.hatch.build.targets.wheel]
42+
packages = ["googleapiclient-stubs", "apiclient-stubs"]
43+
4144
[build-system]
42-
requires = ["poetry>=0.12"]
43-
build-backend = "poetry.masonry.api"
45+
requires = ["hatchling"]
46+
build-backend = "hatchling.build"

0 commit comments

Comments
 (0)