Where to keep local Python modules?

Chris Green cl at isbd.net
Fri Jul 23 06:33:48 EDT 2021


This isn't a question about how to set PYTHONPATH so that Python code
can find imported modules, it's about what is a sensible layout for
one's home directory - i.e. where to put Python modules.

I'm running Linux and have a number of Python modules that are only
used by my own code.  My top level Python code is all in ~/bin.  I'd
prefer to separate the modules so that they don't clutter the name
space.

Currently I have my Python modules in a subdirectory of ~/bin and my
Python path is set as:-

    PYTHONPATH=/home/chris/bin/pymods

Is this a reasonable approach?  Is there a 'standard' name for the
directory containing modules, or a standard place for it?  (I don't
mean a system-wide standard place, I mean a 'my' standard place).


-- 
Chris Green
·


More information about the Python-list mailing list