-
Notifications
You must be signed in to change notification settings - Fork 5
Spec for Component.py
Daniel Chatfield edited this page Jul 29, 2013
·
12 revisions
This is very much a work in progress.
Not sure how things are going to work out yet, probably going to be either:
from component import example_content
Which requires some magic to get it to import the right module (although I'm fairly confident that I know how to do this).
Downsides of this approach are:
- The library can't expose functions without namespacing them to prevent collisions.
- Import has to be a module, can't just be a function
from component import require
example_component = require("example-component")
Upsides:
- Allows library to expose functions without namespacing them
- Allows requiring of a module or a function or simple a text string (by exporting that in the python file). Downsides:
- strays slightly from a pythony approach (feels like node)
Using the second method exports could work like:
from component import export
@export
def my_function(){
}