Python: execute action at package uninstall

回眸只為那壹抹淺笑 提交于 2019-11-28 12:30:42

问题


In one of my python project I create a config folder in the user directory.

However, when the package is uninstalled via pip, the config folder remains still. There isn't any confidential data so this isn't a security problem but I would like to delete it for user convenience.

My question is, is there any way of doing it properly?


回答1:


Python wheels — and even less eggs or sdists — are not full-blown packages, they don't have post-install or pre-uninstall script. And they probably shouldn't.

Anyway, users expect config files to remain in place after a program is uninstalled — just in case they reinstall the program again. And of course they expect the config will not be overwritten on the second installation.



来源:https://stackoverflow.com/questions/50088440/python-execute-action-at-package-uninstall

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!