santos82h
santos82h

Reputation: 480

What can I safely remove in a python lib folder?

I am using:

mkdir -p build/python/lib/python3.6/site-packages
pipenv run pip install -r requirements.txt --target build/python/lib/python3.6/site-packages

to create a directory build with everything I need for my python project but I also need to save as much space as possible.

What can I safely remove in order to save space?

Maybe can I do find build -type d -iname "*.dist-info" -exec rm -R {} \; ?

Can I remove *.py if I leave *.pyc?

Thanks

Upvotes: 0

Views: 1089

Answers (2)

Payam
Payam

Reputation: 1209

You can safely remove any .pyc, .pyo, .mdfiles. Also you can delete all __pycache__, and with a bit of risk, all those ending with /test or /tests

Upvotes: 0

bk-se
bk-se

Reputation: 560

Perhaps platform specific *.exe files, if your project doesn't need to run on Windows:

How to prevent *.exe ...

Delete *.pyc (byte-compiled files), with an impact to load-time: 100% supported, unlike your trick of the reverse: retain just *.pyc (and delete most *.py sources) in some python versions; not safe IMHO but never tried it.

Upvotes: 1

Related Questions