无法使用 Poetry 在父文件夹中指定依赖项

Cannot specify dependency in parent folder with Poetry

我有以下文件层次结构:

./
├── abc
│   ├── pyproject.toml
│   ├── main.py
│   └── xyz 
│      ├── __init__.py
│      └── other.py
└── common-lib
    ├── pyproject.toml
    └── common
        ├── __init__.py
        └── lib1.py

abcpyproject.toml 文件中,无论我如何尝试,我似乎都无法将 common-lib 添加为依赖项。一个例子如下。我查了很多类似的问题。

[tool.poetry]
packages = [{ include = "common", from = "common-lib" }]
[tool.poetry.dependencies]
common-lib = { path = "../common-lib", develop=true}

我收到以下错误。

Updating dependencies
Resolving dependencies...

Package operations: 1 install, 0 updates, 0 removals

  • Installing common-lib (0.1.0 somePath/common-lib)

  ModuleOrPackageNotFound

  No file/folder found for package common-lib

  at ~\AppData\Roaming\Python\Python310\site-packages\poetry\core\masonry\utils\module.py:63 in __init__
       59│                             "from": str(src.relative_to(self._path)),
       60│                         }
       61│                     ]
       62│                 else:
    →  63│                     raise ModuleOrPackageNotFound(
       64│                         "No file/folder found for package {}".format(name)
       65│                     )
       66│
       67│         for package in packages:

你能帮我解决这个问题吗?

我设法通过 pyproject.toml 中的以下设置解决了问题。

[tool.poetry]
packages = [{ include = "common", from = "../common-lib"}]
[tool.poetry.dependencies]
common-lib = "../common-lib"