setuptools里面的package_data有什么用?
What are the usage of package_data which is in the setuptools?
我试图通过参考这个网站来了解它的用途以及我们为什么要使用它:
https://python-packaging.readthedocs.io/en/latest/non-code-files.html
但是我还是没看懂。谁能告诉我更多示例或使用方法。
您指向的文档已过时且相当简洁。最好阅读以下内容:https://setuptools.readthedocs.io/en/latest/setuptools.html#including-data-files
The package_data
argument is a dictionary that maps from package names to lists of glob patterns.
示例:
from setuptools import setup
setup(
...
package_data={
# If any package contains *.txt or *.rst files, include them:
'': ['*.txt', '*.rst'],
# And include any *.msg files found in the 'hello' package, too:
'hello': ['*.msg'],
}
)
我试图通过参考这个网站来了解它的用途以及我们为什么要使用它:
https://python-packaging.readthedocs.io/en/latest/non-code-files.html
但是我还是没看懂。谁能告诉我更多示例或使用方法。
您指向的文档已过时且相当简洁。最好阅读以下内容:https://setuptools.readthedocs.io/en/latest/setuptools.html#including-data-files
The
package_data
argument is a dictionary that maps from package names to lists of glob patterns.
示例:
from setuptools import setup
setup(
...
package_data={
# If any package contains *.txt or *.rst files, include them:
'': ['*.txt', '*.rst'],
# And include any *.msg files found in the 'hello' package, too:
'hello': ['*.msg'],
}
)