Skip to content

Commit c6f5a99

Browse files
authored
poetry -> uv (#24)
1 parent 32bd89f commit c6f5a99

16 files changed

Lines changed: 674 additions & 100 deletions

.envrc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
set -eo pipefail
44
shopt -s inherit_errexit
55

6-
watch_file venv/bin/activate
6+
watch_file .venv/bin/activate
77

8-
if [[ -f "venv/bin/activate" ]]; then
9-
source venv/bin/activate
8+
if [[ -f ".venv/bin/activate" ]]; then
9+
source .venv/bin/activate
1010
fi

.github/workflows/publish.yml

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,26 @@
1-
name: Publish
1+
name: "Publish"
2+
23
on:
3-
release:
4-
types: [published]
4+
push:
5+
tags:
6+
- v*
7+
58
jobs:
6-
publish:
9+
run:
710
runs-on: ubuntu-latest
11+
environment:
12+
name: pypi
13+
permissions:
14+
id-token: write
15+
contents: read
816
steps:
9-
- uses: actions/checkout@v4
10-
- uses: actions/setup-python@v5
11-
with:
12-
python-version: '3.12'
13-
architecture: x64
14-
- run: make build
15-
- run: venv-tools/bin/twine upload dist/*
16-
env:
17-
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
17+
- name: Checkout
18+
uses: actions/checkout@v6
19+
- name: Install uv
20+
uses: astral-sh/setup-uv@v7
21+
- name: Install Python 3.13
22+
run: uv python install 3.13
23+
- name: Build
24+
run: uv build
25+
- name: Publish
26+
run: uv publish

.github/workflows/tests.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,19 @@ jobs:
1616
]
1717
include:
1818
- python-version: '3.9'
19-
post-venv: 'venv/bin/pip install "urllib3<2" "requests<=2.30" "types-requests<=2.30"'
19+
post-venv: '.venv/bin/pip install "urllib3<2" "requests<=2.30" "types-requests<=2.30"'
2020
name: Python ${{ matrix.python-version }} ${{ matrix.post-venv }}
2121
steps:
2222
- uses: actions/checkout@v4
2323
- uses: actions/setup-python@v5
2424
with:
2525
python-version: ${{ matrix.python-version }}
2626
architecture: x64
27+
- name: Install uv
28+
uses: astral-sh/setup-uv@v7
2729
- run: make venv
2830
- if: ${{ matrix.post-venv }}
2931
run: ${{ matrix.post-venv }}
3032
- run: make test
31-
- run: make lint
33+
- run: make check
34+
- run: make format-check

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/venv-tools
2-
/venv
1+
/.venv
32
__pycache__/
43
/dist

Makefile

Lines changed: 17 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,31 @@
1-
venv: pyproject.toml poetry.lock venv-tools
2-
rm -rf venv
3-
python3 -m venv venv
4-
VIRTUAL_ENV=venv venv-tools/bin/poetry install
1+
DEFAULT_GOAL := ci
52

6-
venv-tools: requirements.tools.txt
7-
rm -rf venv-tools
8-
python3 -m venv venv-tools
9-
venv-tools/bin/pip install -r requirements.tools.txt
3+
.PHONY: ci
4+
ci: check format-check test
5+
6+
.PHONY: venv
7+
venv:
8+
uv sync
109

1110
.PHONY: clean
1211
clean:
13-
rm -rf venv
14-
rm -rf venv-tools
12+
rm -rf .venv
1513
rm -rf dist
1614

1715
.PHONY: test
1816
test: venv
19-
venv/bin/pytest -vv
20-
21-
.PHONY: build
22-
build: venv-tools
23-
rm -rf dist
24-
venv-tools/bin/poetry build
17+
uv run pytest
2518

2619
.PHONY: format
2720
format: venv-tools
28-
venv-tools/bin/ruff check --fix --unsafe-fixes
29-
venv-tools/bin/ruff format
21+
uv run ruff check --fix --unsafe-fixes
22+
uv run ruff format
3023

3124
.PHONY: format-check
32-
format-check: venv-tools
33-
venv-tools/bin/ruff check
34-
venv-tools/bin/ruff format --check
35-
36-
.PHONY: lint
37-
lint: mypy format-check
25+
format-check:
26+
uv run ruff check
27+
uv run ruff format --check
3828

39-
.PHONY: mypy
40-
mypy: venv
41-
venv/bin/mypy flareio tests
29+
.PHONY: check
30+
check: venv
31+
uv run mypy src/flareio tests

poetry.toml

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

pyproject.toml

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1-
[tool.poetry]
1+
[project]
22
name = "flareio"
33
version = "1.2.0"
44
description = "Python SDK for the flare.io API."
5-
authors = ["Alexandre Viau <alexandre.viau@flare.io>"]
5+
authors = [
6+
{ name = "Alexandre Viau", email="alexandre.viau@flare.io>" }
7+
]
68
readme = "README.md"
79
repository = "https://github.com/Flared/python-flareio"
810
license = "MIT"
11+
requires-python = ">=3.9"
912
keywords = [
1013
"flare",
1114
"sdk",
@@ -24,19 +27,23 @@ packages = [
2427
{ include = "flareio" },
2528
]
2629

27-
[tool.poetry.dependencies]
30+
[dependencies]
2831
python = ">=3.8"
2932
requests = ">=2"
3033

3134
[build-system]
32-
requires = ["poetry-core"]
33-
build-backend = "poetry.core.masonry.api"
35+
requires = ["uv_build>=0.9.28,<0.10.0"]
36+
build-backend = "uv_build"
3437

35-
[tool.poetry.group.dev.dependencies]
36-
pytest = "8.3.2"
37-
mypy = "^1.11.1"
38-
requests-mock = "^1.12.1"
39-
types-requests = "^2.32.0.20240712"
38+
[dependency-groups]
39+
dev = [
40+
"pytest>=8.3.2",
41+
"mypy>=1.11.1",
42+
"ruff>=0.15.0",
43+
"requests-mock>=1.12.1",
44+
"types-requests>=2.32.0.20240712",
45+
"pip>=26",
46+
]
4047

4148
[tool.ruff.lint]
4249
extend-select = [

requirements.tools.txt

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

0 commit comments

Comments
 (0)