tamasgal
tamasgal

Reputation: 26259

Pip install ignores files in MANIFEST.in - how to structure the project correctly?

I read a lot about this problem but could not find any solution, so I'll ask yet another question about it, since I'm not even sure if I use the correct folder structure for my Python package.

So basically I'm developing an application which uses the Tornado web-server framework and I want to package it, so the users can install it via pip and get access to a basic script to start the web server.

The directory structure is the following:

├── MANIFEST.in
├── README.md
├── config
│   └── default.cfg
├── docs
│   ├── Makefile
│   ├── _build
│   ├── _static
│   ├── _templates
│   ├── conf.py
│   ├── index.rst
├── foopackage
│   ├── __init__.py
│   ├── barmodule.py
│   └── bazmodule.py
├── setup.py
├── static
│   ├── css
│   │   ├── menu.css
│   │   └── main.css
│   ├── img
│   │   └── logo.png
│   ├── js
│   │   ├── ui.js
│   │   └── navigation.js
│   └── lib
│       ├── d3.v3.min.js
│       └── jquery-1.11.0.min.js
└── templates
    ├── index.html
    └── whatever.html

The Python code is as you can see in the package foopackage.

The MANIFEST.in file recursively includes the directories config, static, templates, and docs.

This is my setup.py (only the relevant parts:

from setuptools import setup

setup(name='foo',
      version='0.1.0',
      packages=['foopackage'],
      include_package_data=True,
      install_requires=[
          'tornado>=3.2.2',
      ],
      entry_points={
          'console_scripts': [
              'foo=foopackage.barmodule:main',
          ],
      },
)

If I run python setup.py sdist, everything gets packaged nicely, the docs, templates and config files etc. are included. However, if I run pip install ..., only the foopackage gets installed and everything else is ignored.

How do I include those additional files to the install procedure? Is my directory structure OK? I also read about "faking a package", so putting everything in a directory and touch a __init__.py file, but that seems pretty odd to me :-\

Upvotes: 7

Views: 2569

Answers (1)

tamasgal
tamasgal

Reputation: 26259

I solved the problem by moving the static directory to the actual Python module directory (foopackage). It seems that top level "non-package" folders are ignored otherwise.

Upvotes: 2

Related Questions