Metadata-Version: 2.0
Name: wikilabels
Version: 0.3.1
Summary: A generalized data labeling system for use in MediaWiki wikis
Home-page: https://github.com/halfak/Wiki-Labels
Author: Aaron Halfaker
Author-email: ahalfaker@wikimedia.org
License: MIT
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3
Classifier: Development Status :: 3 - Alpha
Classifier: License :: OSI Approved :: MIT License
Classifier: Intended Audience :: Science/Research
Classifier: Intended Audience :: System Administrators
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Topic :: Utilities
Classifier: Topic :: Scientific/Engineering
Requires-Dist: Beaker (>=1.7.0,<1.7.999)
Requires-Dist: Flask (>=0.10.1,<0.10.999)
Requires-Dist: Flask-Cors (>=2.1.2,<2.1.999)
Requires-Dist: Flask-Jsonpify (>=1.5.0,<1.5.999)
Requires-Dist: PyExecJS (>=1.1.0,<1.1.999)
Requires-Dist: UgliPyJS (>=0.2.5,<0.2.999)
Requires-Dist: docopt (>=0.6.2,<0.6.999)
Requires-Dist: mediawiki-utilities (>=0.4.18,<0.4.999)
Requires-Dist: mwoauth (>=0.2.4,<0.2.999)
Requires-Dist: psycopg2 (>=2.6.1,<2.6.999)
Requires-Dist: pyOpenSSL (>=0.15.1,<0.15.999)
Requires-Dist: pylibmc (>=1.5.0,<1.5.999)
Requires-Dist: yamlconf (>=0.1.0,<0.1.999)

# Wiki Labels
This package provides the components of a generalized labeling service for
MediaWiki.  There are two primary components, a user script to be used on
MediaWiki and a flask server for the gadget to converse with.  


## Server
The flask server is intended to be hosted by a web server, but a dev server can
be started locally with

    wikilabels dev_server

### Installation


#### Dependencies
Installation will require some additional packages to be available.

  `sudo apt-get install postgresql-server-dev-all postgresql libffi-dev npm g++ python3-dev libmemcached-dev`

#### Database setup
You'll need to create a `wikilabels` user and database. Here's a sequence of
commands that works on a fresh install of postgres (note that `sudo` rights
will be required).

Create a wikilabels user

    $ sudo useradd wikilabels

Switch to `postgres` user to run commands

    $ sudo su postgres
    $ psql
    postgres=# CREATE USER wikilabels WITH PASSWORD 'something secure';
    postgres=# CREATE DATABASE wikilabels;
    postgres=# GRANT ALL PRIVILEGES ON DATABASE wikilabels to wikilabels;
    postgres=# \q
    $ exit

Switch to `wikilabels` user to load schema

    $ sudo su wikilabels
    $ psql

Copy-paste config/schema.sql into the command prompt.

Optionally, you can also load sample data into the database by copy-pasting config/schema-testdata.sql into the command prompt

### Installing javascript dependencies

    $ npm install codemirror jquery oojs oojs-ui strftime yamljs

### Starting the dev server

    $ wikilabels dev_server --config config-localdev.yaml

## Gadget

1. Go to one of the js subpages of your user page. You can choose a page such as these:
  * [meta:User:`<Name>`/global.js](https://meta.wikimedia.org/wiki/Special:MyPage/global.js), which will be loaded in all wikis, in all skins
  * [meta:User:`<Name>`/common.js](https://meta.wikimedia.org/wiki/Special:MyPage/common.js), which will be loaded only on Meta-wiki, in all skins
  * [meta:User:`<Name>`/vector.js](https://meta.wikimedia.org/wiki/Special:MyPage/vector.js), which will be loaded only on Meta-wiki, in the vector skin
2. Copy the following to the page you have chosen:

  ```javascript
  // [[File:User:EpochFail/WikiLabels.js]] (workaround for [[phab:T35355]])
  mw.loader.load( '//labels.wmflabs.org/gadget/loader.js' );
  ```

3. Clear the cache of your browser.

This will import a live copy of the javascript.

## See also
* [meta:Wiki labels](https://meta.wikimedia.org/wiki/Wiki labels)


