473,464 Members | 1,623 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Python linker

I love python - I use it as a utility language to complement my C#
programming every day. However, the reason I do not use it as my
primary language is - surprise, surprise - not its lack of static type
checking, but the size of standalone executes (which embed the python
runtime).

Would it be possible to link only the used functions into your
resulting executable? After all, a typical application might only use
20% of everything that is in the Python .dlls.

The same applies to wxPython - it would be great if you could only link
in what you need. Would it be possible to write such linkers at all
(maybe based on GCC)?

Jul 18 '06 #1
13 1291
<by*********@googlemail.comwrote:
>I love python - I use it as a utility language to complement my C#
programming every day. However, the reason I do not use it as my
primary language is - surprise, surprise - not its lack of static type
checking, but the size of standalone executes (which embed the python
runtime).
Er, what? How are you generating your standalone executables? What
size is "acceptable"? python24.dll is only 1.8M -- surely on any
non-embedded platform these days 1.8M isn't worth bothering about.
And since you mention wx (all of another 4.8M) I'd guess we're
talking about desktop applications. Who's going to notice if your
executable is a couple of M slimmer?

--
\S -- si***@chiark.greenend.org.uk -- http://www.chaos.org.uk/~sion/
___ | "Frankly I have no feelings towards penguins one way or the other"
\X/ | -- Arthur C. Clarke
her nu becomež se bera eadward ofdun hlęddre heafdes bęce bump bump bump
Jul 18 '06 #2
by*********@googlemail.com wrote:
I love python - I use it as a utility language to complement my C#
programming every day. However, the reason I do not use it as my
primary language is - surprise, surprise - not its lack of static type
checking, but the size of standalone executes (which embed the python
runtime).
Why not just install Python itself,
so that all of your python programs are only a few Kb each.
Because they all use the single shared installation.

--Irmen
Jul 18 '06 #3

by*********@googlemail.com wrote:
I love python - I use it as a utility language to complement my C#
programming every day. However, the reason I do not use it as my
primary language is - surprise, surprise - not its lack of static type
checking, but the size of standalone executes (which embed the python
runtime).

Would it be possible to link only the used functions into your
resulting executable? After all, a typical application might only use
20% of everything that is in the Python .dlls.

The same applies to wxPython - it would be great if you could only link
in what you need. Would it be possible to write such linkers at all
(maybe based on GCC)?
For your distribution, just move your DLLs to the appropriate system
folder. That's what DLLs do. You throw them in system32, forget they
were there in the first place, and the Linker Troll does the rest for
you.

Jul 18 '06 #4
I develop shareware applications that need to be extremely slim (less
than 1 MB is preferable).

Delphi applications easily meet this requirement and I can expect end
users to download the .NET framework (if they don't already have it!).

However, I cannot expect users to download 3.5 MB.

For corporate clients, size does not matter the least, but for end
users, anything that is a couple of megs seems "bloated".
For your distribution, just move your DLLs to the appropriate system
folder. That's what DLLs do. You throw them in system32, forget they
were there in the first place, and the Linker Troll does the rest for
you.
Jul 18 '06 #5
On 18 Jul 2006 08:01:22 -0700, by*********@googlemail.com
<by*********@googlemail.comwrote:
I develop shareware applications that need to be extremely slim (less
than 1 MB is preferable).

Delphi applications easily meet this requirement and I can expect end
users to download the .NET framework (if they don't already have it!).
So, they'll download and install the .NET framework at 23 MB, but they
won't download and install Python at 9 and half?

--
Cheers,
Simon B,
si***@brunningonline.net,
http://www.brunningonline.net/simon/blog/
Jul 18 '06 #6
Simon Brunning wrote:
So, they'll download and install the .NET framework at 23 MB, but they
won't download and install Python at 9 and half?
I think the .NET framework gets thrown down via Windows Update - or at
least it did for me - so that doesn't count as a 'separate download'
for many purposes.

--
Ben Sizer

Jul 19 '06 #7
Sion Arrowsmith wrote:
Er, what? How are you generating your standalone executables? What
size is "acceptable"? python24.dll is only 1.8M -- surely on any
non-embedded platform these days 1.8M isn't worth bothering about.
And since you mention wx (all of another 4.8M) I'd guess we're
talking about desktop applications. Who's going to notice if your
executable is a couple of M slimmer?
I've considered making a few lightweight GUI apps in the past but you
just can't do it with wxPython. When you have similar products done in
Visual C++ weighing in at kilobytes rather than megabytes, it's hard to
convince people that it's worth downloading your product. Say I wanted
to develop a simple Notepad clone with 1 or 2 extra features: the MS
executable is 68Kb, yet to simulate it in wxPython would be over 5MB;
nobody would want it. I suppose you can use the msvcrt library directly
and cut out wx from the dependencies, but sadly the Python overhead is
still a slight deterrent.

Not that I see an easy solution to this, of course.

--
Ben Sizer

Jul 19 '06 #8
Don't use wx, use native Windows controls that already
exist on the machine. That makes the application very small.

That said, I disagree that 3.5Mb is too much to download. It
only takes about 7 seconds on my machine (cable modem). If your
users won't wait that long, they weren't very interested in your
application.

-Larry
by*********@googlemail.com wrote:
I develop shareware applications that need to be extremely slim (less
than 1 MB is preferable).

Delphi applications easily meet this requirement and I can expect end
users to download the .NET framework (if they don't already have it!).

However, I cannot expect users to download 3.5 MB.

For corporate clients, size does not matter the least, but for end
users, anything that is a couple of megs seems "bloated".
>For your distribution, just move your DLLs to the appropriate system
folder. That's what DLLs do. You throw them in system32, forget they
were there in the first place, and the Linker Troll does the rest for
you.
Jul 19 '06 #9
Sion Arrowsmith <si***@chiark.greenend.org.ukwrites:
[...]
Who's going to notice if your executable is a couple of M slimmer?
Anybody with a modem.
John
Jul 19 '06 #10
Larry Bates <la*********@websafe.comwrites:
[...]
That said, I disagree that 3.5Mb is too much to download. It
only takes about 7 seconds on my machine (cable modem). If your
users won't wait that long, they weren't very interested in your
application.
[...]

For some markets (very far from all, of course!), that attitude sounds
like a recipe for failure.
John
Jul 19 '06 #11
Ben Sizer <ky*****@gmail.comwrote:
Sion Arrowsmith wrote:
Er, what? How are you generating your standalone executables? What
size is "acceptable"? python24.dll is only 1.8M -- surely on any
non-embedded platform these days 1.8M isn't worth bothering about.
And since you mention wx (all of another 4.8M) I'd guess we're
talking about desktop applications. Who's going to notice if your
executable is a couple of M slimmer?

I've considered making a few lightweight GUI apps in the past but you
just can't do it with wxPython. When you have similar products done in
Visual C++ weighing in at kilobytes rather than megabytes, it's hard to
convince people that it's worth downloading your product. Say I wanted
What framework (if any) is your Visual C++ code using? If it's using
wxWidgets (the framework underlying wxPython) I very much doubt that it
can be a few kilobytes -- unless the wxWidgets DLL is already installed
on the target machines so that it doesn't need to be packaged together
with the application code.

to develop a simple Notepad clone with 1 or 2 extra features: the MS
executable is 68Kb, yet to simulate it in wxPython would be over 5MB;
nobody would want it. I suppose you can use the msvcrt library directly
and cut out wx from the dependencies, but sadly the Python overhead is
still a slight deterrent.

Not that I see an easy solution to this, of course.
The easy solution is to compare apples with apples: if, in your
application space, it is crucial to use only DLLs that are already
installed on the target machines, you can do that from Python (with
ctypes, for example) just as you can from C. Of course, coding to
(e.g.) the Win32 API directly is not to everybody's tastes, but it's
just about as bad in any language.

Of course, if you believe that the runtime libraries for a given
language (Visual Basic N for some specific value of N, Visual C++ M for
some specific value of M, ...) are going to be already installed on the
target machine, then the hypothetical constraint says that you must use
that specific language and version. For example, nobody will ever
program applications in VB6, because at some point in time the runtime
libraries for VB5 were widespread and those for VB6 were not, so a
program prepared for VB5 could be distributed as a much-smaller package.

What generally happens in the real world is rather different:
applications get programmed in whatever language and release/version is
handy, and the runtimes are separately offered for download and install
to those users who have not yet installed any previous application using
the same language and release/version. For example, msvcr80.dll is
indispensable to use programs written with Microsoft Visual Studio 2005,
and you'll find thousands of sites on the web offering it for separate
download and installation; mfc80u.dll, similarly (albeit only at
hundreds of sites;-); and so on, and so forth.

The situation is quite similar for other languages, Python included, and
other frameworks, wxWidgets (and wxPython on top it it) included.
Alex
Jul 20 '06 #12
<by*********@googlemail.comwrote:
I develop shareware applications that need to be extremely slim (less
than 1 MB is preferable).

Delphi applications easily meet this requirement and I can expect end
users to download the .NET framework (if they don't already have it!).

However, I cannot expect users to download 3.5 MB.

For corporate clients, size does not matter the least, but for end
users, anything that is a couple of megs seems "bloated".
So use IronPython -- that's what it's for, after all: letting you write
Python applications for .NET. See
<http://www.codeplex.com/Wiki/View.aspx?ProjectName=IronPython>: it's
now in Beta9 and the final non-beta release should be out soon.
Alex
Jul 20 '06 #13
Alex Martelli wrote:
What framework (if any) is your Visual C++ code using? If it's using
wxWidgets (the framework underlying wxPython) I very much doubt that it
can be a few kilobytes -- unless the wxWidgets DLL is already installed
on the target machines so that it doesn't need to be packaged together
with the application code.
Sure, I meant without wxWidgets.
The easy solution is to compare apples with apples: if, in your
application space, it is crucial to use only DLLs that are already
installed on the target machines, you can do that from Python (with
ctypes, for example) just as you can from C.
But even that is sadly not practical, since the Python DLL alone is
about 30 times the size of a tiny app like Notepad (for example).
What generally happens in the real world is rather different:
applications get programmed in whatever language and release/version is
handy, and the runtimes are separately offered for download and install
to those users who have not yet installed any previous application using
the same language and release/version.
The real world is a big and diverse place, and I assure you that my
applications are no less real than your own! :) Sometimes you simply
cannot pick a language and version at leisure and expect everybody to
install whatever is required. There are some things - casual
entertainment products for example, or one-shot system checking tools,
etc - where people are reluctant to install anything at all, and will
not bother if they see a 6MB download.

I wasn't saying this was a problem with Python - though I do expect
that .dll could be trimmed down a bit - but it is a bit of a shame that
I can't easily distribute something less than 1MB in size using Python.

--
Ben Sizer

Jul 24 '06 #14

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

Similar topics

0
by: Jim | last post by:
All, I'm trying to debug a Python GPF while running a script that we've written. After fixing up some of the paths for the Python build and successfully building Python from ActiveState source,...
2
by: Dennis Hore | last post by:
I'm trying to install Nick Patavalis' ppgplot package on Mac OS X 10.3 with python 2.3. I first sent this message to Nick, but he said he doesn't have any experience with the Mac platform. ...
1
by: Charlie DeTar | last post by:
A pretty ugly one - embedding python in an external for a proprietary semi-legacy macintosh application, MaxMSP: I am trying to update Bill Orcutt's "nyptho" python interpreter external for...
10
by: Larry Hastings | last post by:
I'm an indie shareware Windows game developer. In indie shareware game development, download size is terribly important; conventional wisdom holds that--even today--your download should be 5MB or...
1
by: Mark Asbach | last post by:
Hi pythonians, I'm one of the maintainers of an open source image processing toolkit (OpenCV) and responsible for parts of the autotools setup. The package mainly consists of four shared...
22
by: lennart | last post by:
Hi, I'm planning to learn a language for 'client' software. Until now, i 'speak' only some web based languages, like php. As a kid i programmed in Basic (CP/M, good old days :'-) ) Now i want to...
4
by: vedrandekovic | last post by:
Hi, I have already install Microsoft visual studio .NET 2003 and MinGw, when I try to build a extension: python my_extension_setup.py build ( or install ) , I get an error: LINK : fatal...
0
by: DevEng | last post by:
Hi all, I am new to Python and trying to embed it into a c/c++ application. I started with examples from the documentation pages and go to the Pure Embedding example...
16
by: Jaco Naude | last post by:
Hi there, This is my first post over here and I hope someone can give me some guidance. I'm trying to embed Python into a Visual C++ 2008 application and I'm getting linker problems. I've...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.