'How to interpret the "Package would be ignored" warning generated by setuptools?
I work on several python packages that contain data within them. I add them via the MANIFEST.in file, passing include_package_data=True to setup. For example:
# MANIFEST.in
graft mypackage/plugins
graft mypackage/data
Up to now, this has worked without warnings as far as I know. However, in setuptools 62.3.0, I get the following message:
SetuptoolsDeprecationWarning: Installing 'mypackage.plugins' as data is deprecated, please list it in `packages`.
07:53:53 !!
07:53:53
07:53:53
07:53:53 ############################
07:53:53 # Package would be ignored #
07:53:53 ############################
07:53:53 Python recognizes 'mypackage.plugins' as an importable package, however it is
07:53:53 included in the distribution as "data".
07:53:53 This behavior is likely to change in future versions of setuptools (and
07:53:53 therefore is considered deprecated).
07:53:53
07:53:53 Please make sure that 'mypackage.plugins' is included as a package by using
07:53:53 setuptools' `packages` configuration field or the proper discovery methods
07:53:53 (for example by using `find_namespace_packages(...)`/`find_namespace:`
07:53:53 instead of `find_packages(...)`/`find:`).
07:53:53
07:53:53 You can read more about "package discovery" and "data files" on setuptools
07:53:53 documentation page.
I get the above warning for pretty much every directory within mypackage that contains data and is included by MANIFEST.in.
My goal is to include arbitrary data (which could even include python files in the case of a plugin interface) in a package so that it can be accessed by users who install via wheel or tarball. I would also like that applications built by, e.g., pyinstaller, that pull my package in can easily collect the data with collect_data_files, which for me has worked without any additional setup with the current methodology.
What is the proper way to do this going forward?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
