【问题标题】:Pants exclude specific Python dependencies裤子排除特定的 Python 依赖项
【发布时间】:2020-01-30 20:59:55
【问题描述】:

目前,我正在使用pants 来构建和测试我们的python2.7 包。在 pytests 目标完成后,我们开始在运行目标期间注意到以下错误。我尝试添加 constraints.txt 文件以排除它抱怨的依赖项,但错误不会停止。有没有办法在裤子构建步骤中排除这些依赖关系?

./pants test.pytest --coverage=auto tests/python/abcd/test/xyz 

[pytest]
[cache] 
No cached artifacts for 1 target.
Invalidated 1 target.
[run]
Failed to execute PEX file, missing compatible dependencies for:
 importlib-metadata
 zipp

No .coverage file was found! Skipping coverage reporting.
                   tests/python/abcd/test/xyz                                      .....   SUCCESS

FAILURE

【问题讨论】:

    标签: python-2.7 pants


    【解决方案1】:

    你可以尝试增加详细程度:

    PEX_VERBOSE=9 ./pants test.pytest --coverage=auto tests/python/abcd/test/xyz
    

    然后在这里回复?

    此错误可能由多种原因引起。您是否在构建 PEX 的同一操作系统上执行 PEX?您是否还在BUILD 文件中的python_binary 函数中包含platforms=[...]

    【讨论】:

    • 这里是 PEX 社区中报告的带有详细堆栈跟踪的问题 - github.com/pantsbuild/pex/issues/871,不幸的是,PEX 详细信息超出了启动 ackoverflow 限制
    • 在 pytest 期间也发生了错误,而不是在 python 二进制文件中。我尝试了stackoverflow.com/questions/34979100/… 中解释的方法,但没有帮助
    • 您的.pants 文件是否已更改?此错误是在本地发生还是在不同操作系统的 CI 中发生?
    • 没有对裤子的 ini 文件进行任何更改。我们没有添加任何新的依赖项。它突然开始破裂。它发生在 MacOS 和 Linux 环境中
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-03-03
    • 2012-11-14
    • 2021-12-25
    • 1970-01-01
    • 2019-02-12
    • 1970-01-01
    • 2020-04-19
    相关资源
    最近更新 更多