3

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?

Draken
  • 3,134
  • 13
  • 34
  • 54
Maël Pedretti
  • 718
  • 7
  • 22

1 Answers1

2

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.

phd
  • 82,685
  • 13
  • 120
  • 165
  • 1
    "And they probably shouldn't." Sure after reading this answer. Didn't think about it before. As long as the app is not launched, the config folder is not created so if you import my package no problem. And if you reinstall it, it won't overwrite too. Thank you for your answer, didn't think about this aspect. – Maël Pedretti Apr 29 '18 at 16:03