Hello,
> The more interesting possibility in my mind is that Fanstatic could
> grow a way to parse AMD-based .js files and create Resource objects
> automatically for them. That way for AMD-based code you don't have to
> maintain any Python code at all anymore.
Yes! I don't really have anything constructive to add right now, but I just
wanted to say that I like this idea very much! :-)
> There are a whole host of issues to work out. If there's no Python
> package anymore installed, how do you get a resource then to need() it
> in your code? A new API to get such resources might be useful. How
> does the old and the new work together: can we make Python-declared
> Resource depend on an automatically created Resource?
Hmm, above you talk about synthesizing Resource objects. While I'm a little
wary of synthetic Python modules, we /could/ have Fanstatic create something on
the fly, e.g. from foo/bar.js we'd make it so that clients could call
js.foo.bar.need() or something -- we'd need to think about naming conventions
and namespaces and such, though.
The other option would be a new string-based API, like
AMDResource('foo.bar').need(). (This, too, raises the
naming/namespace question, of course.)
As for combining new and old ways, I think one might spell it like this:
Resource(lib, 'local.js', depends=[AMDResource('other.js')])
where AMDResource is a stand-in that resolves to the automatically created
thing at the right time *waves hands*.
Oh. I just saw you already talked about that:
> take JS directory and create virtual js.* module that we can import
> resources from (this might require too much work during import time,
> though, so other API to expose resources might be better)
Well. So we agree about the possibilities here. :)
Wolfgang