cli*_*120 13 python python-poetry
我有 2 个项目,结构如下:
/abc-lib
/ abc
/ __init__.py
/ main.py
/ pyproject.toml
/abc-web-api
/ src
/ __init__.py
/ main.py
/ pyproject.toml
Run Code Online (Sandbox Code Playgroud)
我尝试将其abc-lib作为依赖项包含在 中abc-web-api,因此具有abc-web-api/pyproject.toml如下所示:
[tool.poetry]
name = "abc-web-api"
version = "0.0.1"
description = "Some description."
authors = ["Someone <someone@example.com>"]
repository = "https://github.com/someone/abc-web-api"
readme = "README.md"
[tool.poetry.scripts]
serve = "src.main:app"
[tool.poetry.dependencies]
python = "~3.6.8"
abc-lib = { path="../abc-lib" }
[tool.poetry.dev-dependencies]
pytest = "^3.10.1"
yapf = "^0.30.0"
flake8 = "^3.8.3"
[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"
Run Code Online (Sandbox Code Playgroud)
当我执行时poetry install,我收到以下消息:
Package operations: 1 installs, 0 updates, 0 removals
- Installing abc-lib (1.0.0 ../abc-lib)
[ModuleOrPackageNotFound]
No file/folder found for package abc-lib
Run Code Online (Sandbox Code Playgroud)
“安装”语句中显示的版本号是正确的,所以我对 的含义很困惑[ModuleOrPackageNotFound]。
有谁知道我该如何解决它?谢谢
fin*_*mer 11
您的文件夹结构看起来有点奇怪。看起来您更喜欢“src”变体。所以我建议如下:
\n./\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 abc-lib\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 pyproject.toml\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 src\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 abc_lib\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 __init__.py\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 main.py\n\xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 abc-web-api\n \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 pyproject.toml\n \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 src\n \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 abc_web_api\n \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 __init__.py\n \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 main.py\nRun Code Online (Sandbox Code Playgroud)\npyproject.toml有了这个abc-lib:
[tool.poetry]\nname = "abc-lib"\nversion = "0.1.0"\ndescription = ""\nauthors = ["Someone <someone@example.com>"]\n\n\n[tool.poetry.dependencies]\npython = "^3.6"\n\n[tool.poetry.dev-dependencies]\n\n[build-system]\nrequires = ["poetry>=1.0"]\nbuild-backend = "poetry.masonry.api"\nRun Code Online (Sandbox Code Playgroud)\n这在abc-web-api:
[tool.poetry]\nname = "abc-web-api"\nversion = "0.1.0"\ndescription = ""\nauthors = ["Someone <someone@example.com>"]\n\n\n[tool.poetry.dependencies]\npython = "^3.6"\nabc-lib = {path = "../abc-lib"}\n\n[tool.poetry.dev-dependencies]\n\n[build-system]\nrequires = ["poetry>=1.0"]\nbuild-backend = "poetry.masonry.api"\nRun Code Online (Sandbox Code Playgroud)\n