Note: This is just an idea atm, let me know on IRC if its too much crack or theres something you don't like

Networked Imports would be a nice thing to add to a language I think, this is what I was thinking for in python:

a networked import would be an import where you specify the server that its at and the interpreter would automatically fetch a specific file on that server to import it, a networked import would be specified with an @ at the end of an import statement followed by the url to a site, for example "import tfplib.cod2p@tfkyle.dyndns.org".

when import encounters a form like that it would first normalize the site url in something like the following:

then import will fetch the url gotten from normalizing the site url as above, perhaps keeping a cache and on future requests preforming an HTTP HEAD request first checking the last-modified date. parse it, resolve the module uri from the parsed information and fetch it (again, caching if possible), then importing it normally (if thats possible).

the pypackages.list (or whatever) file will contain one entry per line, with each line being tab separated, currently the 2 fields I was thinking of were:

  1. module/package name
  2. uri to module file or package dir

(Note: I'm not sure if this would work with packages, it probably wouldn't with plain old http unless you specified all to include all modules in init.py) this can be extended easily if its needed though

an example would be the following (replace 4 spaces with a tab):

tfplib.cod2p    http://tfkyle.dyndns.org/svn/tfplib/trunk/tfplib/cod2p.py
tfplib.lamuphia    http://tfkyle.dyndns.org/svn/tfplib/trunk/tfplib/lamuphia.py
...

Problems

NetworkedImports (last edited 2008-02-05 05:46:29 by localhost)