473,385 Members | 1,740 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Where best to put local modules?

I'm just beginning to create some python modules for my own use and
I'm wondering where to put them. Initially I have put them in
$HOME/bin and I have set PYTHONPATH to point to them there. It all
seems to be OK but I was wondering if I might be storing up problems
for the future by putting python modules in with my odds and sods of
shell scripts etc. (and with my python 'main' scripts).

Would I be better off putting the modules somewhere else, e.g.
somewhere like $HOME/lib/python?
--
Chris Green
Dec 19 '07 #1
7 3232
ti*****@isbd.co.uk a écrit :
I'm just beginning to create some python modules for my own use and
I'm wondering where to put them. Initially I have put them in
$HOME/bin and I have set PYTHONPATH to point to them there. It all
seems to be OK but I was wondering if I might be storing up problems
for the future by putting python modules in with my odds and sods of
shell scripts etc. (and with my python 'main' scripts).

Would I be better off putting the modules somewhere else, e.g.
somewhere like $HOME/lib/python?
If you're on a shared system and don't have admin access, this last
solution is probably the best - "pure" modules have nothing to do in a
bin/ directory indeed. Now if it's your own computer, why not just put
them in /path/to/python/libs/site-packages ?
Dec 19 '07 #2
En Wed, 19 Dec 2007 14:02:20 -0300, <ti*****@isbd.co.ukescribi�:
I'm just beginning to create some python modules for my own use and
I'm wondering where to put them. Initially I have put them in
$HOME/bin and I have set PYTHONPATH to point to them there. It all
seems to be OK but I was wondering if I might be storing up problems
for the future by putting python modules in with my odds and sods of
shell scripts etc. (and with my python 'main' scripts).

Would I be better off putting the modules somewhere else, e.g.
somewhere like $HOME/lib/python?
Try lib/pythonX.X/site-packages, which is already on sys.path so you don't
have to set PYTHONPATH

--
Gabriel Genellina

Dec 19 '07 #3
Gabriel Genellina <ga*******@yahoo.com.arwrote:
En Wed, 19 Dec 2007 14:02:20 -0300, <ti*****@isbd.co.ukescribi?:
I'm just beginning to create some python modules for my own use and
I'm wondering where to put them. Initially I have put them in
$HOME/bin and I have set PYTHONPATH to point to them there. It all
seems to be OK but I was wondering if I might be storing up problems
for the future by putting python modules in with my odds and sods of
shell scripts etc. (and with my python 'main' scripts).

Would I be better off putting the modules somewhere else, e.g.
somewhere like $HOME/lib/python?

Try lib/pythonX.X/site-packages, which is already on sys.path so you don't
have to set PYTHONPATH
That's fine if it happens to be your own system and you have root
access, however I was actually meaning on a system where I just have a
shell account.

--
Chris Green
Dec 20 '07 #4
Bruno Desthuilliers <bd*****************@free.quelquepart.frwrote:
ti*****@isbd.co.uk a écrit :
I'm just beginning to create some python modules for my own use and
I'm wondering where to put them. Initially I have put them in
$HOME/bin and I have set PYTHONPATH to point to them there. It all
seems to be OK but I was wondering if I might be storing up problems
for the future by putting python modules in with my odds and sods of
shell scripts etc. (and with my python 'main' scripts).

Would I be better off putting the modules somewhere else, e.g.
somewhere like $HOME/lib/python?

If you're on a shared system and don't have admin access, this last
solution is probably the best - "pure" modules have nothing to do in a
bin/ directory indeed. Now if it's your own computer, why not just put
them in /path/to/python/libs/site-packages ?
There's one of each, a system where I have a shell account but not
root access and my home system.

There is a disadvantage of putting stuff in the site-packages directory
isn't there? If/when I upgrade the system the python modules I have added
will effectively not be visible to the upgraded system. I know I can
copy them across to the new site-packages but it's just one more chore
when upgrading. If they were in $HOME/lib/python this issue wouldn't
arise because /home stays the same across upgrades.

--
Chris Green
Dec 20 '07 #5
ti*****@isbd.co.uk a écrit :
Bruno Desthuilliers <bd*****************@free.quelquepart.frwrote:
>ti*****@isbd.co.uk a écrit :
>>I'm just beginning to create some python modules for my own use and
I'm wondering where to put them. Initially I have put them in
$HOME/bin and I have set PYTHONPATH to point to them there. It all
seems to be OK but I was wondering if I might be storing up problems
for the future by putting python modules in with my odds and sods of
shell scripts etc. (and with my python 'main' scripts).

Would I be better off putting the modules somewhere else, e.g.
somewhere like $HOME/lib/python?
If you're on a shared system and don't have admin access, this last
solution is probably the best - "pure" modules have nothing to do in a
bin/ directory indeed. Now if it's your own computer, why not just put
them in /path/to/python/libs/site-packages ?

There's one of each, a system where I have a shell account but not
root access and my home system.
There is a disadvantage of putting stuff in the site-packages directory
isn't there? If/when I upgrade the system the python modules I have added
will effectively not be visible to the upgraded system. I know I can
copy them across to the new site-packages but it's just one more chore
when upgrading. If they were in $HOME/lib/python this issue wouldn't
arise because /home stays the same across upgrades.
Yes, true. OTHO, storing modules in your own $HOME/whatever and
modifying your $PYTHONPATH accordingly won't make the modules available
to other accounts. Which may or not be a problem (it happened to be one
for me...).
Dec 20 '07 #6
Bruno Desthuilliers <br********************@wtf.websiteburo.oops.comwr ote:
ti*****@isbd.co.uk a écrit :
Bruno Desthuilliers <bd*****************@free.quelquepart.frwrote:
ti*****@isbd.co.uk a écrit :
I'm just beginning to create some python modules for my own use and
I'm wondering where to put them. Initially I have put them in
$HOME/bin and I have set PYTHONPATH to point to them there. It all
seems to be OK but I was wondering if I might be storing up problems
for the future by putting python modules in with my odds and sods of
shell scripts etc. (and with my python 'main' scripts).

Would I be better off putting the modules somewhere else, e.g.
somewhere like $HOME/lib/python?

If you're on a shared system and don't have admin access, this last
solution is probably the best - "pure" modules have nothing to do in a
bin/ directory indeed. Now if it's your own computer, why not just put
them in /path/to/python/libs/site-packages ?
There's one of each, a system where I have a shell account but not
root access and my home system.
There is a disadvantage of putting stuff in the site-packages directory
isn't there? If/when I upgrade the system the python modules I have added
will effectively not be visible to the upgraded system. I know I can
copy them across to the new site-packages but it's just one more chore
when upgrading. If they were in $HOME/lib/python this issue wouldn't
arise because /home stays the same across upgrades.
Yes, true. OTHO, storing modules in your own $HOME/whatever and
modifying your $PYTHONPATH accordingly won't make the modules available
to other accounts. Which may or not be a problem (it happened to be one
for me...).
Probably not for me. OK, thanks for all the responses, it seems there
isn't anything of huge consequence that I'm missing so I can just
decide what fits my situation best.

--
Chris Green
Dec 20 '07 #7
Wherever it is physically located, I would suggest linking the dir to /
usr/lib/python/site-python (on a Linux system). AFAIK the sole
purpose of this dir is for the type of thing you are describing. On
my system it also gets copied when Python is updated. What
permissions you give the dir is up to you. Also, you probably want it
somewhere that gets backed up routinely or you may loose your latest
and greatest version if there is a crash, etc..
Dec 20 '07 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Matthew Barnes | last post by:
This may be a naive question, but since Python 2.3 added a handy little DictMixin class to its UserDict module it seems to me like UserList.ListMixin and maybe even UserString.StringMixin should...
7
by: Andreas Neudecker | last post by:
Hi. I have a "style" question: Sometimes, modules will only be used in a particular, optional, part of a program (function, class), that will not always be used when the application is run. So I...
2
by: Torsten Mohr | last post by:
Hi, i tried to find the file and line in the C sources of python where the command "import" is implemented. Can anybody give me some hint on this? Thanks, Torsten.
5
by: wrecker | last post by:
Hi all, I have a few common methods that I need to use at different points in my web application. I'm wondering where the best place would be to put these? I think that I have three options. ...
4
by: Fabian Braennstroem | last post by:
Hi, I am pretty new to python and will use it mainly in combination with scientific packages. I am running ubuntu breezy right now and see that some packages are out of date. Do you have any...
4
by: Tom Jones | last post by:
I have an application that was originally built using Visual Studio 2003 that I upgraded to Visual Studio 2005. When I attempt to build the *.msi file in the deployment project, I am getting a...
2
by: allen.fowler | last post by:
Hi, My code looks like this: for item in bigset: self.__sub1(item) self.__sub2(item) self.__sub3(item) # the subX functions, in turn, use various 3rd party modules.
1
by: Jeff | last post by:
Hey I'm about to start developing an windows application based on .net 2.0. The GUI will consist of 2 things: a treeview and an area displaying things based on selections in the treeview. The...
3
by: Jorgen Bodde | last post by:
Hi All, I am trying to make a debian package. I am following the tutorial by Horst Jens (http://showmedo.com/videos/video?name=linuxJensMakingDeb&fromSeriesID=37) and it is very informative....
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.