Skip to content

Commit

Permalink
Migrate to Poetry v2 and project-managed Poetry plugins (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
pronovic authored Jan 8, 2025
1 parent 54c81bd commit 986b120
Show file tree
Hide file tree
Showing 13 changed files with 225 additions and 135 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
32 changes: 0 additions & 32 deletions .mypy.ini

This file was deleted.

1 change: 0 additions & 1 deletion .pytest.ini

This file was deleted.

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 "$@"
}

7 changes: 7 additions & 0 deletions Changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
Version 0.6.10 unreleased

* Migrate to Poetry v2 and project-managed Poetry plugins.
* Move configuration into pyproject.toml for pytest, mypy & coverage.
* Upgrade to gha-shared-workflows@v8 for Poetry v2 support.
* Update all dependencies and outdated constraints.

Version 0.6.9 02 Jan 2025

* Add GitHub security policy in SECURITY.md.
Expand Down
18 changes: 6 additions & 12 deletions DEVELOPER.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This code should work equivalently on MacOS, Linux, and Windows.

## Packaging and Dependencies

This project uses [Poetry](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.
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.

A coding standard is enforced using [Black](https://pypi.org/project/black/), [isort](https://pypi.org/project/isort/) and [Pylint](https://pypi.org/project/pylint/). Python 3 type hinting is validated using [MyPy](https://pypi.org/project/mypy/).

Expand Down Expand Up @@ -34,7 +34,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 @@ -53,14 +53,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 @@ -78,14 +76,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 @@ -104,14 +100,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 @@ -193,7 +187,7 @@ Structure**, mark both `src` and `tests` as source folders. In the **Exclude
Files** box, enter the following:

```
LICENSE;NOTICE;PyPI.md;.coverage;.coveragerc;.github;.gitignore;.gitattributes;.htmlcov;.idea;.isort.cfg;.mypy.ini;.mypy_cache;.pre-commit-config.yaml;.pylintrc;.pytest_cache;.pytest.ini;.readthedocs.yml;.tabignore;build;dist;docs/_build;out;poetry.lock;poetry.toml;run;.run;.venv;.runtime
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 986b120

Please sign in to comment.