Skip to content

Commit cf99969

Browse files
Use poetry v2 (#199)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Carl Csaposs <[email protected]>
1 parent 68d1289 commit cf99969

File tree

7 files changed

+30
-25
lines changed

7 files changed

+30
-25
lines changed

.github/workflows/ci.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030

3131
unit-test:
3232
name: Unit test charm
33-
runs-on: ubuntu-latest
33+
runs-on: ubuntu-22.04 # TODO: use ubuntu-latest after fixing pathlib issue on python 3.12
3434
timeout-minutes: 5
3535
steps:
3636
- name: Checkout
@@ -66,7 +66,7 @@ jobs:
6666

6767
build:
6868
name: Build charm
69-
uses: canonical/data-platform-workflows/.github/workflows/[email protected].0
69+
uses: canonical/data-platform-workflows/.github/workflows/[email protected].6
7070
with:
7171
# Use of cache blocked by https://github.com/canonical/charmcraft/issues/1456
7272
# Details: https://github.com/canonical/charmcraftcache/issues/3

.github/workflows/release.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ jobs:
1515

1616
build:
1717
name: Build charm
18-
uses: canonical/data-platform-workflows/.github/workflows/[email protected].0
18+
uses: canonical/data-platform-workflows/.github/workflows/[email protected].6
1919

2020
release:
2121
name: Release charm
2222
needs:
2323
- ci-tests
2424
- build
25-
uses: canonical/data-platform-workflows/.github/workflows/[email protected].0
25+
uses: canonical/data-platform-workflows/.github/workflows/[email protected].6
2626
with:
2727
channel: dpe/edge
2828
artifact-prefix: ${{ needs.build.outputs.artifact-prefix }}

.github/workflows/sync_docs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010
jobs:
1111
sync-docs:
1212
name: Sync docs from Discourse
13-
uses: canonical/data-platform-workflows/.github/workflows/[email protected].0
13+
uses: canonical/data-platform-workflows/.github/workflows/[email protected].6
1414
with:
1515
reviewers: a-velasco
1616
permissions:

charmcraft.yaml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,20 @@ parts:
4545
- pkg-config
4646
override-build: |
4747
rustup default stable
48+
49+
# Use uv to install poetry so that a newer version of Python can be installed if needed by poetry
50+
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
51+
# poetry 2.0.0 requires Python >=3.9
52+
if ! "$HOME/.local/bin/uv" python find '>=3.9'
53+
then
54+
# Use first Python version that is >=3.9 and available in an Ubuntu LTS
55+
# (to reduce the number of Python versions we use)
56+
"$HOME/.local/bin/uv" python install 3.10.12 # renovate: charmcraft-python-ubuntu-22.04
57+
fi
58+
"$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
4859
4960
# Convert subset of poetry.lock to requirements.txt
50-
curl -sSL https://install.python-poetry.org | python3 -
51-
/root/.local/bin/poetry export --only main,charm-libs --output requirements.txt
61+
"$HOME/.local/bin/poetry" export --only main,charm-libs --output requirements.txt
5262
5363
craftctl default
5464
stage:

poetry.lock

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

pyproject.toml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,8 @@
22
# See LICENSE file for licensing details.
33

44
[tool.poetry]
5-
# Charm is not packed as a standard Python package; this information is not used
6-
name = "charm"
7-
version = "0.1.0"
8-
description = ""
9-
authors = []
5+
package-mode = false
6+
requires-poetry = ">=2.0.0"
107

118
[tool.poetry.dependencies]
129
python = "^3.8.6" # ^3.8.6 required by juju
@@ -55,9 +52,9 @@ pytest-mock = "^3.14.0"
5552
[tool.poetry.group.integration.dependencies]
5653
pytest = "^8.2.2"
5754
pytest-operator = "^0.35.0"
58-
pytest-operator-cache = {git = "https://github.com/canonical/data-platform-workflows", tag = "v24.0.0", subdirectory = "python/pytest_plugins/pytest_operator_cache"}
59-
pytest-operator-groups = {git = "https://github.com/canonical/data-platform-workflows", tag = "v24.0.0", subdirectory = "python/pytest_plugins/pytest_operator_groups"}
60-
pytest-github-secrets = {git = "https://github.com/canonical/data-platform-workflows", tag = "v24.0.0", subdirectory = "python/pytest_plugins/github_secrets"}
55+
pytest-operator-cache = {git = "https://github.com/canonical/data-platform-workflows", tag = "v24.0.6", subdirectory = "python/pytest_plugins/pytest_operator_cache"}
56+
pytest-operator-groups = {git = "https://github.com/canonical/data-platform-workflows", tag = "v24.0.6", subdirectory = "python/pytest_plugins/pytest_operator_groups"}
57+
pytest-github-secrets = {git = "https://github.com/canonical/data-platform-workflows", tag = "v24.0.6", subdirectory = "python/pytest_plugins/github_secrets"}
6158
juju = "^3.6.0.0"
6259
mysql-connector-python = "~8.0.33"
6360
tenacity = "^8.5.0"

tox.ini

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ description = Apply coding style standards to code
2222
commands_pre =
2323
poetry install --only format
2424
commands =
25-
poetry lock --no-update
25+
poetry lock
2626
poetry run ruff check --fix {[vars]all_path}
2727
poetry run ruff format {[vars]all_path}
2828

@@ -50,8 +50,6 @@ commands =
5050
description = Run integration tests
5151
set_env =
5252
{[testenv]set_env}
53-
# Workaround for https://github.com/python-poetry/poetry/issues/6958
54-
POETRY_INSTALLER_PARALLEL = false
5553
LIBJUJU_VERSION_SPECIFIER = {env:LIBJUJU_VERSION_SPECIFIER:3.2.2}
5654
pass_env =
5755
CI

0 commit comments

Comments
 (0)