Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to make "python setup.py install" install source instead of egg file?

I used to run python setup.py install in a python project, it will just move the source to site-packages, but sometimes it will mv an egg file to site-packages?

#!/usr/bin/env python
# encoding: utf-8

from setuptools import setup,find_packages

setup(
    name = "ipin_rpc_gen_vector",
    version = "0.0.2",
    packages = find_packages("src"),
    package_dir={"":"src"},
    install_requires=[

    ],
)

So what is the difference behind this? When will it install source, when will it just install egg file? How can I force install source instead of egg file?

like image 284
roger Avatar asked Oct 08 '15 11:10

roger


People also ask

How do I install Python packages from setup py?

Installing Python Packages with Setup.py To install a package that includes a setup.py file, open a command or terminal window and: cd into the root directory where setup.py is located. Enter: python setup.py install.

Does pip install run setup py?

When pip runs setup.py, it will install all of the dependencies listed in install_requires. For example, if your project includes matplotlib, you'll need to list it, as well as its dependency of NumPy in install_requires as shown below: setup( ... install_requires=[ '<matplotlib>', '<numpy>' ] ...)

Is setup py install deprecated?

With the latest version of setuptools, the python setup.py install command is being deprecated (see https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for more info).


1 Answers

You have to set the zip_safe flag to False if you want to avoid the zip (egg) behaviour.

You can read more about it at https://setuptools.readthedocs.io/en/latest/userguide/miscellaneous.html#setting-the-zip-safe-flag.

Also check out https://setuptools.readthedocs.io/en/latest/userguide/keywords.html#new-and-changed-setup-keywords and the *_package_data flags (also at: https://setuptools.readthedocs.io/en/latest/references/keywords.html).

like image 56
b4stien Avatar answered Sep 25 '22 02:09

b4stien