mirror of
https://github.com/gsi-upm/senpy
synced 2025-09-18 12:32:21 +00:00
Compare commits
20 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
0c54370e28 | ||
|
818b4599a9 | ||
|
25ac0220e4 | ||
|
c22f825fef | ||
|
38a3ce4cae | ||
|
61739a1903 | ||
|
10ed836f2f | ||
|
e861054cbc | ||
|
d93a7f7973 | ||
|
14459847ac | ||
|
ce275d6c4f | ||
|
b34e0e65a6 | ||
|
a8ab5bd908 | ||
|
f8e8ec19e8 | ||
|
e83a397588 | ||
|
382b8b0a50 | ||
|
7f0d76665a | ||
|
fe4ee87813 | ||
|
23796b81af | ||
|
69296a21cb |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -4,5 +4,4 @@
|
||||
dist
|
||||
build
|
||||
README.html
|
||||
__pycache__
|
||||
Dockerfile-*
|
||||
__pycache__
|
@@ -1,3 +0,0 @@
|
||||
from python:{{PYVERSION}}-onbuild
|
||||
|
||||
ENTRYPOINT ["python", "-m", "senpy", "-f", ".", "--host", "0.0.0.0"]
|
@@ -2,7 +2,6 @@ include requirements.txt
|
||||
include test-requirements.txt
|
||||
include README.md
|
||||
include senpy/context.jsonld
|
||||
include senpy/VERSION
|
||||
graft senpy/plugins
|
||||
graft senpy/schemas
|
||||
graft senpy/templates
|
||||
|
29
Makefile
29
Makefile
@@ -1,29 +0,0 @@
|
||||
PYVERSIONS=2.7 3.4
|
||||
NAME=senpy
|
||||
REPO=gsiupm
|
||||
VERSION=$(shell cat $(NAME)/VERSION)
|
||||
|
||||
|
||||
all: build run
|
||||
|
||||
dockerfiles: $(addprefix Dockerfile-,$(PYVERSIONS))
|
||||
|
||||
Dockerfile-%: Dockerfile.template
|
||||
sed "s/{{PYVERSION}}/$*/" Dockerfile.template > Dockerfile-$*
|
||||
|
||||
build: $(addprefix build-, $(PYVERSIONS))
|
||||
|
||||
build-%: Dockerfile-%
|
||||
docker build -t '$(REPO)/$(NAME):$(VERSION)-python$*' -f Dockerfile-$* .;
|
||||
|
||||
test: $(addprefix test-,$(PYVERSIONS))
|
||||
|
||||
test-%: build-%
|
||||
docker run --rm -w /usr/src/app/ --entrypoint=/usr/local/bin/python -ti '$(REPO)/$(NAME):$(VERSION)-python$*' setup.py test ;
|
||||
|
||||
test_pip-%:
|
||||
docker run --rm -ti python:$* pip -q install senpy ;
|
||||
|
||||
test_pip: $(addprefix test_pip-,$(PYVERSIONS))
|
||||
|
||||
.PHONY: test test-% build-% build test test_pip
|
@@ -30,7 +30,7 @@ Alternatively, you can use the development version:
|
||||
|
||||
.. code:: bash
|
||||
|
||||
git clone http://github.com/gsi-upm/senpy
|
||||
git clone git@github.com:gsi-upm/senpy
|
||||
cd senpy
|
||||
pip install --user .
|
||||
|
||||
|
@@ -2,8 +2,6 @@ Developing new plugins
|
||||
----------------------
|
||||
Each plugin represents a different analysis process.There are two types of files that are needed by senpy for loading a plugin:
|
||||
|
||||
Plugins Interface
|
||||
=======
|
||||
- Definition file, has the ".senpy" extension.
|
||||
- Code file, is a python file.
|
||||
|
||||
@@ -36,7 +34,7 @@ The basic methods in a plugin are:
|
||||
* __init__
|
||||
* activate: used to load memory-hungry resources
|
||||
* deactivate: used to free up resources
|
||||
* analyse: called in every user requests. It takes in the parameters supplied by a user and should return a senpy Response.
|
||||
* analyse: called in every user requests. It takes in the parameters supplied by a user and should return a senpy Results.
|
||||
|
||||
Plugins are loaded asynchronously, so don't worry if the activate method takes too long. The plugin will be marked as activated once it is finished executing the method.
|
||||
|
||||
|
@@ -9,4 +9,3 @@ six
|
||||
future
|
||||
jsonschema
|
||||
jsonref
|
||||
PyYAML
|
||||
|
@@ -1 +0,0 @@
|
||||
0.5.7
|
@@ -18,8 +18,4 @@
|
||||
Sentiment analysis server in Python
|
||||
"""
|
||||
|
||||
import os
|
||||
VFILE = os.path.join(os.path.dirname(__file__), "VERSION")
|
||||
|
||||
with open(VFILE, 'r') as f:
|
||||
__version__ = f.read().strip()
|
||||
__version__ = "0.5.5"
|
||||
|
@@ -22,7 +22,7 @@ import imp
|
||||
import logging
|
||||
import traceback
|
||||
import gevent
|
||||
import yaml
|
||||
import json
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -203,7 +203,7 @@ class Senpy(object):
|
||||
logger.debug("Loading plugin: {}".format(filename))
|
||||
fpath = os.path.join(root, filename)
|
||||
with open(fpath, 'r') as f:
|
||||
info = yaml.load(f)
|
||||
info = json.load(f)
|
||||
logger.debug("Info: {}".format(info))
|
||||
sys.path.append(root)
|
||||
module = info["module"]
|
||||
|
Reference in New Issue
Block a user