Skip to content

Commit 2921bf1

Browse files
authored
Merge pull request #109 from smkent/poetry
Migrate to Poetry 2.0
2 parents dee411e + 3ebdf29 commit 2921bf1

37 files changed

Lines changed: 474 additions & 401 deletions

.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:

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ repos:
4242
rev: v3.16.0
4343
hooks:
4444
- id: pyupgrade
45-
args: ["--keep-runtime-typing"]
45+
args: ["--py39-plus", "--keep-runtime-typing"]
4646
- repo: local
4747
hooks:
4848
- id: mypy

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@ Via [`pipx`][pipx]:
3131
```console
3232
pip install pipx
3333
pipx install poetry
34-
pipx inject poetry poetry-dynamic-versioning poetry-pre-commit-plugin
34+
pipx inject poetry poetry-pre-commit-plugin
3535
```
3636

3737
Via `pip`:
3838

3939
```console
4040
pip install poetry
41-
poetry self add poetry-dynamic-versioning poetry-pre-commit-plugin
41+
poetry self add poetry-pre-commit-plugin
4242
```
4343

4444
## New project creation

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

cookie_python/manage/update.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,3 +134,4 @@ def update_action(repo: RepoSandbox) -> None:
134134
repo.logger.info(f"Updated {actions_str}")
135135
repo.commit_changes(message)
136136
repo.open_pr(message)
137+
repo.run(["poetry", "env", "remove", "--all"], check=False)

cookie_python/new.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,11 @@
33
import subprocess
44
import time
55
from pathlib import Path
6-
from typing import List, Tuple
76

87
TEMPLATE_REPOSITORY_URL = "https://github.com/smkent/cookie-python"
98

109

11-
def parse_args() -> Tuple[argparse.Namespace, List[str]]:
10+
def parse_args() -> tuple[argparse.Namespace, list[str]]:
1211
ap = argparse.ArgumentParser()
1312
ap.add_argument(
1413
"project_dir", help="New project parent directory", type=str

hooks/post_gen_project.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,13 @@
22
import os
33
import shutil
44
import subprocess
5-
from typing import Dict, List
65

76
import yaml
87

98
TEMPLATE_ONLY_DATA = "cookiecutter_template_data"
109

1110

12-
def _run(call: List[str], env: Dict[str, str]) -> None:
11+
def _run(call: list[str], env: dict[str, str]) -> None:
1312
subprocess.run(call, env=env).check_returncode()
1413

1514

poetry.lock

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

0 commit comments

Comments
 (0)