Python logo

Extract Python egg and Python wheel

Python eggs and wheels are two popular formats for distributing Python packages. Eggs are older and more widely used, while wheels are newer and offer some advantages, such as improved performance and support for multiple Python versions.  

The Egg format was introduced by setuptools in 2004, whereas the Wheel format was introduced by PEP 427 in 2012. You can read more about the differences between Python egg and wheel here

In this article, we will show you how to extract and list the contents of Python eggs and wheels on the command line.

Extracting Python egg

A python egg is a simple Zip file, so you can extract it using any program that reads Zip files:

$ unzip /path/to/file.egg

Note: You may need to rename the file to end with ‘.zip’ for some programs to extract them.

 

Extracting Python wheel

A python wheel is a simple Zip file, so you can extract it using any program that reads Zip files:

$ unzip /path/to/file.whl

 

Listing files in Python egg

$ unzip -l /path/to/file.egg

 

Listing files in Python wheel

$ unzip -l /path/to/file.whl

 

Conclusion

Python egg and wheel files are Zip files, so any program that can read Zip files can also read them. In some cases, you may need to rename the file to end with “.zip” for certain tools that can read Zip files to work.

In conclusion, we have shown you how to extract and list the contents of Python eggs and wheels on the command line. By following the steps in this article, you will be able to easily access the contents of these files, which can be useful for troubleshooting or development purposes.

You might also like other posts...