Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install a wheel-style package using setup.py

Is there a way, using setup.py, to install a python package as a wheel/pip-style package (i.e. dist-info) instead of the egg installation that setup.py does by default (i.e. egg-info)?

For example, if I have a python package with a setup.py script and I run the following command, it will install the package as an egg.

> python setup.py install

However, I can build a wheel first, and then use pip to install that wheel as a wheel/dist-info type installation

> python setup.py bdist_wheel
> pip install ./dist/package-0.1-py2-none-any.whl

Is there a way to install the package as a wheel/dist-info installation directly from setup.py? Or is the two-step process using both setuptools and pip necessary?

like image 289
Brendan Abel Avatar asked Jan 31 '18 20:01

Brendan Abel


1 Answers

Update: Confirmed, this has landed in pip now. If you are still seeing .egg-info installs when pip installing from a directory, then just upgrade your pip installation. Note that --editable installs will still use egg-info.


Original answer below:

This feature is coming soon. This was issue #4611. Follow the trail and you will find PR 4764 to pip, merged into master approx a week ago. In the meantime, you can

pip wheel . 
pip install ./mypackage.whl
like image 108
wim Avatar answered Sep 18 '22 15:09

wim