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.

package_data not doing recursive glob calls

See original GitHub issue

Even though glob supports it, glob support for recursive ** searching is not enabled when specifying package_data. This is not clear in the documentation.

https://github.com/pypa/setuptools/blob/a94ccbf404a79d56f9b171024dee361de9a948da/setuptools/command/build_py.py#L106

This means that only single * searches in a specific directory are supported. By changing the glob function to support recursive, this would allow us to specify ** patterns to a directory instead of having to specify every sub-directory in the structure.

Reference: https://github.com/python/cpython/blob/master/Lib/glob.py#L18

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:22
  • Comments:13 (4 by maintainers)

github_iconTop GitHub Comments

12reactions
JaapJoriscommented, Nov 20, 2019

Agreed, it would be massively helpful if I could use the ** glob in setup.py’s package_data. I deploy Django apps which include many templates in potentially endless subdirectories. There is no glob pattern except **/*.html to describe their paths.

1reaction
thenewguycommented, May 30, 2020

I just found this issue working with Django templates as well. Recursive glob support would be tremendously helpful when packaging Django apps that include templates

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to add package data recursively in Python setup.py?
The problem with the glob answer is that it only does so much. I.e. it's not fully recursive. The problem with the copy_tree...
Read more >
Using Package Data in Python Projects with Setuptools
These files are called package data, and this article describes how to include them in & access them from your project.
Read more >
Data Files Support - Setuptools - Python Packaging Authority
Glob patterns do not automatically match dotfiles (directory or file names ... if the setup.py package_data list is updated before calling setup.py ....
Read more >
Including files in source distributions with MANIFEST.in
Adding & removing files to & from the source distribution is done by writing a MANIFEST.in file at the project root. How files...
Read more >
Recursive glob? - Unix & Linux Stack Exchange
In order to do recursive globs in bash, you need the globstar feature from Bash version 4 or higher. From the Bash documentation:...
Read more >

github_iconTop Related Medium Post

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