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?
3 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.

- 40,459
- 37
- 151
- 246
-
`wheel pack` is an invalid command. How do you put it back as wheel file after unpacking? `wheel: error: invalid choice: 'pack' (choose from 'keygen', 'sign', 'unsign', 'verify', 'unpack', 'install', 'install-scripts', 'convert', 'version', 'help')` – Himaprasoon Jun 12 '19 at 07:03
-
1Update: I was using wheel version `0.31.1` when I upgraded to `0.33.4` It worked. – Himaprasoon Jun 12 '19 at 07:10
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.

- 7,002
- 1
- 25
- 29
-
Thanks a lot, I wanna point out that I have the source code, but it's very large and enough complex not to trace it to learn some info about variables and so, that's why I wanted to edit the package directly, I guess I'll have to crack the project down anyways :)) – Kareem Jan 28 '17 at 20:17
you can open the whl file using 7zip or something alike, track the file you wish to change, open in edit mode, save it, next 7zip will popup a message saying something was modified and if you want the change to be saved, press yes and youre good to go.
remember to backup your original whl before doing it..

- 41
- 3
-
1If you edit a wheel this way the checksums will not match and you will have an invalid wheel. – joeforker Jun 12 '19 at 12:57