Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

include only *.pyc files in python wheel

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?

like image 224
Zuabi Avatar asked Jan 14 '19 18:01

Zuabi


People also ask

How do I run a .PYC file in Python?

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 .

What are .py and .PYC files in Python?

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). .

Do Python wheels contain source code?

Most wheels are pure-Python, which means that they only contain Python source code.

Where are .PYC stored?

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.)


1 Answers

I haven't tried it, but it looks like pyc-wheel does precisely that.

like image 100
Berislav Lopac Avatar answered Oct 17 '22 06:10

Berislav Lopac