Skip to main content

Database backend for Annotator (http://annotatorjs.org)

Project description

Annotator Store

This is a backend store for Annotator.

The functionality can roughly be separated in two parts:

  1. An abstraction layer wrapping Elasticsearch, to easily manage annotation storage. It features authorization to filter search results according to their permission settings.

  2. A Flask blueprint for a web server that exposes an HTTP API to the annotation storage. To use this functionality, build this package with the [flask] option.

Getting going

You’ll need a recent version of Python (Python 2 >=2.6 or Python 3 >=3.3) and ElasticSearch (>=1.0.0) installed.

The quickest way to get going requires the pip and virtualenv tools (easy_install virtualenv will get them both). Run the following in the repository root:

virtualenv pyenv
source pyenv/bin/activate
pip install -e .[flask]
cp annotator.cfg.example annotator.cfg
python run.py

You should see something like:

* Running on http://127.0.0.1:5000/
* Restarting with reloader...

If you wish to customize the configuration of the Annotator Store, make your changes to annotator.cfg or dive into run.py.

Additionally, the HOST and PORT environment variables override the default socket binding of address 127.0.0.1 and port 5000.

Store API

The Store API is designed to be compatible with the Annotator. The annotation store, a JSON-speaking REST API, will be mounted at /api by default. See the Annotator documentation for details.

Running tests

We use nosetests to run tests. You can just pip install -e .[testing], ensure ElasticSearch is running, and then:

$ nosetests
......................................................................................
----------------------------------------------------------------------
Ran 86 tests in 19.171s

OK

Alternatively (and preferably), you should install Tox, and then run tox. This will run the tests against multiple versions of Python (if you have them installed).

Please open an issue if you find that the tests don’t all pass on your machine, making sure to include the output of pip freeze.

0.13.2

  • Avoid a confusing error about reindexing when annotator is used as a library and not a standalone application (#107).

0.13.1

  • Reindexer can run even when target exists.

0.13

  • Slight changes to reindex.py to ease subclassing it.

0.12

  • A tool for migrating/reindexing elasticsearch (reindex.py) was added (#103).

  • The store returns more appropriate HTTP response codes (#96).

  • Dropped support for ElasticSearch versions before 1.0.0 (#92).

  • The default search query has been changed from a term-filtered “match all” to a set of “match queries”, resulting in more liberal interpretations of queries (#89).

  • The default elasticsearch analyzer for annotation fields has been changed to “keyword” in order to provide more consistent case-sensitivity behaviours (#73, #88).

  • Made Flask an optional dependency: it is now possible to use the persistence components of the project without needing Flask (#76).

  • Python 3 compatibility (#72).

0.11.2

  • SECURITY: Fixed bug that allowed authenticated users to overwrite annotations on which they did not have permissions (#82).

0.11.1

  • Fixed support for using ElasticSearch instances behind HTTP Basic auth

0.11.0

  • Add support for ElasticSearch 1.0

  • Create changelog

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

annotator-0.13.2.tar.gz (14.0 kB view details)

Uploaded Source

Built Distribution

annotator-0.13.2-py2.py3-none-any.whl (19.5 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file annotator-0.13.2.tar.gz.

File metadata

  • Download URL: annotator-0.13.2.tar.gz
  • Upload date:
  • Size: 14.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for annotator-0.13.2.tar.gz
Algorithm Hash digest
SHA256 addf164163e6d1f46253038036314641ad8966537a7e1a237b9f4855bb8be3cc
MD5 eeb788a0aa7734a458241c793b8cedcd
BLAKE2b-256 cf11d3edc12bdcfaa89eff2991bcf4f6cc3e9d2607125a05549c55664b298668

See more details on using hashes here.

File details

Details for the file annotator-0.13.2-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for annotator-0.13.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 fa7f211c97f1a2bf708c3eaf1044e5bbf8cea1c51cb088129c437a3bb72be995
MD5 d231e66143e799c3952c582aaff42488
BLAKE2b-256 46cf19c7e09b950e0f7cc8dbed142943ffd66a68f62f36bf2f1c524fe5e2bdcd

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page