You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Allow package_data specs/globs to match directories #49552
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee='https://github.com/merwok'closed_at=<Date2013-08-01.08:23:29.523>created_at=<Date2009-02-17.22:32:13.041>labels= ['type-feature']
title='Allow package_data specs/globs to match directories'updated_at=<Date2013-08-01.08:23:29.521>user='https://bugs.python.org/gsakkis'
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.
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
gsakkis commented on Feb 18, 2009
gsakkismannequin
MannequinAuthor
More actions
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.
tarekziade commented on Apr 4, 2009
tarekziademannequin
Mannequin
More actions
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.
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?
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.
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.
alexis commented on Mar 15, 2012
alexismannequin
Mannequin
More actions
Agreed on this one. That would avoid to have a new syntax for this
case, which seems to be very common.
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.
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.
Activity
gsakkis commentedon Feb 17, 2009
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.
tarekziade commentedon Feb 17, 2009
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
gsakkis commentedon Feb 18, 2009
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.
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.
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.
tarekziade commentedon Apr 4, 2009
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.
merwok commentedon Apr 20, 2010
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
alexis commentedon Feb 13, 2011
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)
merwok commentedon Feb 13, 2011
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.
merwok commentedon Nov 24, 2011
I need to fix this for distutils2’s next release (with bpo-13463 and bpo-5302), to include distutils2/tests/fake_dists.
[-]Allow package_data globs match directories[/-][+]Allow package_data specs/globs to match directories[/+]merwok commentedon Dec 1, 2011
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?
merwok commentedon Feb 6, 2012
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.
merwok commentedon Feb 27, 2012
For consistency with the resources section, a recursive glob should be mydata/**, not mydata/* or bare mydata.
merwok commentedon Mar 13, 2012
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.
alexis commentedon Mar 15, 2012
Agreed on this one. That would avoid to have a new syntax for this
case, which seems to be very common.
birkenfeld commentedon Jun 19, 2012
Does this block 3.3b1?
pitrou commentedon Jun 24, 2012
Cannot block a release anymore, since packaging has gone.
merwok commentedon Jun 24, 2012
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.
pitrou commentedon Jun 24, 2012
Woops, sorry.
merwok commentedon Jul 31, 2013
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.
larryhastings commentedon Aug 1, 2013
And this will hold up Python 3.4a1, as I can't close bpo-13463 until this is closed first. So I'm closing this as wontfix.