Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch from Poetry to uv #47

Merged
merged 1 commit into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 15 additions & 42 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,13 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v5

- name: Install Poetry
run: pip install poetry

- name: Cache dependencies
uses: actions/cache@v4
env:
cache-name: cache-dependencies
- name: Install uv
uses: astral-sh/setup-uv@v2
with:
path: ~/.cache/pypoetry
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('pyproject.toml') }}
restore-keys: |
${{ runner.os }}-${{ env.cache-name }}-
${{ runner.os }}-
enable-cache: true

- name: Install dependencies
run: poetry install
run: uv sync

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

- name: Run ruff format
run: poetry run ruff format --check google-stubs
run: uv run ruff format --check google-stubs

ruff-check:
runs-on: ubuntu-latest
Expand All @@ -49,28 +40,19 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v5

- name: Install Poetry
run: pip install poetry

- name: Cache dependencies
uses: actions/cache@v4
env:
cache-name: cache-dependencies
- name: Install uv
uses: astral-sh/setup-uv@v2
with:
path: ~/.cache/pypoetry
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('pyproject.toml') }}
restore-keys: |
${{ runner.os }}-${{ env.cache-name }}-
${{ runner.os }}-
enable-cache: true

- name: Install dependencies
run: poetry install
run: uv sync

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

- name: Run ruff check
run: poetry run ruff check --output-format github google-stubs
run: uv run ruff check --output-format github google-stubs

mypy:
runs-on: ubuntu-latest
Expand All @@ -80,26 +62,17 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v5

- name: Install Poetry
run: pip install poetry

- name: Cache dependencies
uses: actions/cache@v4
env:
cache-name: cache-dependencies
- name: Install uv
uses: astral-sh/setup-uv@v2
with:
path: ~/.cache/pypoetry
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('poetry.lock') }}
restore-keys: |
${{ runner.os }}-${{ env.cache-name }}-
${{ runner.os }}-
enable-cache: true

- name: Install dependencies
run: poetry install
run: uv sync

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

- name: Run Mypy
run: |
poetry run mypy --namespace-packages --explicit-package-bases google-stubs
mv google-stubs google && uv run mypy --namespace-packages --explicit-package-bases google
20 changes: 10 additions & 10 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ on:
jobs:
publish:
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
- name: Install uv
uses: astral-sh/setup-uv@v2

- name: Build
run: uv build

- name: Install Poetry
run: pip install poetry

- name: Build and publish
run: poetry publish --build --username __token__ --password "$PYPI_TOKEN"
env:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
- name: Publish
run: uv publish
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
!/google-stubs/{__init__.pyi, py.typed}
!/google-stubs/ads/**
!/pyproject.toml
!/uv.lock
!/README.md
!/LICENSE
__pycache__
46 changes: 25 additions & 21 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,32 +1,33 @@
[tool.poetry]
[project]
name = "google-ads-stubs"
version = "19.0.0"
license = "Apache-2.0"
description = "Type stubs for google-ads"
authors = ["Henrik Bruåsdal <[email protected]>"]
authors = [
{ name = "Henrik Bruåsdal", email = "[email protected]" },
]
readme = "README.md"
repository = "https://github.com/henribru/google-ads-stubs"
packages = [
{ include = "google-stubs" },
]
classifiers = [
"Typing :: Stubs Only",
]
dependencies = [
"google-ads>=25.0.0",
"google-auth-stubs>=0.1.0",
"googleapis-common-protos-stubs>=2.0.0",
"grpc-stubs>=1.24.7",
"proto-plus-stubs>=0.5.0",
"types-protobuf>=3.18.0",
"typing-extensions>=3.10.0",
]
requires-python = ">=3.8"

[tool.poetry.dependencies]
python = ">=3.8,<3.13"
typing-extensions = ">=3.10.0"
googleapis-common-protos-stubs = ">=2.0.0"
google-ads = ">=25.0.0"
grpc-stubs = ">=1.24.7"
types-protobuf = ">=3.18.0"
proto-plus-stubs = ">=0.5.0"
google-auth-stubs = ">=0.1.0"

[tool.poetry.group.dev.dependencies]
mypy = "^1.9.0"
stubdefaulter = "^0.1.0"
ruff = "^0.3.3"
[tool.uv]
dev-dependencies = [
"mypy>=1.9.0",
"ruff>=0.3.3",
"stubdefaulter>=0.1.0",
]

[tool.ruff.lint]
select = ["UP", "I"]
Expand All @@ -35,6 +36,9 @@ select = ["UP", "I"]
combine-as-imports = true
known-first-party = ["google.ads.googleads"]

[tool.hatch.build.targets.wheel]
packages = ["google-stubs"]

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
requires = ["hatchling"]
build-backend = "hatchling.build"
Loading
Loading