473,242 Members | 2,784 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,242 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 3224
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: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

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.