Skip to content

Commit eda1848

Browse files
committed
Migrate to Poetry 2.0
1 parent dee411e commit eda1848

File tree

12 files changed

+338
-267
lines changed

12 files changed

+338
-267
lines changed

.github/workflows/actions/python-poetry/action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ runs:
3333
# https://github.com/actions/runner-images/issues/6185
3434
PYTHON_KEYRING_BACKEND: "keyring.backends.null.Keyring"
3535
run: |
36-
poetry install
37-
poetry lock --check
36+
poetry check --lock
37+
poetry sync
3838
PROJECT_VERSION=$(poetry version -s)
3939
[ "${PROJECT_VERSION}" != "0.0.0" ] \
4040
|| { echo "Versioning broken"; exit 1; }

.github/workflows/cd.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ env:
55
ENABLE_PYPI_PUBLISH: true
66
ENABLE_TEST_PYPI_PUBLISH: true
77
RELEASE_PYTHON_VERSION: "3.12"
8-
RELEASE_POETRY_VERSION: "1.8"
8+
RELEASE_POETRY_VERSION: "2.0"
99

1010
on:
1111
push:

.github/workflows/ci.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,12 @@ jobs:
2020
os:
2121
- Ubuntu
2222
python-version:
23-
- "3.8"
2423
- "3.9"
2524
- "3.10"
2625
- "3.11"
2726
- "3.12"
2827
poetry-version:
29-
- "1.8"
28+
- "2.0"
3029

3130
runs-on: ${{ matrix.os }}-latest
3231
steps:

cookie_python/manage/repo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def run(
117117
return subprocess.run(*popenargs, check=check, **kwargs)
118118

119119
def shell(self) -> None:
120-
if sys.__stdin__.isatty():
120+
if sys.__stdin__ and sys.__stdin__.isatty():
121121
self.logger.info('Starting shell. Run "exit 1" to abort.')
122122
self.run([os.environ.get("SHELL", "/bin/bash")])
123123

poetry.lock

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

pyproject.toml

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
[build-system]
2-
requires = ["poetry-core>=1.2.0", "poetry-dynamic-versioning"]
3-
build-backend = "poetry_dynamic_versioning.backend"
2+
requires = ["poetry-core>=2.0.0,<3.0.0", "poetry-dynamic-versioning"]
3+
build-backend = "poetry.core.masonry.api"
44

5-
[tool.poetry]
5+
[project]
66
name = "cookie-python"
7-
version = "0.0.0"
87
description = ""
98
license = "MIT"
10-
authors = ["Stephen Kent <smkent@smkent.net>"]
9+
authors = [ { name = "Stephen Kent", email = "smkent@smkent.net" } ]
1110
readme = "README.md"
1211
repository = "https://github.com/smkent/cookie-python"
1312
classifiers = [
@@ -17,19 +16,30 @@ classifiers = [
1716
"Topic :: Software Development :: Libraries :: Python Modules",
1817
"Typing :: Typed",
1918
]
19+
requires-python = ">=3.9"
20+
dynamic = [ "version" ]
21+
dependencies = [
22+
"loguru",
23+
"pygithub",
24+
"pyyaml",
25+
"semver",
26+
]
27+
28+
[project.scripts]
29+
new-cookie = "cookie_python.new:main"
30+
manage-cookie = "cookie_python.manage.main:main"
31+
32+
[tool.poetry]
2033
packages = [
2134
{ include = "{{cookiecutter.project_name}}" }
2235
]
36+
requires-poetry = ">=2.0"
37+
version = "0.0.0"
2338

24-
[tool.poetry.dependencies]
25-
python = "^3.8"
26-
loguru = "*"
27-
poetry-dynamic-versioning = "*"
28-
pygithub = "*"
29-
pyyaml = "*"
30-
semver = "*"
39+
[tool.poetry.requires-plugins]
40+
poetry-dynamic-versioning = { version = ">=1.0.0,<2.0.0", extras = ["plugin"] }
3141

32-
[tool.poetry.dev-dependencies]
42+
[tool.poetry.group.dev.dependencies]
3343
bandit = {extras = ["toml"], version = "*"}
3444
black = "*"
3545
build = "*"
@@ -51,8 +61,6 @@ pytest-sugar = "*"
5161
types-PyYAML = "*"
5262

5363
[tool.poetry.scripts]
54-
new-cookie = "cookie_python.new:main"
55-
manage-cookie = "cookie_python.manage.main:main"
5664

5765
[tool.poetry-dynamic-versioning]
5866
enable = true

tests/test_manage_cookie.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def mock_pygithub(new_cookie: Path) -> Iterator[MagicMock]:
8888
@pytest.fixture
8989
def new_cookie_with_lock(new_cookie: Path, temp_dir: str) -> Iterator[Path]:
9090
for cmd in (
91-
["poetry", "lock", "--no-update"],
91+
["poetry", "sync"],
9292
["git", "add", "poetry.lock"],
9393
["git", "commit", "-m", "Create `poetry.lock`"],
9494
):

{{cookiecutter.project_name}}/.github/workflows/actions/python-poetry/action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ runs:
3333
# https://github.com/actions/runner-images/issues/6185
3434
PYTHON_KEYRING_BACKEND: "keyring.backends.null.Keyring"
3535
run: |
36-
poetry install
37-
poetry lock --check
36+
poetry check --lock
37+
poetry sync
3838
PROJECT_VERSION=$(poetry version -s)
3939
[ "${PROJECT_VERSION}" != "0.0.0" ] \
4040
|| { echo "Versioning broken"; exit 1; }

{{cookiecutter.project_name}}/.github/workflows/cd.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ env:
55
ENABLE_PYPI_PUBLISH: {{ "true" if cookiecutter.enable_pypi_publish|lower == "yes" else "false" }}
66
ENABLE_TEST_PYPI_PUBLISH: {{ "true" if cookiecutter.enable_pypi_publish|lower == "yes" else "false" }}
77
RELEASE_PYTHON_VERSION: "3.12"
8-
RELEASE_POETRY_VERSION: "1.8"
8+
RELEASE_POETRY_VERSION: "2.0"
99

1010
on:
1111
push:

{{cookiecutter.project_name}}/.github/workflows/ci.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,12 @@ jobs:
2020
os:
2121
- Ubuntu
2222
python-version:
23-
- "3.8"
2423
- "3.9"
2524
- "3.10"
2625
- "3.11"
2726
- "3.12"
2827
poetry-version:
29-
- "1.8"
28+
- "2.0"
3029

3130
runs-on: ${{ "{{" }} matrix.os }}-latest
3231
steps:

0 commit comments

Comments
 (0)