473,320 Members | 1,887 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,320 software developers and data experts.

Libraries in python

Hy people, I'm new in python and comming from JAVA.

Something I really like in java is the easy way to add a library to the
project. Just put the jar file in the folder ( WEB-INF/lib ) and
doesn't need to restart the server ( tomcat ).

Can I do some like using python - I'm using apache mod_python?

thanks a lot

Sep 2 '06 #1
3 1926
Hy people, I'm new in python and comming from JAVA.
>
Something I really like in java is the easy way to add a library to the
project. Just put the jar file in the folder ( WEB-INF/lib ) and
doesn't need to restart the server ( tomcat ).

Can I do some like using python - I'm using apache mod_python?
Not sure what you are after. If you configured apache to invoke
mod_python on a location basis (given directory and subdirectories of
that for example) then you can certainly drop any python module there
and use it from any other python code from that directory without
restarting apache.
Sep 2 '06 #2
ed**********@gmail.com wrote:
Hy people, I'm new in python and comming from JAVA.

Something I really like in java is the easy way to add a library to the
project. Just put the jar file in the folder ( WEB-INF/lib ) and
doesn't need to restart the server ( tomcat ).

Can I do some like using python - I'm using apache mod_python?
I know exactly what you mean because I had the same question when I
came to Python from Java. What you're looking for is Python "eggs".
Unfortunately, they're a fairly new addition to the Python ecosystem
and they're not as nice/simple to use as jars. Here are a few of their
shortcomings:

1. not nearly all of the libraries that you may want to use are
distributed as eggs, so you may need to package them yourself, which
can be a pain. To be fair, this is not a shortcoming of eggs directly,
but rather a disadvantage of new technology--it's not ubiquitous yet.

2. you have to put them in the source root directory of the project so
they can be imported in all packages in the project. This seems to
clutter things up for me, and I'd rather have a project-local lib
directory in which to put them (I know that's possible with sys.path
hacks, but that's a hack, this should be standardized).

3. eggs only work well for python-only packages. In other words if the
library includes platform-specific binaries or other non-python-code
files then the egg must be unpacked for it to work. I really hate this
one because it means all those unpackaged files must be checked into
source control rather than just a single library archive file.

4. the seemingly "standard" place to deploy eggs is in the global
site-packages directory of your Python installation. That's terrible
because it makes it a pain to use different versions of a given package
in different projects. Yes, you can use the "setuptools.requires()"
function, but I want to deploy my apps without requiring those who
install it to download lots of dependencies to get it running (not to
mention I just want to use Python's standard "import", not some
non-standard "requires()" function). And yes, I know "requires()" is
supposed to automatically handle the dependencies too, but that just
seems too error prone because it makes too many assumptions about
resource availablitiy... all I want to do is bundle the library when I
deploy (preferably in the form of a single file).

That's my $0.02 on Python packaging and library dependencies. In my
opinion it's one of the few things that Java got right that Python
didn't.

~ Daniel

Sep 2 '06 #3
That's my $0.02 on Python packaging and library dependencies. In my
opinion it's one of the few things that Java got right that Python
didn't.
Yeah, sure. Hunting down a subtle class loading bug because of e.g.
different xml-api versions in your classpath in just a few hours is a
thing java certainly "got right".

Additionally, you refuse to "hack" around with sys.path, but the concept
of CLASSPATH that you have to carefully compose in the first place
appeals to you.

There is no standard way of versioned library access anywhere in java -
so while setuptools might not be perfect, they at least offer _something_.

And the fact that machine code containing eggs are an annoyance to you
is perfectly met by the need of java to have JNI dependant .so/.dll
files being part of the LD_LIBRARY_PATH (and whatever is needed on
windows, I presume PATH)

Just because every nitwit in java is accustomed to meddle with
classpaths and thus the application servers do something like adding
WEB-INF/lib to the classpath (a thing that you refer to as hacking in
python) does not mean its system is in any way superior to pythons.

Diez

Sep 2 '06 #4

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

Similar topics

9
by: Robert Ferrell | last post by:
I'm trying to do some debugging of python extensions on Windows2K. MS Visual Studio (.NET) says it can't find the debug version of the python libraries. (The message is "python.exe does not...
1
by: Laughlin, Joseph V | last post by:
Has anyone had any difficulties using C libraries / data structures with python? Are there any things I need to be aware of? Joe Laughlin Phantom Works - Integrated Technology Development Labs ...
2
by: ACB | last post by:
I have been trying to get the gdmodule installed and have run into an issue. When I import gd I get the following error. >>> import gd Traceback (most recent call last): File "<stdin>", line 1,...
1
by: Bo Peng | last post by:
Dear list, My python modules depend on a few boost libraries. For convenience, I include the source code of these libraries with my distribution and treat them as standard source files. This...
0
by: Samuele Pedroni | last post by:
Registration for Europython (3-5 July) at CERN in Geneva is now open, if you feel submitting a talk proposal there's still time until the 31th of May. If you want to talk about a library you...
6
by: Bill Spotz | last post by:
Hi, Is there a way to tell an executing python script where to look for dynamically-loaded libraries? My situation is that that I am developing python wrappers for a large software project. ...
2
by: Ognjen Bezanov | last post by:
Hello, I have some external C libraries I would like to use with python. I have been searching on the internet and found many such modules/bindings for libraries (e.g. Py-Lame) but have not...
85
by: g | last post by:
Hello, is there any library for C as Boost is for C++? thanks in advance,
0
by: abarun22 | last post by:
HI I am new to SWIG & Python and right now i am in the process of wrapping some "C" functionalities present in a static library for python. I do have my C file "name.c" which just contains some...
4
by: stuntgoat | last post by:
Hi, I want to start using Python 2.6 and 3000. I have several questions. What, in your experiences, is a functionally elegant solution to installing 2.6 and 3 from source without breaking...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
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...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.