Skip to content

Commit 1a41f1b

Browse files
authored
chore: compatibility with poetry 1.5, require poetry 1.5, update dev dependencies (#61)
1 parent 400df31 commit 1a41f1b

File tree

6 files changed

+314
-407
lines changed

6 files changed

+314
-407
lines changed

poetry.lock

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

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ include = [
1616

1717
[tool.poetry.dependencies]
1818
python = "^3.7"
19-
poetry = "^1.4.0"
19+
poetry = "^1.5.0"
2020

2121
[tool.poetry.group.dev.dependencies]
2222
pre-commit = ">=2.6"

src/poetry_plugin_bundle/bundlers/venv_bundler.py

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,14 @@
33
import subprocess
44
import sys
55

6+
from pathlib import Path
67
from subprocess import CalledProcessError
78
from typing import TYPE_CHECKING
89

910
from poetry_plugin_bundle.bundlers.bundler import Bundler
1011

1112

1213
if TYPE_CHECKING:
13-
from pathlib import Path
14-
1514
from cleo.io.io import IO
1615
from cleo.io.outputs.section_output import SectionOutput
1716
from poetry.core.constraints.version import Version
@@ -32,7 +31,7 @@ def set_path(self, path: Path) -> VenvBundler:
3231

3332
return self
3433

35-
def set_executable(self, executable: str) -> VenvBundler:
34+
def set_executable(self, executable: str | None) -> VenvBundler:
3635
self._executable = executable
3736

3837
return self
@@ -65,10 +64,10 @@ def bundle(self, poetry: Poetry, io: IO) -> bool:
6564
warnings = []
6665

6766
manager = EnvManager(poetry)
68-
executable = self._executable
69-
if self._executable is not None:
67+
if self._executable:
7068
executable, python_version = self._get_executable_info(self._executable)
7169
else:
70+
executable = None
7271
version_info = SystemEnv(Path(sys.prefix)).get_version_info()
7372
python_version = Version.parse(".".join(str(v) for v in version_info[:3]))
7473

@@ -93,7 +92,7 @@ def bundle(self, poetry: Poetry, io: IO) -> bool:
9392
io, f"{message}: <info>Removing existing virtual environment</info>"
9493
)
9594

96-
manager.remove_venv(str(self._path))
95+
manager.remove_venv(self._path)
9796

9897
self._write(
9998
io,
@@ -103,7 +102,7 @@ def bundle(self, poetry: Poetry, io: IO) -> bool:
103102
),
104103
)
105104

106-
manager.build_venv(str(self._path), executable=executable)
105+
manager.build_venv(self._path, executable=executable)
107106
else:
108107
self._write(
109108
io, f"{message}: <info>Using existing virtual environment</info>"
@@ -117,7 +116,7 @@ def bundle(self, poetry: Poetry, io: IO) -> bool:
117116
),
118117
)
119118

120-
manager.build_venv(str(self._path), executable=executable)
119+
manager.build_venv(self._path, executable=executable)
121120

122121
env = VirtualEnv(self._path)
123122

@@ -134,10 +133,6 @@ def bundle(self, poetry: Poetry, io: IO) -> bool:
134133
if self._activated_groups is not None:
135134
installer.only_groups(self._activated_groups)
136135
installer.requires_synchronization()
137-
use_executor = poetry.config.get("experimental.new-installer", False)
138-
if not use_executor:
139-
# only set if false because the method is deprecated
140-
installer.use_executor(False)
141136

142137
return_code = installer.run()
143138
if return_code:
@@ -214,7 +209,7 @@ def _write(self, io: IO | SectionOutput, message: str) -> None:
214209

215210
io.overwrite(message)
216211

217-
def _get_executable_info(self, executable: str) -> tuple[str, Version]:
212+
def _get_executable_info(self, executable: str) -> tuple[Path, Version]:
218213
from poetry.core.constraints.version import Version
219214

220215
try:
@@ -244,4 +239,4 @@ def _get_executable_info(self, executable: str) -> tuple[str, Version]:
244239

245240
python_version = Version.parse(python_version_str.strip())
246241

247-
return executable, python_version
242+
return Path(executable), python_version

tests/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def config(
7373
def tmp_venv(tmp_path: Path) -> Iterator[VirtualEnv]:
7474
venv_path = tmp_path / "venv"
7575

76-
EnvManager.build_venv(str(venv_path))
76+
EnvManager.build_venv(venv_path)
7777

7878
venv = VirtualEnv(venv_path)
7979
yield venv

tests/fixtures/simple_project/pyproject.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ classifiers = [
2525
python = "~2.7 || ^3.4"
2626
foo = "^1.0.0"
2727

28+
[tool.poetry.group.dev]
29+
optional = true
30+
dependencies = {}
31+
2832
[tool.poetry.scripts]
2933
foo = "foo:bar"
3034
baz = "bar:baz.boom.bim"

tests/helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def reset_poetry(self) -> None:
3232

3333

3434
class TestLocker(Locker):
35-
def __init__(self, lock: str | Path, local_config: dict[str, Any]) -> None:
35+
def __init__(self, lock: Path, local_config: dict[str, Any]) -> None:
3636
super().__init__(lock, local_config)
3737
self._locked = False
3838
self._write = False

0 commit comments

Comments
 (0)