不顺利的是在nox会话中安装dev依赖项
我的noxfile.py
如下所示:
import nox
from nox.sessions import Session
from pathlib import Path
__dir__ = Path(__file__).parent.absolute()
@nox.session(python=PYTHON)
def test(session: Session):
session.install(str(__dir__)) # I want to use dev dependency here
session.run("pytest")
如何在nox会话中安装dev依赖项
经过一些尝试和错误,与我在@Yann的回答中的评论相反,似乎
poetry
忽略了nox
传递的VIRTUAL_ENV
变量受Claudio Jolowicz的精彩系列Hypermodern Python的启发,我用以下方法解决了这个问题:
在这里,我只是使用
pip
来安装一个PEP517包不幸的是,通过
pip
安装的PEP517不支持可编辑(“-e”)开关仅供参考:
install_with_constraints
是我从Claudio借用的函数,经过编辑后可在Windows上工作:目前,
session.install
不支持poetry
和install
只支持shell中的runs pip。您可以使用更通用的方法session.run
激活poetry
例如:
当您设置会话时,您可以通过自己禁用python virtualenv(
python=False
)的创建并使用poetry shell
激活poetry
的一个来完成一切我想使用没有诗意的nox会话,所以我使用诗意为
session.install()
生成如下参数:相关问题 更多 >
编程相关推荐