472,805 Members | 1,640 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,805 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 1901
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: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.