Skip to content

Commit

Permalink
WIP autoloader init, specs.json initial structure, probably redundant…
Browse files Browse the repository at this point in the history
…, can be replaced to assume __init__.py
  • Loading branch information
NiteshOswal committed Apr 12, 2017
1 parent eaaf31b commit 9c9fdc5
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 3 deletions.
Empty file modified Modules/MotivationBot/conversation.csv
100644 → 100755
Empty file.
3 changes: 3 additions & 0 deletions Modules/MotivationBot/specs.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{
"name": "MotivationBot",
"version": "1.0.0",
"main": "./__init__.py",
"nlg": "naive"
}
20 changes: 20 additions & 0 deletions __init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import sys
from os import path
# add all the modules in it's lifetime to the path, failsafe for others
CURRENT_DIR = path.join(path.abspath(path.dirname(__file__)))
ACTIONS_A = path.join(CURRENT_DIR, "ActionsA")
sys.path.append(CURRENT_DIR)
sys.path.append(ACTIONS_A)


from natlib import *

pipeline = Pipeline()

# Modules Path: Directory where all the modules/apps are present!
MODULES_DIRECTORY = path.join(path.abspath(path.dirname(__file__)), "modules")

# Import Map: Map of the module with their entrypoint!
IMPORTMAPS = path.join(MODULES_DIRECTORY, "import.map")

autoload(IMPORTMAPS)
4 changes: 1 addition & 3 deletions natlib/autoload.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,4 @@ def autoload(map):
}
temp["module"] = import_module(".{}".format(app), "modules")
except ValueError, e:
print "Cannot load the module " + str(e)

print apps
print "Cannot load the module " + str(e)

0 comments on commit 9c9fdc5

Please sign in to comment.