Hi,
I raised this idea last summer which I've bounced around for a while,
which was to enable this:
from Kamaelia.Util.Backplane import Backplane, PublishTo,
SubscribeTo
from Kamaelia.Chassis.Pipeline import Pipeline
from Kamaelia.Chassis.ServerCore import ServerCore
from Kamaelia.File.Append import Append
from Kamaelia.Util.PureTransformer import PureTransformer
To be also said/written
from Kamaelia.Path import Backplane, PublishTo, SubscribeTo, \
Pipeline, ServerCore, Append, PureTransformer
What I've realised since then is that the primary objections were:
* Knowing where things are coming from and never worry about
name clashing
* Ability to query this statically, clearly
* How to deal with overrides/name clashes
* How to change the search order (eg for experimental versions and/
or
testing purposes)
* The idea that the library should do no magic, leaving the library
user in charge.
Therefore my suggestion is this:
* You can spell the imports above either way. People who do not
wish
to use this functionality would be in no way expected or required
to do so.
* Code that enters into the main repository (ie into the Kamaelia.*
namespace) would be required NOT to use Kamaelia.Path code (at
least initially - to see how things go). ie whilst a user of the
library can choose to enable "magic" for *their* script, the
library itself refrains from doing so.
* for Kamaelia.Path, importing a CamelCase or Caps'dname ALWAYS
imports a Component, no exceptions.
* Kamaelia.Path ONLY affects loads from Kamaelia.Path & nowhere
else
* Kamaelia.Path would also contain utility functions & attributes,
which are always lower case including:
* Kamaelia.Path.path would be modifiable, ala sys.path -
extendable
or replaceable. this would be a list of namespaces to search
in
what order. These would default to Kamaelia, but /could/
include
other namespaces.
* Kamaelia.Path.which would return the fully qualified
component
name. For example Kamaelia.Path.which("Pipeline") would return
"Kamaelia.Chassis.Pipeline.Pipeline"
* Kamaelia.Path.trace - flag which if set to True dumps what
components are being loaded from what files, and _why_ .
* Kamaelia.Path.doc would return the docstring for a given
Kamaelia
component (formatted to take into account docs for inboxes and
outboxes).
* Kamaelia.Path.webdoc would return the weblink for the same
docs.
I think that this combination would together be both useful for small
testing scripts, and incremental development. It would simplify cases
that really ought to be simple, and not get in the way of current
development styles.
FWIW, you could also think of Kamaelia.Path as being similar to the
unix command "env", as used like this:
#!/usr/bin/env python
ie a tool explicitly there for making it simpler to pick "the right"
thing, based on a known, defined path. Some people like that tool,
some hate it - which is what I suspect would be the reaction to be
for Kamaelia.Path
Any thoughts welcome.
Michael.
--
You received this message because you are subscribed to the Google Groups
"kamaelia" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/kamaelia?hl=en.