Zip_safe = False does not work in setup.py file

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

But when I run this, my project is installed as an .egg file instead of the directory inside / Library / Python / 2.7 / site-packages. Below is the 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', ], ) 

Did I miss something? Is there any other way to set a python project as a directory instead of .egg files.

+7
python setuptools setup.py egg
source share
1 answer

Package installation

First you need to create a package.

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

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

Then you install this package using pip

 pip install dist/<your-packagename> 

egg laying

If you use:

 python setup.py install 

It will be installed like an egg.

Edit:

Download package

The main way: you create the package → .tar.gz or .zip, and you unzip the package in the right place. You get 0 benefits from python packaging.

Python package that installs the script e.g. CLI

document

add script argument to your setup ()

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

a file named myscript ( myscript .py) should have this in the first line

 #!/usr/bin/env python 
-one
source share

All Articles