Skip to content

Commit

Permalink
Migrate to Poetry v2 and project-managed Poetry plugins (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
pronovic authored Jan 8, 2025
1 parent 271685a commit 190d099
Show file tree
Hide file tree
Showing 13 changed files with 249 additions and 163 deletions.
11 changes: 0 additions & 11 deletions .coveragerc

This file was deleted.

6 changes: 3 additions & 3 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,15 +25,15 @@ 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
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 ]
secrets: inherit
with:
Expand Down
55 changes: 0 additions & 55 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 "$@"
}

8 changes: 8 additions & 0 deletions Changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
Version 0.6.14 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.
* Address some Genshi warnings exposed by Pytest warnings->errors config.
* Update all dependencies and outdated constraints.

Version 0.6.13 02 Jan 2025

* Add GitHub security policy in SECURITY.md.
Expand Down
14 changes: 5 additions & 9 deletions DEVELOPER.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ suites and combines the coverage results together into a single report.

## 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/). To reduce boilerplate, classes are defined using [Attrs](https://www.attrs.org/) (see this [rationale](https://glyph.twistedmatrix.com/2016/08/attrs.html)).

Expand Down Expand Up @@ -53,7 +53,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 @@ -72,14 +72,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 @@ -97,14 +95,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
```

## Developer Tasks
Expand Down Expand Up @@ -250,7 +246,7 @@ Go to the PyCharm settings and find the `hcoop-meetbot` project. Under
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;localbot;test-conf;test-data;tmp;web;backup
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;localbot;test-conf;test-data;tmp;web;backup;meetings;test-logs
```

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

0 comments on commit 190d099

Please sign in to comment.