在站点包中包含子目录文件时出现问题
Trouble including sub-directory files in site-packages
我有一个开发包设置如下:
\polygonselector
\polygonselector
__init__.py
\notebooks
PolygonSelector.ipynb
.gitignore
LICENSE
MANIFEST.in
README.md
setup.py
我正在尝试密切关注 these instructions and the information in this question and this question,以便将 Jupyter notebook(在 notebooks
目录中)文件作为 python 包的一部分。然而,我一直未能成功。
MANIFEST.in 文件如下所示:
recursive-include notebooks *
我的 setup.py
文件中也有 include_package_data=True
行。
这里是repository link;我已经进行了十多次提交,试图让它发挥作用,包括尝试将 notebooks
目录置于目录结构的顶部。
但是无论我做什么,当我从存储库 pip 安装时,notebooks
目录都没有包含在 Lib\site-packages directory
.
如果要将子目录 notebooks
安装在 Lib\site-packages
中:
更改MANIFEST.in
:
recursive-include notebooks *
更改setup.py
:
# include_package_data=True,
package_data={'polygonselector': ['../notebooks/*']},
要安装到 Lib\site-packages\polygonselector
:
git mv notebooks polygonselector
更改MANIFEST.in
:
recursive-include polygonselector/notebooks *
setup.py
对于这种情况是可以的。
我有一个开发包设置如下:
\polygonselector
\polygonselector
__init__.py
\notebooks
PolygonSelector.ipynb
.gitignore
LICENSE
MANIFEST.in
README.md
setup.py
我正在尝试密切关注 these instructions and the information in this question and this question,以便将 Jupyter notebook(在 notebooks
目录中)文件作为 python 包的一部分。然而,我一直未能成功。
MANIFEST.in 文件如下所示:
recursive-include notebooks *
我的 setup.py
文件中也有 include_package_data=True
行。
这里是repository link;我已经进行了十多次提交,试图让它发挥作用,包括尝试将 notebooks
目录置于目录结构的顶部。
但是无论我做什么,当我从存储库 pip 安装时,notebooks
目录都没有包含在 Lib\site-packages directory
.
如果要将子目录 notebooks
安装在 Lib\site-packages
中:
更改MANIFEST.in
:
recursive-include notebooks *
更改setup.py
:
# include_package_data=True,
package_data={'polygonselector': ['../notebooks/*']},
要安装到 Lib\site-packages\polygonselector
:
git mv notebooks polygonselector
更改MANIFEST.in
:
recursive-include polygonselector/notebooks *
setup.py
对于这种情况是可以的。