zip_safe = False is not working in setup.py file
Asked Answered
G

1

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 = "[email protected]",
    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

Grazia answered 11/3, 2015 at 12:31 Comment(0)
F
-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
Fenestrated answered 11/3, 2015 at 12:43 Comment(3)
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.Grazia
ok i did not understand your question ;-) you want a package that installs a script. github.com/arteria/virtualenv-mgr/blob/master/setup.py#L21 i edit my postFenestrated
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"Rosalinarosalind

© 2022 - 2024 — McMap. All rights reserved.