Skip to content

Commit 6474dcb

Browse files
authored
Refactoring/624 update to poetry 2.3.0 (#660)
* Bump action to poetry 2.3.0 default * Update to poetry 2.3.0 * Switch to more PEP-compliant pyproject.toml format * Update cookiecutter template based on PTB pyproject.toml & update to poetry 2.3.0
1 parent bd1f56a commit 6474dcb

File tree

9 files changed

+784
-554
lines changed

9 files changed

+784
-554
lines changed

.github/actions/python-environment/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ inputs:
1111
poetry-version:
1212
description: 'Poetry version to use'
1313
required: true
14-
default: "2.1.4"
14+
default: "2.3.0"
1515

1616
working-directory:
1717
description: 'Working directory to use'

doc/changes/unreleased.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,35 @@
11
# Unreleased
22

3+
## Summary
4+
5+
In exasol-toolbox version `5.0.0` and higher the default behavior for
6+
`.github/actions/python-environment/action.yml` has changed. In previous versions,
7+
the default value for `poetry-version` was `2.1.2`, and it is now `2.3.0`.
8+
9+
* Depending on its poetry version, a repository relying on the default behavior of said
10+
action may run into breaking changes. This can easily be resolved with explicitly setting the
11+
`poetry-version` when calling the GitHub action. It is, however, recommended whenever
12+
possible to update the poetry version of the affected repository. Unfortunately,
13+
there is not a quick and easy way to update all the places where `poetry-version`
14+
could be specified in the GitHub workflows.
15+
16+
* Projects migrating to this version should:
17+
18+
* Update their `pyproject.toml` to have:
19+
```toml
20+
requires-poetry = ">=2.3.0"
21+
```
22+
* Run `poetry check` and resolve any issues
23+
* (optional) Run `poetry lock` to update the lock
24+
* (optional) Update their `pyproject.toml` to fit:
25+
* [PEP-621](https://peps.python.org/pep-0621/)
26+
* [PEP-735](https://peps.python.org/pep-0735/)
27+
28+
Note that [uvx migrate-to-uv](https://github.com/mkniewallner/migrate-to-uv) seems to
29+
do a good job with automating many of the PEP-related changes; though developers should
30+
take care and will need to make manual changes to ensure it still works with
31+
`poetry`, as the PTB does not yet support `uv`.
32+
333
## Documentation
434

535
* #648: Moved sonar setup instructions in the User guide
@@ -8,3 +38,7 @@
838

939
* #649: Restricted noxconfig usage throughout exasol.toolbox to only exasol.toolbox.nox.*
1040
* #647: Added summary to changelog template
41+
42+
## Refactoring
43+
44+
* 624: Updated GitHub python-environment action and all code to use Poetry >= 2.3.0

doc/github_actions/python_environment.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Parameters
1818
* - poetry-version
1919
- Poetry version to use
2020
- True
21-
- 2.1.2
21+
- 2.3.0
2222
* - working-directory
2323
- Working directory to use
2424
- False
@@ -55,7 +55,7 @@ Example Usage
5555
uses: exasol/python-toolbox/.github/actions/python-environment@v1
5656
with:
5757
python-version: 3.12
58-
poetry-version: 2.1.2
58+
poetry-version: 2.3.0
5959
working-directory: pytest-backend
6060
use-cache: false
6161
extras: 'numpy,pandas'

doc/user_guide/dependencies.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ Core dependencies
55
+++++++++++++++++
66

77
- Python >= 3.10
8-
- poetry >= 2.1.2
8+
- poetry >= 2.3.0
99
- `poetry export <https://github.com/python-poetry/poetry-plugin-export>`__

exasol/toolbox/util/dependencies/poetry_dependencies.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,17 @@ def groups(self) -> tuple[PoetryGroup, ...]:
7777
toml_section=f"{group_key}.{group}.dependencies",
7878
)
7979
)
80+
81+
new_group_key = "dependency-groups"
82+
if group_dict := self.get_section_dict(new_group_key):
83+
for group, content in group_dict.items():
84+
groups.append(
85+
PoetryGroup(
86+
name=group,
87+
toml_section=f"{new_group_key}.{group}",
88+
)
89+
)
90+
8091
return tuple(groups)
8192

8293

poetry.lock

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

project-template/{{cookiecutter.repo_name}}/pyproject.toml

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,42 @@
11
[project]
22
name = "{{cookiecutter.pypi_package_name}}"
33
version = "0.1.0"
4-
requires-python = ">={{cookiecutter.python_version_min}},<4.0"
54
description = "{{cookiecutter.description}}"
65
authors = [
76
{name = "{{cookiecutter.author_full_name}}", email = "{{cookiecutter.author_email}}"},
87
]
8+
requires-python = ">={{cookiecutter.python_version_min}},<4.0"
99
readme = "README.rst"
1010
license = "MIT"
11+
license-files = ["LICENSE"]
1112
keywords = ['exasol', '{{cookiecutter.package_name}}']
12-
dynamic = ["dependencies"]
13+
classifiers = [
14+
"Programming Language :: Python :: 3",
15+
16+
]
17+
dependencies = []
18+
19+
[dependency-groups]
20+
dev = [
21+
"exasol-toolbox>=4.0.1,<5",
22+
]
1323

1424
[tool.poetry]
15-
requires-poetry = ">=2.1.0"
25+
requires-poetry = ">=2.3.0"
1626
packages = [
1727
{ include = "exasol" },
1828
]
29+
include = [
30+
"README.rst",
31+
"doc/changes/changelog.md",
32+
"LICENSE",
33+
"exasol/toolbox/templates/**/*"
34+
]
1935

2036
[poetry.urls]
2137
repository = "https://github.com/exasol/{{cookiecutter.repo_name}}"
2238
homepage = "https://github.com/exasol/{{cookiecutter.repo_name}}"
2339

24-
[tool.poetry.dependencies]
25-
26-
[tool.poetry.group.dev.dependencies]
27-
exasol-toolbox = "^1.6.0"
28-
2940
[build-system]
3041
requires = ["poetry-core>=2.0.0"]
3142
build-backend = "poetry.core.masonry.api"
@@ -38,7 +49,8 @@ source = [
3849
]
3950

4051
[tool.coverage.report]
41-
fail_under = 15
52+
# Switch to 15 after code has been added
53+
fail_under = 0
4254

4355
[tool.black]
4456
line-length = 88
@@ -59,10 +71,10 @@ max-module-lines = 800
5971

6072
[tool.ruff.lint]
6173
extend-ignore = [
62-
"E", # Syntax errors
63-
"F", # Pyflakes rules (excluding F401)
64-
"UP", # pyupgrade rules
65-
"D", # Docstring rules
74+
"E", # Syntax errors
75+
"F", # Pyflakes rules (excluding F401)
76+
"UP", # pyupgrade rules
77+
"D", # Docstring rules
6678
]
6779
extend-select = ["F401"]
6880
unfixable = []

pyproject.toml

Lines changed: 57 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
[project]
22
name = "exasol-toolbox"
33
version = "4.0.1"
4-
requires-python = ">=3.10,<4.0"
54
description = "Your one-stop solution for managing all standard tasks and core workflows of your Python project."
65
authors = [
76
{ name = "Nicola Coretti", email = "[email protected]" },
87
{ name = "Ariel Schulz", email = "[email protected]" },
98
]
9+
requires-python = ">=3.10,<4.0"
1010
readme = "README.rst"
1111
license = "MIT"
12+
license-files = ["LICENSE"]
1213
keywords = [
1314
"nox",
1415
"tooling",
@@ -17,16 +18,64 @@ keywords = [
1718
"exasol",
1819
"infrastructure",
1920
]
20-
dynamic = ["dependencies"]
21+
classifiers = [
22+
"Programming Language :: Python :: 3",
23+
"Programming Language :: Python :: 3.10",
24+
"Programming Language :: Python :: 3.11",
25+
"Programming Language :: Python :: 3.12",
26+
"Programming Language :: Python :: 3.13",
27+
"Programming Language :: Python :: 3.14",
28+
]
29+
dependencies = [
30+
"bandit[toml]>=1.7.9,<2",
31+
"black>=24.1.0,<26",
32+
"coverage>=6.4.4,<8.0.0",
33+
"furo>=2022.9.15",
34+
"importlib-resources>=5.12.0",
35+
"import-linter>=2.0,<3",
36+
"isort>=7.0.0,<8",
37+
"jinja2>=3.1.6,<4",
38+
"mypy>=0.971",
39+
"myst-parser>=2.0.0,<4",
40+
"nox>=2022.8.7",
41+
"pip-audit>=2.7.3,<3",
42+
"pip-licenses>=5.0.0,<6",
43+
"pluggy>=1.5.0,<2",
44+
"pre-commit>=4,<5",
45+
"pydantic>=2.11.5,<3",
46+
"pylint>=2.15.4",
47+
"pysonar>=1.0.1.1548,<2",
48+
"pytest>=7.2.2,<10",
49+
"pyupgrade>=2.38.2,<4.0.0",
50+
"ruff>=0.14.5,<0.15",
51+
"shibuya>=2024.5.14",
52+
"sphinx>=5.3,<8",
53+
"sphinx-copybutton>=0.5.0,<0.6",
54+
"sphinx-inline-tabs>=2023.4.21,<2024",
55+
"sphinx-design>=0.5.0,<1",
56+
"sphinx-toolbox>=4.0.0,<5",
57+
"typer[all]>=0.7.0",
58+
"twine>=6.1.0,<7",
59+
]
60+
61+
[project.scripts]
62+
tbx = "exasol.toolbox.tools.tbx:CLI"
63+
sphinx-multiversion = "exasol.toolbox.sphinx.multiversion:main"
64+
65+
[dependency-groups]
66+
dev = [
67+
"autoimport>=1.4.0,<2",
68+
"cookiecutter>=2.6.0,<3",
69+
]
2170

2271
[tool.poetry]
23-
requires-poetry = ">=2.1.0"
72+
requires-poetry = ">=2.3.0"
2473
packages = [
2574
{ include = "exasol" },
2675
]
2776
include = [
2877
"README.rst",
29-
"doc/changelog.rst",
78+
"doc/changes/changelog.md",
3079
"LICENSE",
3180
"exasol/toolbox/templates/**/*"
3281
]
@@ -38,41 +87,6 @@ Source = "https://github.com/exasol/python-toolbox"
3887
Issues = "https://github.com/exasol/python-toolbox/issues"
3988
Changelog = "https://exasol.github.io/python-toolbox/changelog.html"
4089

41-
[tool.poetry.dependencies]
42-
bandit = { extras = ["toml"], version = "^1.7.9" }
43-
black = ">=24.1.0,<26"
44-
coverage = ">=6.4.4,<8.0.0"
45-
furo = ">=2022.9.15"
46-
importlib-resources = ">=5.12.0"
47-
import-linter = "^2.0"
48-
isort = "^7.0.0"
49-
jinja2 = "^3.1.6"
50-
mypy = ">=0.971"
51-
myst-parser = ">=2.0.0,<4"
52-
nox = ">=2022.8.7"
53-
pip-audit = "^2.7.3"
54-
pip-licenses = "^5.0.0"
55-
pluggy = "^1.5.0"
56-
pre-commit = ">=4,<5"
57-
pydantic = "^2.11.5"
58-
pylint = ">=2.15.4"
59-
pysonar = "^1.0.1.1548"
60-
pytest = ">=7.2.2,<10"
61-
pyupgrade = ">=2.38.2,<4.0.0"
62-
ruff = "^0.14.5"
63-
shibuya = ">=2024.5.14"
64-
sphinx = ">=5.3,<8"
65-
sphinx-copybutton = "^0.5.0"
66-
sphinx-inline-tabs = "^2023.4.21"
67-
sphinx-design = ">=0.5.0,<1"
68-
sphinx-toolbox = "^4.0.0"
69-
typer = { extras = ["all"], version = ">=0.7.0" }
70-
twine = "^6.1.0"
71-
72-
[tool.poetry.group.dev.dependencies]
73-
autoimport = "^1.4.0"
74-
cookiecutter = "^2.6.0"
75-
7690
[build-system]
7791
requires = ["poetry-core>=2.0.0"]
7892
build-backend = "poetry.core.masonry.api"
@@ -114,18 +128,14 @@ ignore_errors = true
114128

115129
[tool.ruff.lint]
116130
extend-ignore = [
117-
"E", # Syntax errors
118-
"F", # Pyflakes rules (excluding F401)
119-
"UP", # pyupgrade rules
120-
"D", # Docstring rules
131+
"E", # Syntax errors
132+
"F", # Pyflakes rules (excluding F401)
133+
"UP", # pyupgrade rules
134+
"D", # Docstring rules
121135
]
122136
extend-select = ["F401"]
123137
unfixable = []
124138

125-
[tool.poetry.plugins."console_scripts"]
126-
tbx = 'exasol.toolbox.tools.tbx:CLI'
127-
sphinx-multiversion = 'exasol.toolbox.sphinx.multiversion:main'
128-
129139
[tool.poetry.requires-plugins]
130140
poetry-plugin-export = ">=1.8"
131141

0 commit comments

Comments
 (0)