Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I include non-.py files in PyPI?

I am a newb to PyPI...so let me qualify with that. I am trying to put a package on PyPI but having a bit of trouble when I try to install it with pip. When I upload the file to PyPI, I get a warning (but the setup.py script finishes with not fatal errors and a 200 status):

'my_package/static/my_folder' not a regular file -- skipping

And then when I go to install it in pip, I get an error:

"error: can't copy 'my_package/static/my_folder': doesn't exist or not a regular file. 

From other answers on SO, I've tried changing up my MANIFEST.in and my setup.py files, with no luck. Here is my current MANIFEST.in:

recursive-include my_package *.css *.js *.jinja2

and setup.py:

try:
    from setuptools import setup, find_packages
except ImportError:
    from distutils.core import setup, find_packages

setup(
    name='my_package',
    packages=find_packages(),
    include_package_data=True,
    platforms='any',
    version='1.0',
    description='my_description',
    license='MIT',
    author='Me',
    author_email='[email protected]',
    install_requires=[
        'Flask',
        'Jinja2',
        'requests',
    ],
    url='http://www.example.com',
    download_url='https://github.com/me/my_package/tarball/1.0',
    classifiers=[
        'License :: OSI Approved :: MIT License',
    ],
)

EDIT: I've also tried leaving out the MANIFEST.in file just to see if that was messing anything up but I get the same result.

like image 634
user_78361084 Avatar asked Apr 23 '14 18:04

user_78361084


1 Answers

(Reposted from the comment on request.)

Your setup script and MANIFEST.in should work. To prove this with a minimal example:

my_project/
    my_package/
        static/
            a.css
        __init__.py
    MANIFEST.in
    setup.py

Run python setup.py sdist and you'll find that both static/a.css and __init__.py are bundled in the tar.gz package.

like image 177
uranusjr Avatar answered Oct 01 '22 04:10

uranusjr