Differences between revisions 1 and 2
Revision 1 as of 2006-11-02 10:16:57
Size: 1868
Editor: TFKyle
Comment:
Revision 2 as of 2006-11-02 10:19:59
Size: 1869
Editor: g47175
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
Note: This is just a idea atm, let me know on IRC if its too much crack or theres something you don't like Note: This is just an idea atm, let me know on IRC if its too much crack or theres something you don't like

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:

  • if there is no scheme (http://, ftp://, etc.) then add a default of http://

  • if no path on the remote server was specified use a default name, "pypackages.list" perhaps, not sure

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
...

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