Skip to content

Commit 5566f7d

Browse files
committed
factory: prevent circular imports for Poetry
1 parent 7b66b7d commit 5566f7d

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

poetry/core/factory.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
import logging
55

6+
from typing import TYPE_CHECKING
67
from typing import Any
78
from typing import Dict
89
from typing import List
@@ -13,12 +14,15 @@
1314
from .json import validate_object
1415
from .packages.dependency import Dependency
1516
from .packages.project_package import ProjectPackage
16-
from .poetry import Poetry
1717
from .pyproject import PyProjectTOML
1818
from .spdx import license_by_id
1919
from .utils._compat import Path
2020

2121

22+
if TYPE_CHECKING:
23+
from poetry.core.poetry import Poetry # noqa
24+
25+
2226
logger = logging.getLogger(__name__)
2327

2428

@@ -27,7 +31,9 @@ class Factory(object):
2731
Factory class to create various elements needed by Poetry.
2832
"""
2933

30-
def create_poetry(self, cwd=None): # type: (Optional[Path]) -> Poetry
34+
def create_poetry(self, cwd=None): # type: (Optional[Path]) -> "Poetry"
35+
from poetry.core.poetry import Poetry # noqa
36+
3137
poetry_file = self.locate(cwd)
3238
local_config = PyProjectTOML(path=poetry_file).poetry_config
3339

0 commit comments

Comments
 (0)