Skip to content

Commit 06121e8

Browse files
Update charmcraft.yaml
1 parent dcec21e commit 06121e8

File tree

1 file changed

+7
-39
lines changed

1 file changed

+7
-39
lines changed

charmcraft.yaml

Lines changed: 7 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -14,48 +14,18 @@ platforms:
1414
# (https://github.com/canonical/charmcraft/blob/9ff19c328e23b50cc06f04e8a5ad4835740badf4/charmcraft/services/package.py#L290-L293
1515
# https://github.com/canonical/charmcraft/blob/9ff19c328e23b50cc06f04e8a5ad4835740badf4/charmcraft/services/package.py#L156-L157)
1616
parts:
17-
# "poetry-deps" part name is a magic constant
18-
# https://github.com/canonical/craft-parts/pull/901
19-
poetry-deps:
20-
plugin: nil
21-
build-packages:
22-
- curl
23-
override-build: |
24-
# Use environment variable instead of `--break-system-packages` to avoid failing on older
25-
# versions of pip that do not recognize `--break-system-packages`
26-
# `--user` needed (in addition to `--break-system-packages`) for Ubuntu >=24.04
27-
PIP_BREAK_SYSTEM_PACKAGES=true python3 -m pip install --user --upgrade pip==24.3.1 # renovate: charmcraft-pip-latest
28-
29-
# Use uv to install poetry so that a newer version of Python can be installed if needed by poetry
30-
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/astral-sh/uv/releases/download/0.5.15/uv-installer.sh | sh # renovate: charmcraft-uv-latest
31-
# poetry 2.0.0 requires Python >=3.9
32-
if ! "$HOME/.local/bin/uv" python find '>=3.9'
33-
then
34-
# Use first Python version that is >=3.9 and available in an Ubuntu LTS
35-
# (to reduce the number of Python versions we use)
36-
"$HOME/.local/bin/uv" python install 3.10.12 # renovate: charmcraft-python-ubuntu-22.04
37-
fi
38-
"$HOME/.local/bin/uv" tool install --no-python-downloads --python '>=3.9' poetry==2.0.0 --with poetry-plugin-export==1.8.0 # renovate: charmcraft-poetry-latest
39-
40-
ln -sf "$HOME/.local/bin/poetry" /usr/local/bin/poetry
41-
# "charm-poetry" part name is arbitrary; use for consistency
42-
# Avoid using "charm" part name since that has special meaning to charmcraft
43-
charm-poetry:
44-
# By default, the `poetry` plugin creates/stages these directories:
45-
# - lib, src
46-
# (https://github.com/canonical/charmcraft/blob/9ff19c328e23b50cc06f04e8a5ad4835740badf4/charmcraft/parts/plugins/_poetry.py#L76-L78)
47-
# - venv
48-
# (https://github.com/canonical/charmcraft/blob/9ff19c328e23b50cc06f04e8a5ad4835740badf4/charmcraft/parts/plugins/_poetry.py#L95
49-
# https://github.com/canonical/craft-parts/blob/afb0d652eb330b6aaad4f40fbd6e5357d358de47/craft_parts/plugins/base.py#L270)
50-
plugin: poetry
17+
charm-uv:
18+
plugin: uv
5119
source: .
52-
after:
53-
- poetry-deps
54-
poetry-export-extra-args: ['--only', 'main,charm-libs']
20+
build-snaps:
21+
- astral-uv
5522
build-packages:
5623
- libffi-dev # Needed to build Python dependencies with Rust from source
5724
- libssl-dev # Needed to build Python dependencies with Rust from source
5825
- pkg-config # Needed to build Python dependencies with Rust from source
26+
uv-groups:
27+
- charm
28+
- libs
5929
override-build: |
6030
# Workaround for https://github.com/canonical/charmcraft/issues/2068
6131
# rustup used to install rustc and cargo, which are needed to build Python dependencies with Rust from source
@@ -77,8 +47,6 @@ parts:
7747
rustup default 1.83.0 # renovate: charmcraft-rust-latest
7848
7949
craftctl default
80-
# Include requirements.txt in *.charm artifact for easier debugging
81-
cp requirements.txt "$CRAFT_PART_INSTALL/requirements.txt"
8250
# "files" part name is arbitrary; use for consistency
8351
files:
8452
plugin: dump

0 commit comments

Comments
 (0)