user3715648
user3715648

Reputation: 1588

Is __pycache__ crossplatform?

I have a folder of files /foo. This folder gets included as package_data in the setup.py for my Python package. When someone pip install's my package, they're able to download /foo to their computer.

I've noticed though that when this happens, a __pycache__ folder gets included for all the *.py files in /foo. I'm not sure if this is created when my wheel is created, or when it's installed. I'm assuming it's during wheel creation though.

Since my package should work on windows/osx/linux, will things break because of the __pycache__ folder? Is it platform specific, or will it work cross platform? Or does the folder get created during wheel installation and it doesn't matter anyway.

Upvotes: 3

Views: 372

Answers (1)

match
match

Reputation: 11070

__pycache__ is usually generated on the fly at the point the package is installed, unless you have accidentally included it in your project (in which case it is best to remove it). For the full spec, see PEP3147.

The compiled code is designed to fail safe. That is, if it exists but isn't compiled for your OS/architecture, then it should be ignored.

Upvotes: 3

Related Questions