问题描述
我正在开发一个 python 项目,该项目使用 pythonnet 和几个 C# dll 作为依赖项。 由于我不想将 dll 推送到 git 存储库,因此我调整了 .gitignore 文件。但是,现在 Poetry 没有将 dll 包含在 python 包中。
有没有办法强制 Poetry 忽略 .gitignore?
解决方法
是的,.gitignore
只是作为 poetry
的包含/排除列表的默认设置。您可以使用 include
字段手动配置它,该字段记录在 here 中。
在您的情况下,您只需要指定要在 gitignore 中排除的 dll 文件夹:
.gitignore
# ...
src/dlls
pyproject.toml
[tool.poetry]
# ...
include = ["src/dlls/*"]
,
只是为了扩展 answer above,对于结构更深的目录,使用 */**
从 Git 忽略的目录中递归添加内容。
pyproject.toml
[tool.poetry]
# other configuration here
include = ["src/extra/*/**"]