Skip to content

Commit 3775ace

Browse files
support for poetry 2.0 (#12)
--------- Co-authored-by: Renan Rodrigues dos Santos <renan.engmec@gmail.com>
1 parent eb84c14 commit 3775ace

File tree

7 files changed

+651
-547
lines changed

7 files changed

+651
-547
lines changed

.github/workflows/main.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,16 @@ jobs:
2626
- name: Install Pixi
2727
uses: prefix-dev/setup-pixi@v0.8.1
2828
with:
29-
pixi-version: v0.32.0
29+
pixi-version: v0.40.2
3030
run-install: false
3131

3232
- name: Install Python
3333
run: pixi global install python
3434

3535
- name: Install Poetry
36-
uses: abatilo/actions-poetry@v2
36+
uses: abatilo/actions-poetry@v4
3737
with:
38-
poetry-version: 1.8.3
38+
poetry-version: 2.0.1
3939

4040
- name: Configure poetry
4141
run: poetry config virtualenvs.in-project true

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ jobs:
1919
- name: Set up Python 3.12
2020
uses: actions/setup-python@v5
2121
with:
22-
python-version: 3.12
22+
python-version: 3.13
2323

2424
- name: Install Poetry
25-
run: curl -sSL https://install.python-poetry.org | POETRY_VERSION=1.8.3 python -
25+
run: curl -sSL https://install.python-poetry.org | POETRY_VERSION=2.0.1 python -
2626

2727
- name: Update PATH
2828
run: echo "$HOME/.local/bin" >> $GITHUB_PATH

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
This plugin allows the installation of Poetry into Conda environments other than `base` and enables it to create
44
virtual environments for your projects without polluting the Conda environment where it is installed.
55

6-
It works with any combination of Python 3.9+ and Poetry 1.3+.
6+
It works with any combination of Python 3.9+ and Poetry 1.5+.
77

88
## Installation
99

poetry.lock

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

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "poetry-conda"
3-
version = "0.1.3"
3+
version = "0.1.4"
44
description = "Poetry plugin that allows for the creation of virtual environments using Poetry, without interfering with the Conda environment in which Poetry is installed"
55
authors = ["Renan Santos <renan.engmec@gmail.com>"]
66
license = "MIT"
@@ -27,12 +27,12 @@ packages = [{ include = "poetry_conda", from = "src" }]
2727

2828
[tool.poetry.dependencies]
2929
python = ">=3.9,<4"
30-
poetry = ">=1.3.0,<2"
30+
poetry = ">=1.5.0,<3"
3131

3232
[tool.poetry.group.dev.dependencies]
3333
mypy = ">=1,<2"
3434
pytest = ">=8,<9"
35-
ruff = ">=0.6,<0.7"
35+
ruff = ">=0.9,<0.10"
3636
nox_poetry = ">=1,<2"
3737

3838
[tool.poetry.plugins."poetry.application.plugin"]

src/poetry_conda/plugin.py

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import os
2-
from pathlib import Path
3-
from typing import Any, Callable, Dict, Optional, Tuple
2+
from typing import Any, Callable
43

5-
from poetry.__version__ import __version__
64
from poetry.config import config
75
from poetry.config.config import boolean_normalizer, boolean_validator
86
from poetry.console.application import Application
@@ -28,9 +26,9 @@ def get(self, reload: bool = False) -> env.Env:
2826

2927

3028
class Config(config.Config):
31-
def __init__(self, use_environment: bool = True, base_dir: Optional[Path] = None) -> None:
29+
def __init__(self, *args: bool, **kwargs: bool) -> None:
3230
Config.default_config["virtualenvs"]["ignore-conda-env"] = True
33-
super().__init__(use_environment, base_dir)
31+
super().__init__(*args, **kwargs)
3432

3533
@classmethod
3634
def _get_normalizer(cls, name: str) -> Callable[[str], Any]:
@@ -41,14 +39,9 @@ def _get_normalizer(cls, name: str) -> Callable[[str], Any]:
4139

4240
class ConfigCommand(config_command.ConfigCommand):
4341
@property
44-
def unique_config_values(self) -> Dict[str, Tuple[Any, Any]]:
42+
def unique_config_values(self) -> dict[str, tuple[Any, Any]]:
4543
unique_config_values = super().unique_config_values
46-
47-
major, minor, _ = [int(v) for v in __version__.split(".")]
48-
if major == 1 and minor < 4:
49-
unique_config_values["virtualenvs.ignore-conda-env"] = (boolean_validator, boolean_normalizer, True) # type: ignore
50-
else:
51-
unique_config_values["virtualenvs.ignore-conda-env"] = (boolean_validator, boolean_normalizer)
44+
unique_config_values["virtualenvs.ignore-conda-env"] = (boolean_validator, boolean_normalizer)
5245
return unique_config_values
5346

5447

tests/conftest.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,12 @@ def _use_poetry_env_var_config() -> None:
1717
@pytest.fixture(
1818
scope="session",
1919
params=[
20-
{"python": "3.9", "poetry": "1.3.0"},
21-
{"python": "3.10", "poetry": "1.3.0"},
20+
{"python": "3.9", "poetry": "1.5.0"},
21+
{"python": "3.10", "poetry": "1.5.0"},
2222
{"python": "3.11", "poetry": "1.5.1"},
23-
{"python": "3.12", "poetry": "1.8.3"},
24-
{"python": "3.13", "poetry": "1.8.3"},
23+
{"python": "3.12", "poetry": "1.8.5"},
24+
{"python": "3.13", "poetry": "1.8.5"},
25+
{"python": "3.13", "poetry": "2.0.1"},
2526
],
2627
ids=lambda param: f"python-{param['python']}-poetry-{param['poetry']}",
2728
)
@@ -48,7 +49,8 @@ def pixi_environment(request: pytest.FixtureRequest) -> Iterator[str]:
4849

4950
root_dir = Path(__file__).parent.parent
5051
subprocess.run(
51-
["pixi", "add", "--manifest-path", f"{tmp_path}/pixi.toml", "--pypi", f"poetry-conda@{root_dir}"], check=True
52+
["pixi", "add", "--manifest-path", f"{tmp_path}/pixi.toml", "--pypi", f"poetry-conda@file://{root_dir}"],
53+
check=True,
5254
)
5355

5456
yield tmp_path
@@ -66,7 +68,14 @@ def _remove_poetry_conda_plugin(pixi_environment: str) -> Iterator[None]:
6668

6769
root_dir = Path(__file__).parent.parent
6870
subprocess.run(
69-
["pixi", "add", "--manifest-path", f"{pixi_environment}/pixi.toml", "--pypi", f"poetry-conda@{root_dir}"],
71+
[
72+
"pixi",
73+
"add",
74+
"--manifest-path",
75+
f"{pixi_environment}/pixi.toml",
76+
"--pypi",
77+
f"poetry-conda@file://{root_dir}",
78+
],
7079
check=True,
7180
)
7281

0 commit comments

Comments
 (0)