如何使 toxenv 无效。

huangapple go评论64阅读模式
英文:

how to invalidate toxenv

问题

我有一些 tox 项目,在 install-deps 阶段处理一些 protobuf 并输出一些 *pb.py 编解码器(作为配置中 install_command 选项执行的自定义脚本)。当我更新工作区(并且更新了 protobuf 文件)时,我希望以某种方式标记 toxenv 为无效状态,这样它将在稍后的 tox 调用中 无需传递 -r, --recreate 标志 而重新创建。我可以将这样的操作添加到执行环境更新的脚本中。有什么方法可以做到吗?
我正在使用一些较旧的 tox - 3.14

英文:

I have some tox project that processes some protobuf in the install-deps phase and outputs some *pb.py codecs (custom script executed as install_command option in the config). When I'm updating my workspace (and the protobuf files are updated), i would like to somehow mark the toxenv as invalid - so that it would get recreated without the need of passing -r, --recreate flags to some later tox call. I could add such action the the script that does the env update. Any idea on how to do it?
i'm using some older tox - 3.14

答案1

得分: 0

以下是您要翻译的内容:

"turns out its described quite verbosly in the doc:
https://tox.wiki/en/3.14.6/example/general.html?highlight=recreate#dependency-changes-and-tracking

> Here’s what traits we track at the moment for each steps:
> * virtual environment trait is tied to the python path the basepython resolves too (if this config changes, the virtual environment will be recreated),
> * deps sections changes (meaning any string-level change for the entries, note requirement file content changes are not tracked),
> * library dependencies are tracked at extras level (because there’s no Python API to enquire about the actual dependencies in a non-tool specific way, e.g. setuptools has one way, flit something else, and poetry another).

Also from what i looked into tox code, here are the attributes that are checked
https://tox.wiki/en/3.14.6/_modules/tox/venv.html?highlight=matches_with_reason

  • base_resolved_python_sha256
  • base_resolved_python_path
  • tox_version
  • sitepackages
  • usedevelop
  • alwayscopy

Apart from that, the first and most obvious way is to simply remove the <toxworkdir> dir on the env update. Other possibility can be to remove/rename the <toxenvdir>/.tox-config1 file."

英文:

turns out its described quite verbosly in the doc:
https://tox.wiki/en/3.14.6/example/general.html?highlight=recreate#dependency-changes-and-tracking

> Here’s what traits we track at the moment for each steps:
> * virtual environment trait is tied to the python path the basepython resolves too (if this config changes, the virtual environment will be recreated),
> * deps sections changes (meaning any string-level change for the entries, note requirement file content changes are not tracked),
> * library dependencies are tracked at extras level (because there’s no Python API to enquire about the actual dependencies in a non-tool specific way, e.g. setuptools has one way, flit something else, and poetry another).

Also from what i looked into tox code, here are the attributes that are checked
https://tox.wiki/en/3.14.6/_modules/tox/venv.html?highlight=matches_with_reason

  • base_resolved_python_sha256
  • base_resolved_python_path
  • tox_version
  • sitepackages
  • usedevelop
  • alwayscopy

Apart from that, the first and most obvious way is to simply remove the <toxworkdir> dir on the env update. Other possibility can be to remove/rename the <toxenvdir>/.tox-config1 file.

huangapple
  • 本文由 发表于 2023年2月6日 22:06:53
  • 转载请务必保留本文链接:https://go.coder-hub.com/75362373.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定