11

I want to install my project as a folder instead of .egg file. So I have used zip_safe= False inside setup function in setup.py file

But when I am running this my project is getting installed as .egg file instead of a directory inside /Library/Python/2.7/site-packages. Below is my setup.py file

from setuptools import setup, find_packages

setup(name = "my-project",
    version = "0.1",
    description = "Python version of my-project",
    author = "Priyal Jain",
    author_email = "jpriyal@gmail.com",
    license="Apache 2.0",
    keywords="Python my project",
    package_dir={'': 'lib'},
    #packages=find_packages('lib'),
    packages= ['abc','pqr'],
    package_data={
        'abc.sample': ['*.yml']
    },
    zip_safe= False,
    scripts = ["abc"],
    classifiers=[
        'Environment :: Console',
        'Intended Audience :: Developers',
        'Intended Audience :: Information Technology',
        'Intended Audience :: System Administrators',
        'Intended Audience :: Telecommunications Industry',
        'Operating System :: OS Independent',
        'Programming Language :: Python',
    ],
) 

Am I missing anything?? Is there some other way to install python project as a directory instead of .egg files

yamm
  • 1,523
  • 1
  • 15
  • 25
pjain
  • 663
  • 10
  • 21

1 Answers1

-2

Package installation

You first have to build the package.

# navigate into your python-package (where the setup.py is located)
python setup.py sdist

This will create a dist/ dicretory and creates a .tar.gz file

Then you install that package with pip

pip install dist/<your-packagename>

egg installation

If you use:

python setup.py install

It will be installed as an egg.

Edit:

Download package

basic way: you build you package --> .tar.gz or .zip and you unzip the package on the location you need. You get 0 benefits from python packaging.

Python package that installs a script eg. CLI

docu

add the scripts argument to your setup()

setup(
    # ...
    scripts = ['path-to/myscrypt',],
)

you file with the name myscript (without .py ending) should have this in the first line

#!/usr/bin/env python
yamm
  • 1,523
  • 1
  • 15
  • 25
  • I want to make script executable, so that I can run it from command line. But if I am running by making dist folder, then it is putting complete file in /usr/local/bin instead of compiled file. – pjain Mar 12 '15 at 11:34
  • ok i did not understand your question ;-) you want a package that installs a script. https://github.com/arteria/virtualenv-mgr/blob/master/setup.py#L21 i edit my post – yamm Mar 12 '15 at 12:23
  • 2
    I think this answer does not match to the question which is "Is there some other way to install python project as a directory instead of .egg files" – guettli Mar 06 '16 at 16:35