This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Unsupported provider

classification
Title: Allow package_data specs/globs to match directories
Type: enhancement Stage:
Components: Distutils2 Versions: Python 3.4, 3rd party
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: eric.araujo Nosy List: alexis, eric.araujo, georg.brandl, gsakkis, larry, meatballhat, pitrou, tarek
Priority: high Keywords: patch

Created on 2009-02-17 22:32 by gsakkis, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
test_sdist.diff eric.araujo, 2011-12-01 17:03
Messages (19)
msg82378 - (view) Author: George Sakkis (gsakkis) Date: 2009-02-17 22:32
Currently each glob defined in package_data must match files only; if it
matches a directory, it raises an exception later when calling
copy_file(). This means that a glob like 'mydata/*' will fail if there
is any subdirectory under 'mydata'. One simple useful change would be to
allow a glob match a directory and interpret it as a recursive inclusion
of the directory.

A more general feature request (perhaps a separate ticket) would be to
port to setup() the logic currently expressed in MANIFEST.in. In the
long term, MF.in should IMO be deprecated because (a) it's a second file
one has to remember to write and maintain in addition to setup.py (b)
has its own ad-hoc syntax instead of python and (c) overlaps in scope
with package_data and data_files of setup.py. The exact API exposing
MF.in's functionality can be decided after (and if) there is consensus
on deprecating/replacing it.
msg82384 - (view) Author: Tarek Ziadé (tarek) * (Python committer) Date: 2009-02-17 22:48
I am no in favor of MANIFEST.in removal because I find it very
convenient to define what is included in a package  and I rarely use
package_data or data_files. So I am -1 on its deprecation.

That said, having a mechanism to include directory recursively sounds
good. And people using this wouldn't have to maintain a MANIFEST.in.

Overall, I don't see a problem of having both ways.

Maybe some kind of plugin system could be created so people can
implement their own way to get a file list. I am thinking here about
the feature in setuptools that builds the file list using .svn,
so you don't have to define anything at all.

In any case, for the glob in data_files, how do you express this
MANIFEST.in line ?

recursive-include directory/subdir *.py *.txt
msg82415 - (view) Author: George Sakkis (gsakkis) Date: 2009-02-18 13:57
> I am no in favor of MANIFEST.in removal because I find it very
> convenient to define what is included in a package  and I rarely use
> package_data or data_files. 

AFAIK the MANIFEST is used only by sdist; what's the point of including
files in the archive sdist creates if they are not going to be installed
somewhere ? The only case I can think of is temporary files/modules
needed only for the installation.
 
> Maybe some kind of plugin system could be created so people can
> implement their own way to get a file list. I am thinking here about
> the feature in setuptools that builds the file list using .svn,
> so you don't have to define anything at all.

Right, but it's still good to have a shortcut for the common cases
expressed in MANIFEST.in; anything more complex can use the plugin.
 
> In any case, for the glob in data_files, how do you express this
> MANIFEST.in line ?
> 
> recursive-include directory/subdir *.py *.txt

Currently I don't; that requires a modification (or extension) of the
API, for example instead of a flat list of globs, expect a list of (dir,
globs, recursive) tuples. For convenience we could define an adaptor
function "def match(dir=None, globs=('*',), recursive=True)" to create
the triples from the provided args.
msg85383 - (view) Author: Tarek Ziadé (tarek) * (Python committer) Date: 2009-04-04 08:27
After some discussion at Pycon, I was convinced that MANIFEST.in should
be removed.

I'll send a mail about this in Distutils-SIG and if there's a consensus,
I'll deprecate it and also add glob pattern for package_data.
msg103730 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2010-04-20 15:54
Hello

Tarek, could you briefly explain the arguments that convinced you?

If MANIFEST.in is removed, perhaps we could use convention instead of configuration to categorize files, like what DistutilsExtra does: http://bazaar.launchpad.net/~python-distutils-extra-hackers/python-distutils-extra/debian/annotate/head%3A/doc/README#L42

(Changing component and versions since Distutils is frozen)

Regards
msg128496 - (view) Author: Alexis Metaireau (alexis) * (Python triager) Date: 2011-02-13 14:19
The MANIFEST.in is definitely gone in distutils2. 

Can we close that? (don't have the rights to do so ‑ it can be handy on distutils2 bugs)
msg128509 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-02-13 15:40
Even if MANIFEST.in is gone, we still have a way to include files, so the request to allow globs to match directories still apply.
msg148276 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-11-24 16:33
I need to fix this for distutils2’s next release (with #13463 and #5302), to include distutils2/tests/fake_dists.
msg148727 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-12-01 17:03
As a first step for this, I moved around some things in the test file to ease coming additions.  Can someone test this patch for the distutils2 repo on Windows?
msg152746 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2012-02-06 16:55
One implementation by George Sakkis is found in this thread: http://bugs.python.org/issue2279#msg82213

There are subtle issues with this feature.  For example, a glob pattern could match both package data files and Python submodules, leading to the same .py files being included as modules and data.  I’ll see how far I want to specify the behavior in tests and docs.
msg154471 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2012-02-27 12:28
For consistency with the resources section, a recursive glob should be mydata/**, not mydata/* or bare mydata.
msg155678 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2012-03-13 22:07
Or on the contrary, we could remove the special, not-supported-by-other-parts-of-the-stdlib ** syntax and just expand somedir to match all files in subdir and descendents, in package_data and resources.  I’ll make a patch for this idea to see how it looks.
msg155902 - (view) Author: Alexis Metaireau (alexis) * (Python triager) Date: 2012-03-15 16:22
Agreed on this one. That would avoid to have a new syntax for this 
case, which seems to be very common.
msg163207 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2012-06-19 20:10
Does this block 3.3b1?
msg163839 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2012-06-24 20:08
Cannot block a release anymore, since packaging has gone.
msg163842 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2012-06-24 20:17
I explained in another issue that I had been using priority release blocker + version third-party to keep track of distutils2 release blockers.  This can be distracting for CPython devs and RMs so I’ll just use high now.
msg163846 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2012-06-24 20:24
> I explained in another issue that I had been using priority release
> blocker + version third-party to keep track of distutils2 release
> blockers.  This can be distracting for CPython devs and RMs so I’ll
> just use high now.

Woops, sorry.
msg193999 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2013-07-31 14:31
packaging is not in the stdlib anymore, and the successors to distutils2 may or may not use package_data in setup.cfg.  This is obsolete.
msg194035 - (view) Author: Larry Hastings (larry) * (Python committer) Date: 2013-08-01 08:23
And this will hold up Python 3.4a1, as I can't close #13463 until this is closed first.  So I'm closing this as wontfix.
History
Date User Action Args
2022-04-11 14:56:45adminsetgithub: 49552
2013-08-01 08:23:29larrysetstatus: open -> closed

nosy: + larry
messages: + msg194035

resolution: wont fix
2013-07-31 14:31:48eric.araujosetmessages: + msg193999
2012-06-24 20:24:44pitrousetmessages: + msg163846
2012-06-24 20:17:06eric.araujosetpriority: normal -> high

messages: + msg163842
2012-06-24 20:08:30pitrousetpriority: release blocker -> normal
nosy: + pitrou
messages: + msg163839

2012-06-21 03:11:00eric.araujosetversions: + Python 3.4, - Python 3.3
2012-06-19 20:10:10georg.brandlsetnosy: + georg.brandl
messages: + msg163207
2012-03-15 16:22:22alexissetmessages: + msg155902
2012-03-13 22:07:30eric.araujosetmessages: + msg155678
2012-02-27 12:28:38eric.araujosetmessages: + msg154471
2012-02-06 16:55:10eric.araujosetmessages: + msg152746
2011-12-01 17:03:09eric.araujosetfiles: + test_sdist.diff
keywords: + patch
messages: + msg148727
2011-11-24 16:34:14eric.araujolinkissue13463 dependencies
2011-11-24 16:33:59eric.araujosetpriority: high -> release blocker
title: Allow package_data globs match directories -> Allow package_data specs/globs to match directories
versions: + Python 3.3
messages: + msg148276

assignee: tarek -> eric.araujo
2011-02-13 15:40:58eric.araujosetnosy: gsakkis, tarek, eric.araujo, meatballhat, alexis
messages: + msg128509
2011-02-13 14:19:34alexissetnosy: + alexis
messages: + msg128496
2010-09-30 02:23:11terry.reedysetnosy: - terry.reedy
2010-09-30 02:19:42eric.araujosetmessages: - msg109658
2010-09-30 02:19:35eric.araujosetmessages: - msg107422
2010-09-30 02:19:18eric.araujosetversions: + 3rd party, - Python 2.6, Python 2.5, Python 3.1, Python 2.7, Python 3.2
2010-07-09 01:22:03terry.reedysetnosy: + terry.reedy
messages: + msg109658
2010-06-09 21:43:06eric.araujosetmessages: + msg107422
versions: + Python 2.6, Python 2.5, Python 3.1, Python 2.7
2010-06-09 21:28:01terry.reedysetversions: - Python 2.6, Python 2.5, Python 3.1, Python 2.7, Python 3.3
2010-05-01 01:51:35meatballhatsetnosy: + meatballhat
2010-04-20 15:54:19eric.araujosetversions: + Python 2.6, Python 2.5, Python 3.2, Python 3.3
nosy: + eric.araujo

messages: + msg103730

components: + Distutils2, - Distutils
2009-04-04 08:27:23tareksetpriority: high

messages: + msg85383
versions: + Python 3.1, Python 2.7
2009-02-18 13:57:13gsakkissetmessages: + msg82415
2009-02-17 22:48:49tareksetmessages: + msg82384
2009-02-17 22:32:13gsakkiscreate