How do you add additional files to a wheel?

前端 未结 6 607
北荒
北荒 2020-11-28 21:58

How do control what files are included in a wheel? It appears MANIFEST.in isn\'t used by python setup.py bdist_wheel.

UPDATE

6条回答
  •  时光说笑
    2020-11-28 22:32

    Have you tried using package_data in your setup.py? MANIFEST.in seems targetted for python versions <= 2.6, I'm not sure if higher versions even look at it.

    After exploring https://github.com/pypa/sampleproject, their MANIFEST.in says:

    # If using Python 2.6 or less, then have to include package data, even though
    # it's already declared in setup.py
    include sample/*.dat
    

    which seems to imply this method is outdated. Meanwhile, in setup.py they declare:

    setup(
        name='sample',
        ...
        # If there are data files included in your packages that need to be
        # installed, specify them here.  If using Python 2.6 or less, then these
        # have to be included in MANIFEST.in as well.
        package_data={
            'sample': ['package_data.dat'],
        },
        ...
    )
    

    (I'm not sure why they chose a wildcard in MANIFEST.in and a filename in setup.py. They refer to the same file)

    Which, along with being simpler, again seems to imply that the package_data route is superior to the MANIFEST.in method. Well, unless you have to support 2.6 that is, in which case my prayers go out to you.

提交回复
热议问题