question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Ignoring package_data when include_package_data is True

See original GitHub issue

Hi, firstly, thanks for the work you maintainers do on this library 😃

I could be incorrect in saying this, but it’s come to my understanding that setting include_package_data=True in setup includes data files specified by MANIFEST.in and only in MANIFEST.in. At the very least, this behaviour is not clearly explained in the docs, and at the worst it is unexpected and implicit behaviour.

Here is a sentence from the docs which seems to be trying to say the above, although elsewhere in the docs include_package_data is not explained in this way:

If using the setuptools-specific include_package_data argument, files specified by package_data will not be automatically added to the manifest unless they are listed in the MANIFEST.in file.

Doesn’t this make package_data redundant when include_package_data is True? Does it really make sense to have a param called include_package_data which implicitly ignores package_data?

In summary, this is the behaviour I seem to have come across when using these options in various combinations:

  1. Including files in package_data with include_package_data=False:
    • Files specified by package_data are included as well as everything in MANIFEST.in.
  2. Including files in package_data with include_package_data=True:
    • Only the files specified by MANIFEST.in are included, files in package_data not specified by MANIFEST.in are excluded.
  3. Omitting package_data with include_package_data=True:
    • Same result as point 2.

I’m sorry if I’ve got this wrong, any correspondence is much appreciated 😃

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:13 (7 by maintainers)

github_iconTop GitHub Comments

6reactions
pgansslecommented, Oct 25, 2018

I tend to agree that the intuitive behavior would either be:

  1. include_package_data + package_data does the union of everything found between the two of them
  2. an error is raised as these are incompatible arguments

My preference would be 1, but that is a backwards-incompatible change that could probably cause all kinds of issues with existing packages, and a shocking number of projects don’t test their packages as installed. I think we can detect if both are specified and switch it over to a warning for a few releases, then an error.

Also, I find include_package_data to be a very misleading name. I suspect we’d be better off deprecating this keyword entirely. It could be replaced with a find_package_data function similar to find_packages. Alternatively (and I like this less), we could do something like add an include_manifest_data or include_manifest_specified_data, which would have the “union of specified package data and manifest data” behavior.

2reactions
healiseucommented, Oct 16, 2019

As a newcomer to the Python packaging world I experienced that confusion first hand

Read more comments on GitHub >

github_iconTop Results From Across the Web

python - How to include package data with setuptools/distutils?
The solution, was simply to remove include_package_data=True . ... See this question: MANIFEST.in ignored on "python setup.py install" - no ...
Read more >
Data Files Support - Setuptools - Python Packaging Authority
For example, consider a scenario where you have include_package_data=True , and you are using a revision control system with an appropriate plugin.
Read more >
Help testing experimental features in setuptools - Packaging
pyproject.toml [tool.setuptools] include-package-data = true ... when I tried building after step 2, my plugin was completely ignored!
Read more >
Building Python Wheel :: CC 410 Textbook
... >=3.9 include-package-data = True [options.package_data] <ourprojectname> ... we may wish to update our git configuration to ignore a few new files or ......
Read more >
Adding Non-Code Files — Python Packaging Tutorial
In order for these files to be copied at install time to the package's folder inside site-packages , you'll need to supply include_package_data=True...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found