Joff
Joff

Reputation: 12177

pypi package isn't installing with all the files?

I am writing my first package to be shared on the pypi database...

It took me a lot of fiddling to get everything to package correctly, but I finally did.

I have a structure like this.

---dist
---package.egg-info
---MANIFEST.in
---setup.py
---package/
   ---__init__.py
   ---file.py
   ---info.txt
   ---templates/
      ---template.html

now in my dist folder when I extract the tar.gz file I see everything. but when I run a pip install package then I only get the egg and the init.py and file.py files and not the other text files and template files.

Why is this?

Setup.py added...:

setup(name='django-g-recaptcha',
      version='0.1.2',
      description='Django view decorator to validate google recaptcha forms',
      url='https://bitbucket.org/deltaskelta/django-g-recaptcha-validate/overview',
      author='Jeff Willette',
      author_email='[email protected]',
      keywords = ['django', 'recaptcha', 'catpcha'],
      packages = ['g_recaptcha',],
)

Upvotes: 2

Views: 164

Answers (1)

Nikita
Nikita

Reputation: 6331

Add include_package_data = True to setup() arguments:

setup(name='django-g-recaptcha',
      version='0.1.2',
      description='Django view decorator to validate google recaptcha forms',
      url='https://bitbucket.org/deltaskelta/django-g-recaptcha-validate/overview',
      author='Jeff Willette',
      author_email='[email protected]',
      keywords = ['django', 'recaptcha', 'catpcha'],
      packages = ['g_recaptcha',],
      include_package_data = True
)

This should help, however I suggest to also use package_data along with your MANIFEST.in. And also you might want to add a setting specifying, that your package is intended to be used with Django.

See https://pythonhosted.org/setuptools/setuptools.html for more information.

Upvotes: 2

Related Questions