On Kay's request, a thread of its own for the Python scripting as we move 
toward 2011.2.

Since the threads will need to be persistent for a few months as work is in 
progress for the next release,  I made most issues tracker tickets.  Feel free 
to add other tracker tickets too, just tag them with hsi (and hpi where 
applicable).

In no particular order of priority:

1. Test that HSI works on a headless machine

https://bugs.launchpad.net/hugin/+bug/789431


2. Python Script Locations

https://bugs.launchpad.net/hugin/+bug/789436


3. Formalize/Stabilize API

> > The main trade-off will be between bloat and functionality, and indeed
> > this thread and Thomas' "we don't need" statement is a taste of things
> > to come.
> 
> Scripts are really lightweight. If you look at woa, which is really a
> large script, it's merely 59K. The real load currently is the hsi
> module, _hsi.so, weighing in at 8.1M. I wouldn't worry about bloat
> from scripts.

actually I do not worry about bloat in terms of disk space or bandwidth.  I 
worry about bloat in terms of namespace / quantity of scripts.  Example:  
there can be a gazillion of scripts to generate an initial pto with the input 
images distributed according to a pre-determined shooting pattern (a feature 
request that has come up fairly often).  One can have a script that does 
stacks, another a script that shoots left to right; another is optimized for 
fisheyes (the typical 6+Z+N), etc.  how many such scripts do we want to 
include with the core Hugin? and how many more will there be in the online 
script repository?


> And if you worry about bloat, defining a clean API for
> hugin, so that hsi can wrap what's really needed - and wanted - to be
> accessible by everyone instead of near enough everything declared in a
> bunch of headers never meant for the wider public. I'd estimate
> _hsi.so could shrink to a quarter or so.
> 
> A proper API specification would also be a remedy against scripts
> breaking as soon as the headers in question are modified in an
> incompatible way

The biggest advantage I see in a carefully crafted clean API is human: the 
more understandable and simple the API, the more users it will attract.

Stability of the API to prevent script breaking is an extra bonus, but IMHO it 
is not extremely critical.  Forcing backward compatibility would only hinder 
progress and I'd rather deal with breaking scripts than with a rigid 
structure.

I would propose that we adopt a rule:  scripts should be written against the 
API that is frozen in a release (e.g. 2011.2, 2011.4, 2012.0, ...).  
Everything else is at risk of breaking any time and users of the bleeding edge 
should expect to experience such errors.

There will still be an extra burden: with every release all scripts will need 
testing and eventually update.  This has positive sides as well:  it will 
prune the body of scripts from scripts that have been supreseeded.


> - and that's quickly done: change a call signature or
> type name and swig will duly wrap it to keep the module consistent
> with the C++ code, and hsi code using the old names/signatures breaks
> and has to be adapted. Resulting in lots of frustrated users and
> script-writers (and support load: 'xyz.py does not work any more' -
> 'are you using hsi 5886.X already?' ...)

https://bugs.launchpad.net/hugin/+bug/789442


4. Script Repository

https://bugs.launchpad.net/hugin/+bug/789444


5. Naming Convention for Scripts

Kay disagree with me on this one.  I made two arguments for a naming 
convention in the bug report.

https://bugs.launchpad.net/hugin/+bug/789445


6. Scripting Guidelines

> Good examples go a long way.

Yes on the "write" side, i.e. to empower users to write their own scripts.  
But on the "read" side, i.e. when the project team receives contributed 
scripts for inclusion in the repository, what are the criteria to determine 
the cut, acceptable or not for the repository?

No ticket tracker, need discussion and the results of the discussion need to 
be summarized on a web page.


7. Formalized Interface

> What really needs to be formalized is
> interfacing with plugins. To formalize that, a proper interface beyond
> 'run Python script' should exist. I'd like to see a discussion of the
> topic. I started a thread a while ago, but nothing much came of it.

Yes, this is a heavy subject with far reaching consequences.  And right now it 
is almost 1AM and my batteries are running low.  Mine, not the laptops'.  
We'll need to put more work into this.

This will likely generate many tracker tickets, as there will be 
incompatibilities, platform related quirks, bugs, etc.


8. Quo Vadis?
 
> > The goal is to foster a culture of contribution and community around this
> > wonderful new Hugin feature that is Python scripting.
> 
> I think you're two steps ahead of what the real issues are, laudable
> as your enthusiasm is. We have experimental scripting and plugin
> interfaces that a few early adopters will play with. Among these, even
> fewer will try and write code with them. Few people will be determined
> enough to accept that their scripts and plugins live on shaky ground
> as the interfaces are work in progress and, as of yet, quite ad-hoc,
> undocumented, unstructured. If hsi/hpi is to become a success, these
> issues have to be adressed and solved. What directory the scripts
> eventually come to live in is currently a side-issue, and may well be
> easier to answer once the other issues have been adressed.

agree, we need to solidify the ground.

 
> And to the others who maybe read this: I won't do it alone. My
> knowledge of hugin's code base is not extensive, that's why I've
> wrapped as much as I could without looking into the code and provided
> a call interface that'll accept any parameter constellation. I have
> demonstrated the technique. More work is necessary which requires:

nobody expects you to do it alone.  I suspect that the fine grained work on 
the API will have to go to a GSoC project, maybe in 2012.  In the meantime, 
let's fool ourself into believing that the shaky ground is not so shaky, and 
write plug ins against official releases only.  So there will be a couple of 
earthquakes per year, not per month ;-)


> - sound knowledge of hugin code to result in an API
> - a clear idea of where python code should be used

I would like to call the fast preview via hsi ;-)


> - a structured plugin interface way beyond 'call Python script'
> including
> - a way for users to interact with plugins

and then wxPython becomes the main interface, not just plugin.

 
> and that's just what I can think of at short notice.

thank you for sharing your thoughts.

 
> Let me finish with a request: can we please discuss hsi/hpi in a
> thread that deals with it?

I hope this is OK - let's try to migrate those discussion that leads to 
fleshing out of functional specifications to Launchpad to make them longer 
lived than mailing list messages that get buried in time.

now I am hitting the off switch - tomorrow is another day.

Yuv

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to