Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to exclude *.pyc and __pycache__ from python wheels?

What's the correct way to exclude files from a python wheel distribution package?

Editing the MANIFEST.in does not have any effect and I can't find information about this detail.

like image 347
nemesisdesign Avatar asked Apr 19 '16 14:04

nemesisdesign


People also ask

How do I ignore Pycache?

__pycache__/ . The ending slash indicates it is a directory and will ignore any files beneath it. You don't need ** . You can just say __pycache__/ .

Can I delete __ Pycache __ files?

__pycache__ is a folder containing Python 3 bytecode compiled and ready to be executed. I don't recommend routinely laboriously deleting these files or suppressing creation during development as it wastes your time.

Why does Python create __ Pycache __?

Python stores the compiled bytecode in __pycache__ directory so that future imports can use it directly, rather than having to parse and compile the source again. It does not do that for merely running a script, only when a file is imported. (Previous versions used to store the cached bytecode as .

What is the use of __ Pycache __?

Python-What is __pycache__? At the point when you run a program in python, the interpreter compiles it to bytecode first and stores it in the __pycache__ folder. If you go through there you will find a lot of files sharing the names of the . py files in your project's folder, just their extensions will be either .


1 Answers

Why would you be doing that? The __pycache__ directory will be generated anyway when a project is run for the first time on the target machine. It's simply an optimised bytecode representation of Python.

But anyway, you can write an script that unpacks the .whl file and does the modifications and then repacks the wheel.

like image 166
Aurora Lanes Avatar answered Sep 28 '22 18:09

Aurora Lanes