You are here

packaging TiddlyWeb, a pure Python application

11 posts / 0 new
Last post
FND
Offline
Last seen: 12 years 4 months ago
Joined: 2010-02-22 15:06
packaging TiddlyWeb, a pure Python application

Is there a recommended method for packaging Python applications?

In particular, I was planning to package TiddlyWeb.

As a first step I have created some basic scripts that make it reasonably straightforward to set up TiddlyWeb on Windows, using Portable Python.

While I've tried to adhere to the recommended directory structure, I haven't yet managed to compile a proper PortableApps package (being a Linux developer, I find it a little hard to motivate myself to work on Windows specifics).
Obviously that would be a very nice thing to have, as it would make for a much more user-friendly experience.

There's also the question of whether and how Portable Python should be used for this purpose. I understand this Python dependency issue has come up before, but has yet to be resolved?

Any guidance and assistance would be most welcome!

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 8 years 10 months ago
Joined: 2007-04-15 21:08
py2exe

We don't distribute a Python Portable which can be used by all Python applications; it's quite a troublesome issue due to multiple versions, libraries, etc.

Executables generated with py2exe is the only format that we support - we have official releases of Task Coach and BPBible which are both wxPython applications which use py2exe to generate Windows binaries.

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

djnavas
Offline
Last seen: 2 months 6 days ago
Joined: 2008-01-30 17:27
There are a portable version of pyton

There are a pyton portable version, which is refered by python web page.

Denis J Navas

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 8 years 10 months ago
Joined: 2007-04-15 21:08
Not suitable for distribution

It's not suitable for distribution of other programs though, only really for development of programs and running things from source. Reread my response concerning multiple versions and libraries.

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

FND
Offline
Last seen: 12 years 4 months ago
Joined: 2010-02-22 15:06
Thanks for your

Thanks for your response.

Executables generated with py2exe is the only format that we support - we have official releases of Task Coach and BPBible which are both wxPython applications which use py2exe to generate Windows binaries.

I'm barely familiar with py2exe at this point, so I'm not sure what the implications of this are.
Would each script (e.g. daemon, admin) require a separate frozen binary? What about extensibility with third-party modules - would that require recompilation?

We don't distribute a Python Portable which can be used by all Python applications; it's quite a troublesome issue due to multiple versions, libraries, etc.

I realize this is a tricky issue.
However, there might be an elegant solution; on Unix, it's not unusual to have multiple versions of Python (2.x, 3.x) available on the same system - conceivably, PortableApps could take a similar approach (with each app depending on a specific version rather than just Python)? With regards to libraries, virtualenv might be used to provide isolated Python environments for each application, thus avoiding conflicts.

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 8 years 10 months ago
Joined: 2007-04-15 21:08
PYTHONPATH

I'd been thinking more along the lines of putting Python in CommonFiles and any extras in the application's directory, something like App\PythonPath (or another directory in CommonFiles for a large one which is used by more than one thing, like wxWidgets, which would automatically then get added by the launcher to the PYTHONPATH environment variable so Python would find it. The problem with that was that site-packages could still be located and written to by a Python script - anyone trying to easy_install something would end up with things in the wrong place without a bit more fiddly Python code to change its impression, which I hadn't looked at yet. I've heard of virtualenv but never thought to look at it... thanks, it looks like it might do a better job with it. Some time I may see about making a Python segment for the PortableApps.com Launcher and a shared Python package (I think I'd do 2.5, 2.6 and 3.0 branches).

Applications like Blender still wouldn't be able to use this shared Python though; they must use their own binaries, to a large extent at least (though Inkscape, another such, could probably work with a different Python in the PATH, I think).

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

FND
Offline
Last seen: 12 years 4 months ago
Joined: 2010-02-22 15:06
I've heard of virtualenv but

I've heard of virtualenv but never thought to look at it... thanks, it looks like it might do a better job with it. Some time I may see about making a Python segment for the PortableApps.com Launcher and a shared Python package (I think I'd do 2.5, 2.6 and 3.0 branches).

Sounds good.
For the moment, I'll probably hold off on creating a PortableApps package for TiddlyWeb, due to the py2exe-related concerns mentioned above (and admittedly also because I'm not keen on working with Windows too much).

perica
Offline
Last seen: 14 years 1 month ago
Joined: 2006-10-25 05:56
Portable Python versions issues?


We don't distribute a Python Portable which can be used by all Python applications; it's quite a troublesome issue due to multiple versions, libraries, etc.

could you elaborate on this? If you bundle stripped down version of PP which is used for this single application, what is the issue around multiple versions??

kind regards

Perica Zivkovic
http://PortablePython.com

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 8 years 10 months ago
Joined: 2007-04-15 21:08
Size

The argument of this post is size rather than complexity.

The problem I see is that some applications require a specific version of Python; generally it's ">= 2.3" (or 2.4 or 2.5) but there are things which break with 2.5, and so for them you'd end up having to have a Python 2.4 environment. I like to do size comparisons in most of these things; while I don't have all the statistics as I haven't tried to get them, the gist of it is:

  • A CPython environment tends to end up somewhere around 20MB installed or maybe more.
  • CPython gets compressed pretty well when used with py2exe (most applications don't use bundling and compressing as efficiently for small size as they could; I enhanced my brother Ben's BPBible build script to flip the right switches, so BPBible's make_setup.py script is the best for showing how to shrink the Python environment that there is). It can come down to under 5MB I think. wxPython is then more, and in BPBible's case the SWORD bindings are even more still, which is why BPBible is so big (about 20MB portable).
  • To continue this BPBible example; the required environment for running from source would be Python 2.5 (OK, we could use 2.6) plus wxPython 2.8.9 plus SWORD 1.5.9 plus PyStemmer. I would assume we would have CommonFiles\Python and CommonFiles\wxPython (as wxPython is fairly big, and shared between many applications, e.g. Task Coach would also use both) and then BPBiblePortable\App\BPBible\pymodules to contain libsword and pystemmer. PYTHONPATH manipulation to manage this sort of thing is easy enough. The size is much bigger than the compressed variant you get with py2exe. Here are some estimates (no figures to back them, feel free to analyse it more accurately and correct me if you want):
    • Running from source: Python = 12MB, wxPython = 10MB, SWORD = 4MB, PyStemmer = trivial, source = 3MB (including required base resources, graphics et al): estimated total: ~30MB. For the second wxPython application then, maybe another 5MB added [Task Coach?]. BUT: it's quite possible that they won't use another Python application which can use this shared runtime.
    • py2exe generated: BPBible: 13MB; Task Coach: 25MB. With both, it may possibly end up a bit bigger, but you get fewer files, and maintenance is a lot easier.
  • There's also the issue of how you distribute the Python files; .py, .py+.pyo or just .pyo (I'm saying o rather than c as it's slightly optimised)

This post is very bitsy... don't expect to get much useful out if it. The biggest problem in my opinion is forcing a CommonFiles directory. It makes the whole process much less flexible (not necessarily bad) and more fiddly for the user.

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

Flexor
Offline
Last seen: 12 years 4 months ago
Joined: 2009-05-22 03:08
Any news ?

Is there any ready-to-unpack TiddlyWeb implementation yet ?
I can accept even non-portableapps.com version. I just don't know how to install TiddlyWeb correctly on Windows.
Please reply.

FND
Offline
Last seen: 12 years 4 months ago
Joined: 2010-02-22 15:06
> Is there any

> Is there any ready-to-unpack TiddlyWeb implementation yet ?

I'm afraid not. So far nobody has stepped up to do the (presumably not very demanding) task of packaging it up for Windows.

Any assistance is still welcome, of course.

Log in or register to post comments