Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where's the recommended place to put small python convenience modules

I've amassed a small collection of small handy ad hoc scripts that I would like to have available to me in all my python projects and ipython interactive sessions. I would like to add to and clean up this collection without having to worry about making setup.py files and installing them formally. From the list of directories on the sys.path by default, what's the proper home for these scripts?

like image 856
Noah Avatar asked Oct 03 '22 16:10

Noah


1 Answers

The user site directory should be the right directory for such things.

python -m site --user-site

shows you the correct path for your platform. Usually its something like
$HOME/.local/lib/python<version>/site-packages

You can even put a module sitecustomize.py there which will be imported automatically on each interperter startup.

like image 198
mata Avatar answered Oct 11 '22 00:10

mata