Skip to content

Allow package_data specs/globs to match directories #49552

Closed

Description

@gsakkis
mannequin
BPO 5302
Nosy @birkenfeld, @pitrou, @larryhastings, @tarekziade, @merwok
Files
  • test_sdist.diff
  • 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 = <Date 2013-08-01.08:23:29.523>
    created_at = <Date 2009-02-17.22:32:13.041>
    labels = ['type-feature']
    title = 'Allow package_data specs/globs to match directories'
    updated_at = <Date 2013-08-01.08:23:29.521>
    user = 'https://bugs.python.org/gsakkis'

    bugs.python.org fields:

    activity = <Date 2013-08-01.08:23:29.521>
    actor = 'larry'
    assignee = 'eric.araujo'
    closed = True
    closed_date = <Date 2013-08-01.08:23:29.523>
    closer = 'larry'
    components = ['Distutils2']
    creation = <Date 2009-02-17.22:32:13.041>
    creator = 'gsakkis'
    dependencies = []
    files = ['23829']
    hgrepos = []
    issue_num = 5302
    keywords = ['patch']
    message_count = 19.0
    messages = ['82378', '82384', '82415', '85383', '103730', '128496', '128509', '148276', '148727', '152746', '154471', '155678', '155902', '163207', '163839', '163842', '163846', '193999', '194035']
    nosy_count = 8.0
    nosy_names = ['georg.brandl', 'gsakkis', 'pitrou', 'larry', 'tarek', 'eric.araujo', 'meatballhat', 'alexis']
    pr_nums = []
    priority = 'high'
    resolution = 'wont fix'
    stage = None
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue5302'
    versions = ['3rd party', 'Python 3.4']

    Activity

    1. gsakkis commented on Feb 17, 2009

      gsakkismannequin
      MannequinAuthor

      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.

    2. added
      stdlibStandard Library Python modules in the Lib/ directory
      on Feb 17, 2009
    3. tarekziade commented on Feb 17, 2009

      tarekziademannequin
      Mannequin

      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

    4. gsakkis commented on Feb 18, 2009

      gsakkismannequin
      MannequinAuthor

      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.

    5. tarekziade commented on Apr 4, 2009

      tarekziademannequin
      Mannequin

      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.

    6. merwok commented on Apr 20, 2010

      @merwok
      Member

      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

    7. removed
      stdlibStandard Library Python modules in the Lib/ directory
      on Apr 20, 2010
    8. alexis commented on Feb 13, 2011

      alexismannequin
      Mannequin

      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)

    9. merwok commented on Feb 13, 2011

      @merwok
      Member

      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.

    10. merwok commented on Nov 24, 2011

      @merwok
      Member

      I need to fix this for distutils2’s next release (with bpo-13463 and bpo-5302), to include distutils2/tests/fake_dists.

    11. changed the title [-]Allow package_data globs match directories[/-] [+]Allow package_data specs/globs to match directories[/+] on Nov 24, 2011
    12. assigned and unassigned on Nov 24, 2011
    13. merwok commented on Dec 1, 2011

      @merwok
      Member

      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?

    14. merwok commented on Feb 6, 2012

      @merwok
      Member

      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.

    15. merwok commented on Feb 27, 2012

      @merwok
      Member

      For consistency with the resources section, a recursive glob should be mydata/**, not mydata/* or bare mydata.

    16. merwok commented on Mar 13, 2012

      @merwok
      Member

      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.

    17. alexis commented on Mar 15, 2012

      alexismannequin
      Mannequin

      Agreed on this one. That would avoid to have a new syntax for this
      case, which seems to be very common.

    18. birkenfeld commented on Jun 19, 2012

      @birkenfeld
      Member

      Does this block 3.3b1?

    19. pitrou commented on Jun 24, 2012

      @pitrou
      Member

      Cannot block a release anymore, since packaging has gone.

    20. merwok commented on Jun 24, 2012

      @merwok
      Member

      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.

    21. pitrou commented on Jun 24, 2012

      @pitrou
      Member

      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.

    22. merwok commented on Jul 31, 2013

      @merwok
      Member

      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.

    23. larryhastings commented on Aug 1, 2013

      @larryhastings
      Contributor

      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.

    24. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    Labels

    type-featureA feature request or enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions