How can I include only *.pyc files in a python wheel?
When creating eggs, it used to be possible to run
python setup.py bdist_egg --exclude-source-files
Given that eggs have been replaced by wheels, how would I reproduce a similar result?
pyc files are created by the Python interpreter when a . py file is imported. They contain the "compiled bytecode" of the imported module/program so that the "translation" from source code to bytecode (which only needs to be done once) can be skipped on subsequent imports if the . pyc is newer than the corresponding .
py files contain the source code of a program. Whereas, . pyc file contains the bytecode of your program. We get bytecode after compilation of . py file (source code). .
Most wheels are pure-Python, which means that they only contain Python source code.
pyc files are placed in the same directory as the . py file. In Python 3.2, the compiled files are placed in a __pycache__ subdirectory, and are named differently depending on which Python interpreter created them. (This can be useful to people importing the same Python modules from multiple versions of Python.)
I haven't tried it, but it looks like pyc-wheel does precisely that.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With