Search code examples
pythonsqlitepipanacondapypi

Where should my Python package add files on a user system?


I want my package to add a SQLite file either at time of package install or upon running an initialization method.

Is there a conventional place where that file should live?

  • Option 1: within a /usr/local directory.
  • Option 2: within ~ home directory of /Users/<current_user>

I have no experience in this area, but I am leaning toward a hidden .my_package directory at ~ because when I look at my home this is what I see:

.conda
.docker
.ipython
.jupyter
.matplotlib
...

Solution

  • You might want to use the appdirs package to determine the correct directory regardless of platform.