Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is zip_safe only relevant for the egg format?

If I read this correctly, then the egg format is something one should not use anymore. Instead, one should use the wheels format. Others seem to read this the same way.

With this assumption: Is zip_safe relevant for any other distribution format than egg?

What I found

According to this:

A boolean (True or False) flag specifying whether the project can be safely installed and run from a zip file. If this argument is not supplied, the bdist_egg command will have to analyze all of your project’s contents for possible problems each time it builds an egg.

Setuptools does not mention wheels. So I guess it is not relevant for wheels. So if I don't build eggs, I don't need this?

But then, if I install packages with pip install -e ., it seems as if it creates an egg file (well, an [package name].egg-info )... so maybe egg isn't outdated, even with Python 3.8?

like image 776
Martin Thoma Avatar asked Feb 11 '20 05:02

Martin Thoma


1 Answers

I believe the section "Is it possible to import Python code directly from a wheel file?" from PEP 427 could answer your question. In short, it is technically possible to leave the packages zipped, but there are advantages in installing them unzipped: easier access to metadata and prevention against some corner cases (can't execute binaries in a zip file). So that would explain why the zip_safe is not relevant anymore in general and for wheels in particular.

Nowadays, I believe eggs are only used in some rare specific cases. One of them is the setuptools develop mode or pip editable mode, in order to take advantage of the egg link feature.

like image 142
sinoroc Avatar answered Oct 22 '22 22:10

sinoroc