Skip to content

Commit

Permalink
Migrate to Poetry v2 and project-managed Poetry plugins (#45)
Browse files Browse the repository at this point in the history
  • Loading branch information
pronovic authored Jan 8, 2025
1 parent 5027b34 commit ce40a22
Show file tree
Hide file tree
Showing 11 changed files with 171 additions and 101 deletions.
10 changes: 0 additions & 10 deletions .coveragerc

This file was deleted.

8 changes: 4 additions & 4 deletions .github/workflows/test-suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ concurrency:
jobs:
linux-build-and-test:
name: "Linux"
uses: pronovic/gha-shared-workflows/.github/workflows/poetry-build-and-test.yml@v7
uses: pronovic/gha-shared-workflows/.github/workflows/poetry-build-and-test.yml@v8
secrets: inherit
with:
matrix-os-version: "[ 'ubuntu-latest' ]"
Expand All @@ -25,22 +25,22 @@ jobs:
persist-python-version: "3.10" # persist artifacts for the oldest supported Python version
macos-build-and-test:
name: "MacOS"
uses: pronovic/gha-shared-workflows/.github/workflows/poetry-build-and-test.yml@v7
uses: pronovic/gha-shared-workflows/.github/workflows/poetry-build-and-test.yml@v8
secrets: inherit
with:
matrix-os-version: "[ 'macos-latest' ]"
matrix-python-version: "[ '3.13' ]" # only run MacOS tests on latest Python
windows-build-and-test:
name: "Windows"
uses: pronovic/gha-shared-workflows/.github/workflows/poetry-build-and-test.yml@v7
uses: pronovic/gha-shared-workflows/.github/workflows/poetry-build-and-test.yml@v8
secrets: inherit
with:
matrix-os-version: "[ 'windows-latest' ]"
matrix-python-version: "[ '3.13' ]" # only run Windows tests on latest Python
release:
name: "Release"
if: github.ref_type == 'tag'
uses: pronovic/gha-shared-workflows/.github/workflows/poetry-release.yml@v7
uses: pronovic/gha-shared-workflows/.github/workflows/poetry-release.yml@v8
needs: [ linux-build-and-test, macos-build-and-test, windows-build-and-test ]
secrets: inherit
with:
Expand Down
8 changes: 4 additions & 4 deletions .run/commands/bumpchangelog.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# vim: set ft=bash ts=3 sw=3 expandtab:
# Bump the version in the changelog, preparing for a new development cycle

# If pyproject.toml is configured to use the poetry-dynamic-versioning plugin,
# then you need to have it installed locally, or you will get unexpected results
# from this command. The new version in the Changelog will always be "0.0.1",
# because all Poetry is aware of is the hardcoded version "0.0.0".
# This relies on the poetry-dynamic-versioning plugin, which is assumed to be
# installed as a project plugin. If it's not installed, the new version in the
# Changelog will always be "0.0.1", because all Poetry is aware of is the
# hardcoded version "0.0.0".

command_bumpchangelog() {
mv Changelog Changelog.$$
Expand Down
6 changes: 3 additions & 3 deletions .run/commands/outdated.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
command_outdated() {
echo "Updating dependencies with current constraints..."
echo ""
poetry update
poetry update --sync --with=dev
if [ $? != 0 ]; then
echo "*** Failed to update dependencies"
exit 1
Expand All @@ -16,13 +16,13 @@ command_outdated() {
echo "Checking for outdated constraints..."
echo ""

PATTERNS=$(poetry show --tree | grep '^\w' | cut -d' ' -f1 | sed 's/.*/^&\\s/')
PATTERNS=$(poetry show --with=dev --tree | grep '^\w' | cut -d' ' -f1 | sed 's/.*/^&\\s/')
if [ $? != 0 ]; then
echo "*** Failed to run 'poetry show --tree'"
exit 1
fi

OUTDATED=$(poetry show --outdated)
OUTDATED=$(poetry show --with=dev --outdated)
if [ $? != 0 ]; then
echo "*** Failed to run 'poetry show --outdated'"
exit 1
Expand Down
12 changes: 0 additions & 12 deletions .run/commands/poetryplugin.sh

This file was deleted.

2 changes: 1 addition & 1 deletion .run/commands/virtualenv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Create and update the virtualenv, synchronizing it to versions in poetry.lock

command_virtualenv() {
poetry install --sync --all-extras
poetry sync --all-extras --all-groups
if [ $? != 0 ]; then
echo "*** Failed to install the virtualenv"
exit 1
Expand Down
1 change: 1 addition & 0 deletions .run/tasks/docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ help_docs() {
}

task_docs() {
run_command virtualenv # work around the fact that Poetry sometimes uninstalls extras
run_command sphinx "$@"
}

5 changes: 4 additions & 1 deletion Changelog
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
Version 3.8.4 unreleased
Version 3.9.0 unreleased

* Migrate to Poetry v2 and project-managed Poetry plugins.
* Move configuration into pyproject.toml for coverage.
* Upgrade to gha-shared-workflows@v8 for Poetry v2 support.
* Update dependencies to match versions in Debian trixie.

Version 3.8.3 02 Jan 2025
Expand Down
18 changes: 6 additions & 12 deletions DEVELOPER.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ but most of it also works equivalently on MacOS and Windows.

## Packaging and Dependencies

This project uses [Poetry](https://python-poetry.org/) to manage Python
This project uses [Poetry v2](https://python-poetry.org/) to manage Python
packaging and dependencies. Most day-to-day tasks (such as running unit tests
from the command line) are orchestrated through Poetry.

Expand Down Expand Up @@ -38,7 +38,7 @@ sure that you have a working Python 3 enviroment and install Poetry itself.

### Poetry Version

The project is designed to work with Poetry >= 1.8.0. If you already have an older
The project is designed to work with Poetry >= 2.0.0. If you already have an older
version of Poetry installed on your system, upgrade it first.

### MacOS
Expand All @@ -57,14 +57,12 @@ Finally, install Poetry itself and then verify your installation:

```
pipx install poetry
pipx inject poetry poetry-dynamic-versioning
pipx list --include-injected
```

To upgrade this installation later, use:

```
pipx upgrade --include-injected poetry
pipx upgrade poetry
```

### Debian
Expand All @@ -82,14 +80,12 @@ Finally, install Poetry itself and then verify your installation:

```
pipx install poetry
pipx inject poetry poetry-dynamic-versioning
pipx list --include-injected
```

To upgrade this installation later, use:

```
pipx upgrade --include-injected poetry
pipx upgrade poetry
```

### Windows
Expand All @@ -108,14 +104,12 @@ Finally, install Poetry itself and then verify your installation:

```
pipx install poetry
pipx inject poetry poetry-dynamic-versioning
pipx list --include-injected
```

To upgrade this installation later, use:

```
pipx upgrade --include-injected poetry
pipx upgrade poetry
```

> _Note:_ The development environment (the `run` script, etc.) expects a bash
Expand Down Expand Up @@ -204,7 +198,7 @@ Go to the PyCharm settings and find the `cedar-backup3` project. Under
the **Exclude Files** box, enter the following:

```
LICENSE;NOTICE;PyPI.md;.coverage;.coveragerc;.github;.gitignore;.gitattributes;.htmlcov;.idea;.isort.cfg;.pre-commit-config.yaml;.pylintrc;.pytest_cache;.readthedocs.yml;.tabignore;build;dist;docs/_build;out;poetry.lock;poetry.toml;run;.run;.venv;
LICENSE;NOTICE;PyPI.md;build;dist;docs/_build;out;poetry.lock;poetry.toml;run;.coverage;.coverage.lcov;.coveragerc;.gitattributes;.github;.gitignore;.htmlcov;.idea;.mypy_cache;.poetry;.pre-commit-config.yaml;.pylintrc;.pytest_cache;.readthedocs.yml;.run;.tabignore;.venv
```

When you're done, click **Ok**. Then, go to the gear icon in the project panel
Expand Down
Loading

0 comments on commit ce40a22

Please sign in to comment.