Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to edit a wheel package (.whl)?

I have a python wheel package, when extracted I find some python code, I'd like to edit this code and re-generate the same .whl package again and test it to see the edits .. How do I do that?

like image 945
Kareem Avatar asked Jan 27 '17 16:01

Kareem


People also ask

How do I open a .WHL file?

You need a suitable software like Python from Python Software Foundation to open a WHL file. Without proper software you will receive a Windows message "How do you want to open this file?" or "Windows cannot open this file" or a similar Mac/iPhone/Android alert.

What is a wheel package in Python?

What Is a Python Wheel? A Python . whl file is essentially a ZIP ( . zip ) archive with a specially crafted filename that tells installers what Python versions and platforms the wheel will support. A wheel is a type of built distribution.

What is wheel WHL?

A WHL (Wheel) file is a distribution package file saved in Python's wheel format. It is a standard format installation of Python distributions and contains all the files and metadata required for installation. The WHL file also contains information about the Python versions and platforms supported by this wheel file.


2 Answers

Wheel provides the wheel command in addition to just setup.py bdist_wheel. Use wheel unpack [file.whl] to open the wheel, edit what you will, and then use wheel pack [directory] to put it back together again.

like image 53
joeforker Avatar answered Sep 19 '22 01:09

joeforker


You usually don't.

Normally you get the source package instead of the wheel (or use development mode to install the package in editable form) and rebuild the wheel from that, e.g. by running python setup.py bdist_wheel.

Have a look at https://packaging.python.org/distributing/ for a lot of information how to build those wheel packages.

like image 27
schlenk Avatar answered Sep 18 '22 01:09

schlenk