Skip to content

Commit 65f2c2d

Browse files
committed
chore: switch from poetry to uv
1 parent 22d240c commit 65f2c2d

10 files changed

Lines changed: 1418 additions & 1633 deletions

File tree

‎.github/workflows/ci.yaml‎

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,21 +34,19 @@ jobs:
3434
- uses: extractions/setup-just@v1
3535
with:
3636
just-version: ${{ env.JUST_TOOL_VERSION }}
37-
- name: Install and configure Poetry
38-
uses: snok/install-poetry@v1
37+
- name: Install uv
38+
uses: astral-sh/setup-uv@v6
3939
with:
40-
version: ${{ env.POETRY_TOOL_VERSION }}
41-
virtualenvs-in-project: true
40+
version: ${{ env.UV_TOOL_VERSION }}
41+
activate-environment: true
42+
enable-cache: true
4243

43-
- name: Set up Python ${{ matrix.python-version }}
44-
uses: actions/setup-python@v5
45-
with:
46-
python-version: ${{ matrix.python-version }}
47-
cache: poetry
44+
- name: Install Python
45+
run: uv python install ${{ matrix.python-version }}
4846

4947
- name: Install dependencies
5048
shell: bash
51-
run: poetry install
49+
run: uv sync
5250

5351
- name: Pytest run
5452
run: just test -v

‎.github/workflows/release.yaml‎

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,18 @@ jobs:
1212
- uses: extractions/setup-just@v1
1313
with:
1414
just-version: ${{ env.JUST_TOOL_VERSION }}
15-
- name: Install and configure Poetry
16-
uses: snok/install-poetry@v1
15+
- name: Install uv
16+
uses: astral-sh/setup-uv@v6
1717
with:
18-
version: ${{ env.POETRY_TOOL_VERSION }}
19-
virtualenvs-in-project: true
18+
version: ${{ env.UV_TOOL_VERSION }}
19+
activate-environment: true
20+
enable-cache: true
2021

21-
- name: Set up Python ${{ env.PYTHON_TOOL_VERSION }}
22-
uses: actions/setup-python@v5
23-
with:
24-
python-version: ${{ env.PYTHON_TOOL_VERSION }}
25-
cache: poetry
22+
- name: Install Python
23+
run: uv python install ${{ env.PYTHON_TOOL_VERSION }}
2624

2725
- name: Build a binary wheel and a source tarball
28-
run: poetry build
26+
run: uv build
2927

3028
- name: Store the distribution packages
3129
uses: actions/upload-artifact@v4

‎.pre-commit-config.yaml‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
repos:
22
- repo: https://github.com/astral-sh/ruff-pre-commit
33
# Ruff version.
4-
rev: v0.6.3
4+
rev: v0.13.1
55
hooks:
66
# Run the linter.
77
- id: ruff
@@ -16,3 +16,11 @@ repos:
1616
- id: end-of-file-fixer
1717
exclude: ^tests/.*/fixtures/.*
1818
- id: debug-statements
19+
20+
# A hack to get dependabot to find security vulnerabilities in our dependencies
21+
- repo: https://github.com/astral-sh/uv-pre-commit
22+
rev: 0.8.19
23+
hooks:
24+
- id: uv-export
25+
files: ^(uv\.lock|pyproject\.toml|uv\.toml)$
26+
args: ["--frozen", "--no-emit-project", "--no-hashes", "--output-file=requirements.txt", "--quiet"]

‎.tool-versions‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
just 1.40.0
2-
poetry 2.1.3
32
python 3.12.10
3+
uv 0.8.14

‎justfile‎

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,28 @@ default:
22
@just --list
33

44
install:
5-
poetry install
6-
poetry run pre-commit install
5+
uv sync
6+
uv run pre-commit install
77

88
lint:
9-
poetry run ruff check
10-
poetry run ruff format --check
11-
poetry run deptry .
9+
uv run ruff check
10+
uv run ruff format --check
11+
uv run deptry .
1212

1313
format:
14-
poetry run ruff format
15-
poetry run ruff check --fix
14+
uv run ruff format
15+
uv run ruff check --fix
1616

1717
test *flags:
18-
poetry run pytest --cov=stacklet tests {{ flags }}
18+
uv run pytest --cov=stacklet tests {{ flags }}
1919

2020
compile: install
21-
poetry run python -m nuitka stacklet/client/platform/cli.py -o stacklet-admin --standalone --onefile --assume-yes-for-downloads --include-package-data=* --remove-output --static-libpython=no
21+
uv run python -m nuitka stacklet/client/platform/cli.py -o stacklet-admin --standalone --onefile --assume-yes-for-downloads --include-package-data=* --remove-output --static-libpython=no
2222
chmod +x stacklet-admin
2323
export PATH=$PWD/:$PATH
2424

2525
pkg-prep bump="--bump-patch":
26-
poetry run python scripts/upgrade.py upgrade {{bump}}
27-
poetry update
28-
poetry lock
29-
git add justfile pyproject.toml poetry.lock
26+
uv run python scripts/upgrade.py upgrade {{bump}}
27+
uv lock --upgrade
28+
git add justfile pyproject.toml uv.lock
3029
git status

‎poetry.lock‎

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

‎pyproject.toml‎

Lines changed: 44 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,57 @@
11
[build-system]
2-
requires = [ "poetry-core>=1.0.0",]
3-
build-backend = "poetry.core.masonry.api"
2+
requires = ["hatchling"]
3+
build-backend = "hatchling.build"
44

5-
[tool.poetry]
5+
[project]
66
name = "stacklet.client.platform"
77
version = "0.1.6"
88
description = "Stacklet Platform Client"
9+
authors = [{ name = "Sonny Shi", email = "sonny@stacklet.io" }]
10+
requires-python = ">=3.9,<=3.13"
911
readme = "README.md"
10-
authors = ["Sonny Shi <sonny@stacklet.io>"]
11-
maintainers = ["Stacklet <hello@stacklet.io>"]
1212
license = "Apache-2.0"
13-
include = [ "stacklet/client/platform/vendored/auth_landing_pages/ok.html", "stacklet/client/platform/vendored/auth_landing_pages/fail.html",]
14-
[[tool.poetry.packages]]
15-
include = "stacklet"
13+
maintainers = [{ name = "Stacklet", email = "hello@stacklet.io" }]
14+
dependencies = [
15+
"click>=8.0.1,<9",
16+
"requests>=2.32.4,<3",
17+
"jsonschema>=4.9.0,<5",
18+
"PyYAML~=6.0",
19+
"PyJWT>=2.4.0,<3",
20+
"boto3>=1.39.16,<2",
21+
"charset_normalizer>=3.4.2,<4",
22+
"jmespath>=1.0.1,<2",
23+
]
1624

17-
[tool.poetry.scripts]
25+
[project.scripts]
1826
stacklet-admin = "stacklet.client.platform.cli:cli"
1927

20-
[tool.poetry.dependencies]
21-
python = "^3.9"
22-
click = "^8.0.1"
23-
requests = "^2.32.4"
24-
jsonschema = "^4.9.0"
25-
PyYAML = "^6.0"
26-
PyJWT = "^2.4.0"
27-
boto3 = "^1.39.16"
28-
charset_normalizer = "^3.4.2"
29-
jmespath = "^1.0.1"
30-
31-
[tool.poetry.group.dev.dependencies]
32-
ruff = "^0.12.7"
33-
moto = { version = "^5.1.9", extras = ["cognitoidp"] }
34-
pytest = "^8.4"
35-
pytest-cov = "^6.2.1"
36-
requests-mock = "^1.8.0"
37-
pre-commit = "^2.12.0"
38-
Nuitka = "^2.7.12"
39-
semver = "^2.13.0"
40-
toml = "^0.10.2"
41-
deptry = "^0.23.1"
28+
[dependency-groups]
29+
dev = [
30+
"ruff>=0.12.7,<0.13",
31+
"moto[cognitoidp]>=5.1.9,<6",
32+
"pytest~=8.4",
33+
"pytest-cov>=6.2.1,<7",
34+
"requests-mock>=1.8.0,<2",
35+
"pre-commit>=2.12.0,<3",
36+
"Nuitka>=2.7.12,<3",
37+
"semver>=2.13.0,<3",
38+
"toml>=0.10.2,<0.11",
39+
"deptry>=0.23.1,<0.24",
40+
]
41+
42+
[tool.hatch.build.targets.sdist]
43+
include = [
44+
"stacklet",
45+
"stacklet/client/platform/vendored/auth_landing_pages/ok.html",
46+
"stacklet/client/platform/vendored/auth_landing_pages/fail.html",
47+
]
48+
49+
[tool.hatch.build.targets.wheel]
50+
include = [
51+
"stacklet",
52+
"stacklet/client/platform/vendored/auth_landing_pages/ok.html",
53+
"stacklet/client/platform/vendored/auth_landing_pages/fail.html",
54+
]
4255

4356
[tool.ruff]
4457
line-length = 100

‎requirements.txt‎

Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
# This file was autogenerated by uv via the following command:
2+
# uv export --frozen --no-emit-project --no-hashes --output-file=requirements.txt
3+
attrs==24.2.0
4+
# via
5+
# jsonschema
6+
# referencing
7+
boto3==1.39.16
8+
# via
9+
# moto
10+
# stacklet-client-platform
11+
botocore==1.39.16
12+
# via
13+
# boto3
14+
# moto
15+
# s3transfer
16+
certifi==2024.8.30
17+
# via requests
18+
cffi==1.17.1
19+
# via
20+
# cryptography
21+
# zstandard
22+
cfgv==3.4.0
23+
# via pre-commit
24+
charset-normalizer==3.4.2
25+
# via
26+
# requests
27+
# stacklet-client-platform
28+
click==8.1.7
29+
# via
30+
# deptry
31+
# stacklet-client-platform
32+
colorama==0.4.6 ; sys_platform == 'win32'
33+
# via
34+
# click
35+
# deptry
36+
# pytest
37+
coverage==7.6.1
38+
# via pytest-cov
39+
cryptography==45.0.5
40+
# via
41+
# joserfc
42+
# moto
43+
deptry==0.23.1
44+
distlib==0.3.8
45+
# via virtualenv
46+
exceptiongroup==1.3.0 ; python_full_version < '3.11'
47+
# via pytest
48+
filelock==3.15.4
49+
# via virtualenv
50+
identify==2.6.0
51+
# via pre-commit
52+
idna==3.8
53+
# via requests
54+
iniconfig==2.0.0
55+
# via pytest
56+
jinja2==3.1.6
57+
# via moto
58+
jmespath==1.0.1
59+
# via
60+
# boto3
61+
# botocore
62+
# stacklet-client-platform
63+
joserfc==1.2.2
64+
# via moto
65+
jsonschema==4.23.0
66+
# via stacklet-client-platform
67+
jsonschema-specifications==2023.12.1
68+
# via jsonschema
69+
markupsafe==2.1.5
70+
# via
71+
# jinja2
72+
# werkzeug
73+
moto==5.1.9
74+
nodeenv==1.9.1
75+
# via pre-commit
76+
nuitka==2.7.12
77+
ordered-set==4.1.0
78+
# via nuitka
79+
packaging==24.1
80+
# via
81+
# deptry
82+
# pytest
83+
# requirements-parser
84+
platformdirs==4.2.2
85+
# via virtualenv
86+
pluggy==1.5.0
87+
# via
88+
# pytest
89+
# pytest-cov
90+
pre-commit==2.21.0
91+
pycparser==2.22
92+
# via cffi
93+
pygments==2.19.2
94+
# via pytest
95+
pyjwt==2.9.0
96+
# via stacklet-client-platform
97+
pytest==8.4.1
98+
# via pytest-cov
99+
pytest-cov==6.2.1
100+
python-dateutil==2.9.0.post0
101+
# via
102+
# botocore
103+
# moto
104+
pyyaml==6.0.2
105+
# via
106+
# pre-commit
107+
# responses
108+
# stacklet-client-platform
109+
referencing==0.35.1
110+
# via
111+
# jsonschema
112+
# jsonschema-specifications
113+
requests==2.32.4
114+
# via
115+
# moto
116+
# requests-mock
117+
# responses
118+
# stacklet-client-platform
119+
requests-mock==1.12.1
120+
requirements-parser==0.13.0
121+
# via deptry
122+
responses==0.25.3
123+
# via moto
124+
rpds-py==0.20.0
125+
# via
126+
# jsonschema
127+
# referencing
128+
ruff==0.12.7
129+
s3transfer==0.13.1
130+
# via boto3
131+
semver==2.13.0
132+
six==1.16.0
133+
# via python-dateutil
134+
toml==0.10.2
135+
tomli==2.2.1 ; python_full_version <= '3.11'
136+
# via
137+
# coverage
138+
# deptry
139+
# pytest
140+
typing-extensions==4.15.0 ; python_full_version < '3.11'
141+
# via exceptiongroup
142+
urllib3==1.26.20 ; python_full_version < '3.10'
143+
# via
144+
# botocore
145+
# requests
146+
# responses
147+
urllib3==2.5.0 ; python_full_version >= '3.10'
148+
# via
149+
# botocore
150+
# requests
151+
# responses
152+
virtualenv==20.32.0
153+
# via pre-commit
154+
werkzeug==3.1.3
155+
# via moto
156+
xmltodict==0.13.0
157+
# via moto
158+
zstandard==0.15.2
159+
# via nuitka

‎scripts/upgrade.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def upgrade(bump_patch, bump_minor, bump_major):
2929
with open("pyproject.toml") as f:
3030
pyproject = toml.load(f)
3131

32-
current = pyproject["tool"]["poetry"]["version"]
32+
current = pyproject["project"]["version"]
3333
current_parsed = semver.VersionInfo.parse(current)
3434

3535
major = current_parsed.major
@@ -45,7 +45,7 @@ def upgrade(bump_patch, bump_minor, bump_major):
4545

4646
upgraded = ".".join([str(x) for x in (major, minor, patch)])
4747
click.echo(f"stacklet-admin: {current_parsed} -> {upgraded}")
48-
pyproject["tool"]["poetry"]["version"] = upgraded
48+
pyproject["project"]["version"] = upgraded
4949

5050
with open("pyproject.toml", "w+") as f:
5151
toml.dump(pyproject, f)

0 commit comments

Comments
 (0)