Reputation: 15593
I'm creating a pip package that ships with gzipped files and unzips them the first time the module is imported. I realize this is unusual and not really a great idea, but given my constraints it seems to be the best way to ship the data.
One problem I noticed is that if you uninstall the package via pip, the extracted files are not deleted and pip gives this message:
Would not remove (might be manually added):
file1
file2
Is there somewhere in setup.py
that I can specify that these files belong to my package and should be removed when it's uninstalled?
Upvotes: 7
Views: 1285
Reputation: 15593
If you create empty files with the same name as the files you're going to create and add them to your package, then pip will recognize them as part of your package and remove them when uninstalling your package. So there's no mechanism in setup.py
or whatever for specifying paths, but using dummy files works.
Upvotes: 4