Skip to content

Commit c7cbbf2

Browse files
Use uv instead of poetry (#9)
* Use uv instead of poetry * Github action: install uv system-wide
1 parent 977ca14 commit c7cbbf2

File tree

8 files changed

+62
-82
lines changed

8 files changed

+62
-82
lines changed

.github/workflows/python-package.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ jobs:
2525
- name: Install dependencies
2626
run: |
2727
python -m pip install --upgrade pip
28-
pip install flake8
29-
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
30-
- name: Lint with flake8
28+
pip install uv ruff
29+
if [ -f requirements-dev.txt ]; then uv pip install --system -r requirements-dev.txt; fi
30+
- name: Lint with ruff
3131
run: |
3232
# stop the build if there are Python syntax errors or undefined names
33-
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
34-
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
35-
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
33+
ruff check . --select=E9,F63,F7,F82 --output-format=github
34+
# exit-zero treats all errors as warnings
35+
ruff check . --exit-zero --select=E,F,B,I --line-length=88
3636
- name: Test with unittest
3737
run: |
3838
python -m unittest discover -p '*_test.py'

Dockerfile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,9 @@ FROM python:3.12-slim
1212

1313
WORKDIR /app
1414

15-
RUN pip install poetry==1.7.1
16-
COPY pyproject.toml poetry.lock* ./
17-
RUN poetry config virtualenvs.create false
18-
RUN poetry install --no-interaction --no-ansi --no-dev
15+
RUN pip install uv
16+
COPY pyproject.toml requirements.txt ./
17+
RUN uv pip install -r requirements.txt
1918

2019
COPY structures/ ./structures/
2120
RUN find ./structures -type d \( -name tests -o -name __pycache__ \) -exec rm -rf {} +

Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1+
setup:
2+
uv pip install -r requirements-dev.txt
3+
14
struct.serve:
2-
DEV_MODE=true poetry run python -m structures.server.main
5+
DEV_MODE=true uv python -m structures.server.main
36

47
fe.serve:
58
cd structures/frontend && npm run dev

poetry.lock

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

pyproject.toml

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,27 @@
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 = "mechanics"
77
version = "0.1.0"
88
description = "Mechanics and structural analysis tools"
9-
authors = ["Angel Sola Orbaiceta <[email protected]>"]
9+
authors = [
10+
{name = "Angel Sola Orbaiceta", email = "[email protected]"}
11+
]
1012
readme = "README.md"
11-
packages = [
12-
{ include = "structures" },
13-
{ include = "geom2d" },
14-
{ include = "eqs" },
15-
{ include = "graphic" },
16-
{ include = "utils" },
17-
{ include = "apps" },
13+
requires-python = ">=3.12"
14+
dependencies = [
15+
"tornado>=6.4.2",
1816
]
1917

20-
[tool.poetry.dependencies]
21-
python = "^3.12"
22-
tornado = "^6.4.2"
18+
[project.optional-dependencies]
19+
dev = [
20+
"ruff>=0.11.4",
21+
]
2322

24-
[tool.poetry.group.dev.dependencies]
25-
ruff = "^0.11.4"
23+
[tool.hatch.build.targets.wheel]
24+
packages = ["structures", "geom2d", "eqs", "graphic", "utils", "apps"]
2625

2726
[tool.ruff]
2827
line-length = 88

pyproject.toml.bak

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
[build-system]
2+
requires = ["poetry-core>=1.0.0"]
3+
build-backend = "poetry.core.masonry.api"
4+
5+
[tool.poetry]
6+
name = "mechanics"
7+
version = "0.1.0"
8+
description = "Mechanics and structural analysis tools"
9+
authors = ["Angel Sola Orbaiceta <[email protected]>"]
10+
readme = "README.md"
11+
packages = [
12+
{ include = "structures" },
13+
{ include = "geom2d" },
14+
{ include = "eqs" },
15+
{ include = "graphic" },
16+
{ include = "utils" },
17+
{ include = "apps" },
18+
]
19+
20+
[tool.poetry.dependencies]
21+
python = "^3.12"
22+
tornado = "^6.4.2"
23+
24+
[tool.poetry.group.dev.dependencies]
25+
ruff = "^0.11.4"
26+
27+
[tool.ruff]
28+
line-length = 88
29+
target-version = "py312"
30+
select = ["E", "F", "B", "I"]
31+
ignore = []

requirements-dev.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
-r requirements.txt
2+
ruff>=0.11.4

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
tornado>=6.4.2

0 commit comments

Comments
 (0)