1
0
mirror of https://github.com/gsi-upm/senpy synced 2025-10-18 17:28:28 +00:00

Compare commits

...

5 Commits

Author SHA1 Message Date
J. Fernando Sánchez
c5a2cf23cb typo docs/readme 2019-09-02 15:58:10 +02:00
J. Fernando Sánchez
49a183aeb6 typo readme 2019-09-02 15:43:35 +02:00
J. Fernando Sánchez
3088d9474a compatibility notice 2019-09-02 15:39:18 +02:00
J. Fernando Sánchez
0f5bc514b7 add windows+mac tests in travis 2019-09-02 13:56:30 +02:00
J. Fernando Sánchez
7ae493b3f3 Minor fix setup and docs 2019-07-18 11:40:41 +02:00
9 changed files with 110 additions and 60 deletions

View File

@@ -1,15 +1,43 @@
sudo: required
services:
- docker
language: python
env:
- PYV=3.4
- PYV=3.5
- PYV=3.6
- PYV=3.7
# - PYV=3.3 # Apt fails in this docker image
# run nosetests - Tests
script: make test-$PYV
matrix:
allow_failures:
# Windows is experimental in Travis.
# As of this writing, senpy installs but hangs on tests that use the flask test client (e.g. blueprints)
- os: windows
include:
- os: linux
language: python
python: 3.4
before_install:
- pip install --upgrade --force-reinstall pandas
- os: linux
language: python
python: 3.5
- os: linux
language: python
python: 3.6
- os: linux
language: python
python: 3.7
- os: osx
language: generic
addons:
homebrew:
# update: true
packages: python3
before_install:
- python3 -m pip install --upgrade virtualenv
- virtualenv -p python3 --system-site-packages "$HOME/venv"
- source "$HOME/venv/bin/activate"
- os: windows
language: bash
before_install:
- choco install -y python3
- python -m pip install --upgrade pip
env: PATH=/c/Python37:/c/Python37/Scripts:$PATH
# command to run tests
# 'python' points to Python 2.7 on macOS but points to Python 3.7 on Linux and Windows
# 'python3' is a 'command not found' error on Windows but 'py' works on Windows only
script:
- python3 setup.py test || python setup.py test

View File

@@ -2,23 +2,21 @@
:width: 100%
:target: http://senpy.gsi.upm.es
.. image:: https://travis-ci.org/gsi-upm/senpy.svg?branch=master
:target: https://travis-ci.org/gsi-upm/senpy
.. image:: https://lab.gsi.upm.es/senpy/senpy/badges/master/pipeline.svg
:target: https://lab.gsi.upm.es/senpy/senpy/commits/master
.. image:: https://lab.gsi.upm.es/senpy/senpy/badges/master/coverage.svg
:target: https://lab.gsi.upm.es/senpy/senpy/commits/master
.. image:: https://readthedocs.org/projects/senpy/badge/?version=latest
:target: http://senpy.readthedocs.io/en/latest/
.. image:: https://badge.fury.io/py/senpy.svg
:target: https://badge.fury.io/py/senpy
.. image:: https://travis-ci.org/gsi-upm/senpy.svg
:target: https://github.com/gsi-upm/senpy/senpy/tree/master
.. image:: https://img.shields.io/pypi/l/requests.svg
:target: https://lab.gsi.upm.es/senpy/senpy/
:target: https://lab.gsi.upm.es/senpy/senpy/
Senpy lets you create sentiment analysis web services easily, fast and using a well known API.
As a bonus, senpy services use semantic vocabularies (e.g. `NIF <http://persistence.uni-leipzig.org/nlp2rdf/>`_, `Marl <http://www.gsi.dit.upm.es/ontologies/marl>`_, `Onyx <http://www.gsi.dit.upm.es/ontologies/onyx>`_) and formats (turtle, JSON-LD, xml-rdf).
As a bonus, Senpy services use semantic vocabularies (e.g. `NIF <http://persistence.uni-leipzig.org/nlp2rdf/>`_, `Marl <http://www.gsi.dit.upm.es/ontologies/marl>`_, `Onyx <http://www.gsi.dit.upm.es/ontologies/onyx>`_) and formats (turtle, JSON-LD, xml-rdf).
Have you ever wanted to turn your sentiment analysis algorithms into a service?
With senpy, now you can.
With Senpy, now you can.
It provides all the tools so you just have to worry about improving your algorithms:
`See it in action. <http://senpy.gsi.upm.es/>`_
@@ -43,20 +41,36 @@ Alternatively, you can use the development version:
cd senpy
pip install --user .
If you want to install senpy globally, use sudo instead of the ``--user`` flag.
If you want to install Senpy globally, use sudo instead of the ``--user`` flag.
Docker Image
************
Build the image or use the pre-built one: ``docker run -ti -p 5000:5000 gsiupm/senpy``.
To add custom plugins, add a volume and tell senpy where to find the plugins: ``docker run -ti -p 5000:5000 -v <PATH OF PLUGINS>:/plugins gsiupm/senpy -f /plugins``
To add custom plugins, add a volume and tell Senpy where to find the plugins: ``docker run -ti -p 5000:5000 -v <PATH OF PLUGINS>:/plugins gsiupm/senpy -f /plugins``
Compatibility
-------------
Senpy should run on any major operating system.
Its code is pure Python, and the only limitations are imposed by its dependencies (e.g., nltk, pandas).
Currently, the CI/CD pipeline tests the code on:
* GNU/Linux with Python versions 3.4, 3.5, 3.6 and 3.7
* MacOS and homebrew's python3
* Windows 10 and chocolatey's python3
The latest PyPI package is verified to install on Ubuntu, Debian and Arch Linux.
If you have trouble installing Senpy on your platform, see `Having problems?`_.
Developing
----------
Developing/debugging
********************
Running/debugging
*****************
This command will run the senpy container using the latest image available, mounting your current folder so you get your latest code:
.. code:: bash
@@ -119,7 +133,7 @@ or, alternatively:
This will create a server with any modules found in the current path.
For more options, see the `--help` page.
Alternatively, you can use the modules included in senpy to build your own application.
Alternatively, you can use the modules included in Senpy to build your own application.
Deploying on Heroku
-------------------
@@ -127,9 +141,6 @@ Use a free heroku instance to share your service with the world.
Just use the example Procfile in this repository, or build your own.
`DEMO on heroku <http://senpy.herokuapp.com>`_
For more information, check out the `documentation <http://senpy.readthedocs.org>`_.
------------------------------------------------------------------------------------
@@ -144,6 +155,17 @@ Instead, the maintainers will focus their efforts on keeping the codebase compat
We apologize for the inconvenience.
Having problems?
----------------
Please, file a new issue `on GitHub <https://github.com/gsi-upm/senpy/issues>`_ including enough details to reproduce the bug, including:
* Operating system
* Version of Senpy (or docker tag)
* Installed libraries
* Relevant logs
* A simple code example
Acknowledgement
---------------
This development has been partially funded by the European Union through the MixedEmotions Project (project number H2020 655632), as part of the `RIA ICT 15 Big data and Open Data Innovation and take-up` programme.

View File

@@ -13,7 +13,10 @@
"* Annotating text with sentiment and emotion using interoperable services\n",
"* Switching to different services (service interoperability)\n",
"* Getting results in different formats (Turtle, XML, text...)\n",
"* Asking for specific emotion models (automatic model conversion)"
"* Asking for specific emotion models (automatic model conversion)\n",
"\n",
"The tutorial is originally published as an interactive [jupyter notebook](https://jupyter.org/) (`ipynb` file) that you can download and run locally.\n",
"The on-line documentation contains a **static** version of the notebook."
]
},
{
@@ -27,9 +30,10 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"We will use the demo server at http://senpy.gsi.upm.es abd the requests library.\n",
"We will use the demo server at http://senpy.gsi.upm.es and the requests library.\n",
"\n",
"We will use a variable for our endpoint so you can try these examples on other instances:"
"We will use a variable for our endpoint.\n",
"To try these examples on other instances simply change the value of this variable and re-run the query:"
]
},
{

View File

@@ -293,11 +293,10 @@ texinfo_documents = [
#texinfo_no_detailmenu = False
nbsphinx_prolog = """
.. note:: This page has been auto-generated from a Jupyter notebook using nbsphinx_.
.. note:: This is an `auto-generated <https://nbsphinx.readthedocs.io>`_ static view of a Jupyter notebook.
The original source is available at: https://github.com/gsi-upm/senpy/tree/master/docs//{{ env.doc2path(env.docname, base=None) }}
To run the code examples in your computer, you may download the original notebook from the repository: https://github.com/gsi-upm/senpy/tree/master/docs/{{ env.doc2path(env.docname, base=None) }}
.. _nbsphinx: https://nbsphinx.readthedocs.io/
----
"""

View File

@@ -5,10 +5,8 @@ Welcome to Senpy's documentation!
:target: http://senpy.readthedocs.io/en/latest/
.. image:: https://badge.fury.io/py/senpy.svg
:target: https://badge.fury.io/py/senpy
.. image:: https://lab.gsi.upm.es/senpy/senpy/badges/master/build.svg
:target: https://lab.gsi.upm.es/senpy/senpy/commits/master
.. image:: https://lab.gsi.upm.es/senpy/senpy/badges/master/coverage.svg
:target: https://lab.gsi.upm.es/senpy/senpy/commits/master
.. image:: https://travis-ci.org/gsi-upm/senpy.svg
:target: https://github.com/gsi-upm/senpy/senpy/tree/master
.. image:: https://img.shields.io/pypi/l/requests.svg
:target: https://lab.gsi.upm.es/senpy/senpy/

View File

@@ -1,10 +1,10 @@
Installation
------------
The stable version can be used in two ways: as a system/user library through pip, or as a docker image.
The stable version can be used in two ways: as a system/user library through pip, or from a docker image.
The docker image is the recommended way because it is self-contained and isolated from the system, which means:
Using docker is recommended because the image is self-contained, reproducible and isolated from the system, which means:
* Downloading and using it is just one command
* It can be downloaded and run with just one simple command
* All dependencies are included
* It is OS-independent (MacOS, Windows, GNU/Linux)
* Several versions may coexist in the same machine without additional virtual environments
@@ -32,27 +32,24 @@ Through PIP
cd senpy
pip install --user .
Each version is automatically tested on GNU/Linux, macOS and Windows 10.
If you have trouble with the installation, please file an `issue on GitHub <https://github.com/gsi-upm/senpy/issues>`_.
Docker Image
************
The base image of senpy comes with some builtin plugins that you can use:
The base image of senpy comes with some built-in plugins that you can use:
.. code:: bash
docker run -ti -p 5000:5000 gsiupm/senpy --host 0.0.0.0
To add your custom plugins, you can use a docker volume:
To use your custom plugins, you can add volume to the container:
.. code:: bash
docker run -ti -p 5000:5000 -v <PATH OF PLUGINS>:/plugins gsiupm/senpy --host 0.0.0.0 --plugins -f /plugins
There is a Senpy image for **python 2**, too:
.. code:: bash
docker run -ti -p 5000:5000 gsiupm/senpy:python2.7 --host 0.0.0.0
Alias

View File

@@ -13,7 +13,7 @@ max-line-length = 100
[bdist_wheel]
universal=1
[tool:pytest]
addopts = --cov=senpy --cov-report term-missing
addopts = -v --cov=senpy --cov-report term-missing
filterwarnings =
ignore:the matrix subclass:PendingDeprecationWarning
[coverage:report]

View File

@@ -16,9 +16,10 @@ limitations under the License.
from setuptools import setup
from os import path
import io
try:
with open('senpy/VERSION') as f:
with io.open('senpy/VERSION') as f:
__version__ = f.read().strip()
assert __version__
except IOError: # pragma: no cover
@@ -28,13 +29,13 @@ except IOError: # pragma: no cover
def parse_requirements(filename):
""" load requirements from a pip requirements file """
with open(filename, 'r') as f:
with io.open(filename, 'r') as f:
lineiter = list(line.strip() for line in f)
return [line for line in lineiter if line and not line.startswith("#")]
this_directory = path.abspath(path.dirname(__file__))
with open(path.join(this_directory, 'README.rst'), encoding='utf-8') as f:
with io.open(path.join(this_directory, 'README.rst'), encoding='utf-8') as f:
long_description = f.read()

View File

@@ -1,3 +1,4 @@
mock
pytest-cov
pytest
pandas