How to upload a pristine Python package to PyPI?

前端 未结 1 1817
广开言路
广开言路 2021-02-20 16:39

What\'s the magic \"python setup.py some_incantation_here\" command to upload a package to PyPI, in a form that can be downloaded to get the original package in its

相关标签:
1条回答
  • 2021-02-20 17:28

    When you perform an "sdist" command, then what controls the list of included files is your "MANIFEST.in" file sitting next to "setup.py", not whatever you have listed in "package_data". This has something to do with the schizophrenic nature of the Python packaging solutions today; "sdist" is powered by the distutils in the standard library, while "bdist_egg" is controlled by the setuptools module.

    To solve the problem, try creating a MANIFEST.in next to your setup.py file, and give it contents like this:

    include *.jpg
    

    Of course, I'm imaging that your "image files" are actual pictures rather than disk images or ISO images or something; you might have to adjust the above line if I've guessed wrong! But check out the Specifying which files to distribute section of the distutils docs, and see whether you can't get those files appearing in your .tar.gz source distribution! Good luck.

    0 讨论(0)
提交回复
热议问题