Berislav Lopac
Berislav Lopac

Reputation: 17273

Python setuptools: a package not installed even when found through find_packages

I'm trying to build a package having the following structure:

main-dir/
    setup.py
    package/
        __init__.py
        bar/
            __init__.py
        baz/
            __init__.py
    package_foo/
        __init__.py
        boo/
            __init__.py

Using find_packages() in setup.py I get the correct list of packages, something like:

[
    'package',
    'package.bar',
    'package.baz',
    'package_foo',
    'package_foo.boo',
]

However, when I install the package, I only get package installed in the site-packages directory, and package_bar is nowhere in sight. Even more strange, if I rename the package dir (to, say, packagee), it doesn't get installed too.

Just to be clear, I'm trying to get both package and package_foo installed on the top level of site-packages, like this:

import package
import package_foo

Any suggestions which route to go?

UPDATE: I need to clarify that the issue happens only when I upload the package to a devpi server I run locally; a python setup.py build correctly creates both packages in the build/lib.linux-x86_64-2.7/ directory.

Upvotes: 2

Views: 329

Answers (1)

Berislav Lopac
Berislav Lopac

Reputation: 17273

OK, I've managed to figure out the issue: it turns out that devpi upload by default uses any versioning control system it finds in the package, and builds the distribution from there. Since my changes were not yet committed it kept building from the old code, which didn't include the package_foo directory. Luckily an option to ignore versioning is provided, so the correct command to use is:

devpi upload --no-vcs

Of course, I plan to have the package properly versioned for the final release, but still need to build and upload a distribution during development.

Upvotes: 1

Related Questions