Skip to content

Commit 6d9557b

Browse files
committed
chore: configure uv
1 parent 5171e63 commit 6d9557b

5 files changed

Lines changed: 654 additions & 7 deletions

File tree

.github/workflows/release.yml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,25 @@ jobs:
2020
runs-on: ubuntu-latest
2121
container:
2222
image: python:3.12-bookworm
23+
env:
24+
UV_LINK_MODE: copy
25+
UV_CACHE_DIR: /github/home/.cache/uv
2326
permissions:
27+
actions: write
2428
contents: write
2529

2630
steps:
2731
- name: Checkout code
2832
uses: actions/checkout@v4
2933

34+
- name: Cache uv downloads/builds
35+
uses: actions/cache@v5
36+
with:
37+
path: /github/home/.cache/uv
38+
key: uvcache-${{ runner.os }}-${{ hashFiles('uv.lock', 'pyproject.toml') }}
39+
restore-keys: |
40+
uvcache-${{ runner.os }}-
41+
3042
- name: Extract version from tag
3143
id: version
3244
run: |
@@ -46,11 +58,15 @@ jobs:
4658
- name: Install system dependencies
4759
run: |
4860
apt-get update
61+
# Ensure /etc/os-release exists (required by some actions' OS detection).
62+
apt-get install -y base-files
4963
apt-get install -y build-essential pkg-config libbz2-dev
5064
apt-get install -y -t sid libmapnik-dev
5165
5266
- name: Install uv
53-
uses: astral-sh/setup-uv@v4
67+
uses: astral-sh/setup-uv@v7
68+
with:
69+
enable-cache: false
5470

5571
- name: Build wheel and sdist
5672
run: |

.github/workflows/test.yml

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,26 @@ jobs:
1313
runs-on: ubuntu-latest
1414
container:
1515
image: python:3.12-bookworm
16+
env:
17+
UV_LINK_MODE: copy
18+
UV_CACHE_DIR: /github/home/.cache/uv
1619
permissions:
20+
actions: write
1721
contents: read
1822
checks: write
1923

2024
steps:
2125
- name: Checkout code
2226
uses: actions/checkout@v4
2327

28+
- name: Cache uv downloads/builds
29+
uses: actions/cache@v5
30+
with:
31+
path: /github/home/.cache/uv
32+
key: uvcache-${{ runner.os }}-${{ hashFiles('uv.lock', 'pyproject.toml') }}
33+
restore-keys: |
34+
uvcache-${{ runner.os }}-
35+
2436
- name: Add Debian sid repository
2537
run: |
2638
echo "deb http://deb.debian.org/debian sid main" >> /etc/apt/sources.list.d/sid.list
@@ -29,18 +41,26 @@ jobs:
2941
- name: Install system dependencies
3042
run: |
3143
apt-get update
44+
# Ensure /etc/os-release exists (required by some actions' OS detection).
45+
apt-get install -y base-files
3246
apt-get install -y build-essential pkg-config libbz2-dev
3347
apt-get install -y -t sid libmapnik-dev fonts-noto-cjk
3448
3549
- name: Install uv
36-
uses: astral-sh/setup-uv@v4
50+
uses: astral-sh/setup-uv@v7
3751
with:
38-
enable-cache: true
39-
cache-dependency-glob: "uv.lock"
52+
# Work around container-job failures determining Linux distribution during
53+
# setup-uv's built-in caching path; we cache UV_CACHE_DIR ourselves above.
54+
enable-cache: false
4055

4156
- name: Install Python dependencies and build package
4257
run: |
43-
uv sync --frozen --verbose || uv sync --verbose
58+
# Use lockfile when present; avoid doing two full syncs (which can rebuild twice).
59+
if [ -f uv.lock ]; then
60+
uv sync --extra test --frozen --verbose
61+
else
62+
uv sync --extra test --verbose
63+
fi
4464
4565
- name: Run tests with coverage
4666
run: |

pyproject.toml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ maintainers = [
2424

2525
requires-python = ">= 3.8"
2626

27+
[project.optional-dependencies]
28+
test = [
29+
"pytest >= 8.0",
30+
"pytest-cov >= 5.0",
31+
]
32+
2733
[project.urls]
2834
Homepage = "https://mapnik.org"
2935
Documentation = "https://github.com/mapnik/python-mapnik/wiki"
@@ -35,4 +41,8 @@ Changelog = "https://github.com/mapnik/python-mapnik/blob/master/CHANGELOG.md"
3541
minversion = "8.0"
3642
testpaths = [
3743
"test/python_tests",
38-
]
44+
]
45+
46+
[tool.uv]
47+
# Pin uv version for CI/dev consistency (used by astral-sh/setup-uv).
48+
required-version = "==0.9.25"

src/mapnik_map.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ void export_map(py::module const& m)
295295
"<mapnik._mapnik.Featureset object at 0x23b0b0>\n"
296296
">>> featureset.features\n"
297297
">>> [<mapnik.Feature object at 0x3995630>]\n",
298-
py::arg("layer idx"), py::arg("x"), py::arg("y")
298+
py::arg("layer_idx"), py::arg("x"), py::arg("y")
299299
)
300300

301301
.def("remove_all", &Map::remove_all,

0 commit comments

Comments
 (0)