Skip to content

Commit 9c5a521

Browse files
author
remimd
committed
feat: ✨ Migrate to uv
1 parent bc88f21 commit 9c5a521

File tree

8 files changed

+913
-556
lines changed

8 files changed

+913
-556
lines changed

.github/actions/code-style/action.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ runs:
77
- name: Ruff
88
shell: bash
99
run: |
10-
ruff format --check
11-
ruff check
10+
uv run ruff format --check
11+
uv run ruff check
1212
1313
- name: MyPy
1414
shell: bash
15-
run: mypy ./
15+
run: uv run mypy ./

.github/actions/deploy/action.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@ runs:
1111
- name: Publish
1212
shell: bash
1313
run: |
14-
poetry version ${{ inputs.version }}
15-
poetry publish --build
14+
uvx --from=toml-cli toml set --toml-path=pyproject.toml project.version ${{ inputs.version }}
15+
uv build
16+
uv publish

.github/actions/environment/action.yml

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,11 @@ inputs:
99
runs:
1010
using: "composite"
1111
steps:
12-
- name: Install Python
13-
uses: actions/setup-python@v5
12+
- name: Install UV
13+
uses: astral-sh/setup-uv@v5
1414
with:
1515
python-version: ${{ inputs.python-version }}
16-
architecture: "x64"
1716

18-
- name: Install Poetry & Dependencies
17+
- name: Install Dependencies
1918
shell: bash
20-
run: |
21-
pip install --upgrade pip
22-
pip install poetry
23-
poetry config installer.modern-installation true
24-
poetry config virtualenvs.create false
25-
poetry check
26-
poetry install --compile --without example
19+
run: uv sync

.github/actions/tests/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ runs:
66
steps:
77
- name: Pytest
88
shell: bash
9-
run: pytest
9+
run: uv run pytest

.github/workflows/cd.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ jobs:
2121
with:
2222
version: ${{ github.event.release.tag_name }}
2323
env:
24-
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_TOKEN }}
24+
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }}

poetry.lock

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

pyproject.toml

Lines changed: 41 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,30 @@
1-
[tool.poetry]
1+
[build-system]
2+
requires = ["hatchling"]
3+
build-backend = "hatchling.build"
4+
5+
[dependency-groups]
6+
dev = [
7+
"hatch",
8+
"mypy",
9+
"ruff",
10+
]
11+
example = [
12+
"fastapi",
13+
]
14+
test = [
15+
"pytest",
16+
"pytest-asyncio",
17+
"pytest-cov",
18+
]
19+
20+
[project]
221
name = "python-cq"
322
version = "0.0.0"
423
description = "Lightweight CQRS library."
5-
license = "MIT"
6-
authors = ["remimd"]
24+
license = { text = "MIT" }
725
readme = "README.md"
8-
repository = "https://github.com/100nm/python-cq"
26+
requires-python = ">=3.12, <4"
27+
authors = [{ name = "remimd" }]
928
keywords = ["cqrs"]
1029
classifiers = [
1130
"Development Status :: 4 - Beta",
@@ -20,24 +39,13 @@ classifiers = [
2039
"Natural Language :: English",
2140
"Typing :: Typed",
2241
]
23-
packages = [{ include = "cq" }]
24-
25-
[tool.poetry.dependencies]
26-
python = ">=3.12, <4"
27-
pydantic = ">=2, <3"
28-
python-injection = "*"
29-
30-
[tool.poetry.group.dev.dependencies]
31-
mypy = "*"
32-
ruff = "*"
33-
34-
[tool.poetry.group.example.dependencies]
35-
fastapi = "*"
42+
dependencies = [
43+
"pydantic (>=2, <3)",
44+
"python-injection",
45+
]
3646

37-
[tool.poetry.group.test.dependencies]
38-
pytest = "*"
39-
pytest-asyncio = "*"
40-
pytest-cov = "*"
47+
[project.urls]
48+
Repository = "https://github.com/100nm/python-cq"
4149

4250
[tool.coverage.report]
4351
exclude_lines = [
@@ -46,6 +54,15 @@ exclude_lines = [
4654
"raise NotImplementedError",
4755
]
4856

57+
[tool.hatch.build]
58+
skip-excluded-dirs = true
59+
60+
[tool.hatch.build.targets.sdist]
61+
include = ["cq"]
62+
63+
[tool.hatch.build.targets.wheel]
64+
packages = ["cq"]
65+
4966
[tool.mypy]
5067
check_untyped_defs = true
5168
disallow_any_generics = true
@@ -70,7 +87,6 @@ asyncio_mode = "auto"
7087
testpaths = "**/tests/"
7188

7289
[tool.ruff]
73-
target-version = "py312"
7490
line-length = 88
7591
indent-width = 4
7692

@@ -84,6 +100,6 @@ line-ending = "auto"
84100
extend-select = ["F", "I", "N"]
85101
fixable = ["ALL"]
86102

87-
[build-system]
88-
requires = ["poetry-core"]
89-
build-backend = "poetry.core.masonry.api"
103+
[tool.uv]
104+
default-groups = ["dev", "test"]
105+
package = true

uv.lock

Lines changed: 860 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)