Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support dependency groups #64

Closed
Dekker1 opened this issue Sep 17, 2021 · 6 comments
Closed

Support dependency groups #64

Dekker1 opened this issue Sep 17, 2021 · 6 comments
Labels
bug Something isn't working feature New feature or request

Comments

@Dekker1
Copy link

Dekker1 commented Sep 17, 2021

The latest alpha release of Poetry (1.12.0a2) supports the usage of depedency groups, added by this PR. For my use case these groups are able to resolve solve problems within my CI setup, but they do not work with the current version of tox-poetry-installer. My question is thus wether this feature will be supported in the future.

Trying to debug this issue myself I found that imports from the poetry-core package no longer work, but they are easily fixed:

Click to view patch
diff --git a/tests/fixtures.py b/tests/fixtures.py
index 8d0b142..f807d9e 100644
--- a/tests/fixtures.py
+++ b/tests/fixtures.py
@@ -7,7 +7,7 @@ import poetry.installation.pip_installer
 import poetry.utils.env
 import pytest
 import tox
-from poetry.core.packages import Package as PoetryPackage
+from poetry.core.packages.package import Package as PoetryPackage
 
 from tox_poetry_installer import utilities
 
diff --git a/tox_poetry_installer/datatypes.py b/tox_poetry_installer/datatypes.py
index 4233a94..34f8a2e 100644
--- a/tox_poetry_installer/datatypes.py
+++ b/tox_poetry_installer/datatypes.py
@@ -1,7 +1,7 @@
 """Definitions for typehints/containers used by the plugin"""
 from typing import Dict
 
-from poetry.core.packages import Package as PoetryPackage
+from poetry.core.packages.package import Package as PoetryPackage
 
 
 # Map of package names to the package object
diff --git a/tox_poetry_installer/installer.py b/tox_poetry_installer/installer.py
index bbde07f..c29b3c1 100644
--- a/tox_poetry_installer/installer.py
+++ b/tox_poetry_installer/installer.py
@@ -8,7 +8,7 @@ import typing
 from typing import Sequence
 from typing import Set
 
-from poetry.core.packages import Package as PoetryPackage
+from poetry.core.packages.package import Package as PoetryPackage
 from tox.venv import VirtualEnv as ToxVirtualEnv
 
 from tox_poetry_installer import logger
diff --git a/tox_poetry_installer/utilities.py b/tox_poetry_installer/utilities.py
index 87e1d98..3ce4c5b 100644
--- a/tox_poetry_installer/utilities.py
+++ b/tox_poetry_installer/utilities.py
@@ -9,8 +9,8 @@ from typing import Sequence
 from typing import Set
 from typing import Union
 
-from poetry.core.packages import Dependency as PoetryDependency
-from poetry.core.packages import Package as PoetryPackage
+from poetry.core.packages.dependency import Dependency as PoetryDependency
+from poetry.core.packages.package import Package as PoetryPackage
 from tox.action import Action as ToxAction
 from tox.venv import VirtualEnv as ToxVirtualEnv

However, when this issue is resolved I still run into the following exception which prohibits the use of this package:

No version of Poetry could be imported under the current environment for '<poetry-venv>'
@enpaul enpaul added feature New feature or request question Further information is requested labels Sep 17, 2021
@enpaul
Copy link
Owner

enpaul commented Sep 17, 2021

Hello! Yes, dependency groups are one of my personal most anticipated features in Poetry 1.2 and this plugin will absolutely include support for them once a stable 1.2 is released. I was planning to start work on an implementation once 1.2 entered beta.

As for the import problem you noticed, is this using a currently released version of poetry/poetry core or an alpha/beta version?

@Dekker1
Copy link
Author

Dekker1 commented Sep 18, 2021

The import problem is just when switching over the the alpha poetry build (I thought I should just try it and see what happens with this package). It looks like the accompanying alpha build of poetry-core no longer allows imports directly from the poetry.core.packages path (caused by this PR). Importing directly from the individual files seems to resolve this though (and it seems to work correctly with the current version of poetry-core as well).

The patch resolves the import problems, but then still does not seems to correctly load poetry, and since I don't have a lot of knowledge of the internals of poetry I couldn't take this any further. Great to hear that this will be supported though!

@enpaul enpaul added bug Something isn't working and removed question Further information is requested labels Sep 18, 2021
@tasansal
Copy link

tasansal commented Mar 5, 2022

Any luck with this? I just switched to the Poetry 1.2 version but can't run tox tests.

Would be interested in a workaround too!

Thanks for the support!

@enpaul
Copy link
Owner

enpaul commented Mar 9, 2022

@tasansal Sorry, I haven't had the time to work on this feature yet. I'm hoping to have some time to work on this in the next few weeks.

I'd also be happy to accept a PR for this feature. I'll try to pull some thoughts together on how I think it should be implemented so if someone wants to PR the change they have something to go off of.

@oshmoun
Copy link
Contributor

oshmoun commented Sep 15, 2022

I'd also be happy to accept a PR for this feature. I'll try to pull some thoughts together on how I think it should be implemented so if someone wants to PR the change they have something to go off of.

PR #76 should add support for this, though I'm not sure if it is in-line with how support for Poetry groups was planned to be implemented. Please let me know if you would like it done differently.

@enpaul
Copy link
Owner

enpaul commented Feb 24, 2023

@oshmoun I believe this issue is resolved now with the release of 0.10.0 (thanks!) I've closed it for now, but please feel free to reopen it if there's more work to be done here.

@enpaul enpaul closed this as completed Feb 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working feature New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants