[Distutils] Package a project

Paul Moore p.f.moore at gmail.com
Mon Dec 2 14:59:10 CET 2013


On 2 December 2013 07:53, Imran M Yousuf <imran at smitsol.com> wrote:
> Hi,
>
> I am new to setuptools. I am using it to build and package a project
> of mine. Currently if I execute `python setup.py bdist` it generates a
> tarball with all files located in paths
> './abs/path/to/project/bin/[entry points]' and
> './abs/path/to/project/lib/python-2.7/site-packages/[rest of the
> sources]'. This does not seem to be logical :(, I would rather want
> the binary distribution to be structure -
> './project-name/bin/' and './project-name/lib/'.
>
> Can some please advise me how to achieve it? I am using VirtualEnv for
> development of this project and its setup.py looks like -
>
> from setuptools import setup, find_packages
>
> setup(name='project-name',
>       version='1.0',
>       description='Description',
>       author='Imran M Yousuf',
>       author_email='imran at smitsol.com',
>       url='http://www.smitsol.com',
>       install_requires = ['setuptools', 'pycrypto==2.6'],
>       packages=find_packages('src', ["tests"]),
>           package_dir={'': 'src'},
>           test_suite="tests",
>       entry_points={
>           'console_scripts': ['manager=client.manager:main']
>       }
>      )

Install the wheel project and use bdist_wheel instead of a simple
bdist. Also, use the sdist (source distribution) command to create a
source package (that needs a compiler to build). Binary packages are
only compatible with the platform/Python version they are built on, so
you may want to make multiple wheels, depending on what platforms you
are targeting.

>From what you provide, I'm not 100% sure if you have C code in your
project, actually. If you don't, then a sdist is sufficient - although
a wheel might be worth uploading as well (pure Python wheels are
cross-platform).

The plain bdist command produces a "dumb" binary distribution, which
is obsolete, and frankly useless.
Paul


More information about the Distutils-SIG mailing list