【发布时间】:2021-12-03 15:45:57
【问题描述】:
我希望我的用户能够直接从 shell 引用我的 python 包中的文件(特别是 docker-compose.yml 文件)。
我找不到仅从pip show 获取位置的方法(并且从其输出中 grep-ing 出“位置”感觉很难看),所以我目前(有点冗长)的解决方案是:
docker compose -f $(python3 -c "import locust_plugins; print(locust_plugins.__path__[0])")/timescale/docker-compose.yml up
有没有更好的办法?
编辑:我通过安装一个包装器命令解决了这个问题,我称之为locust-compose 作为包的一部分。不完美,但它可以完成工作:
#!/bin/bash
module_location=$(python3 -c "import locust_plugins; print(locust_plugins.__path__[0])")
set -x
docker compose -f $module_location/timescale/docker-compose.yml "$@"
【问题讨论】:
标签: python docker-compose