Skip to content

Development

Roman Grundkiewicz edited this page Mar 19, 2021 · 6 revisions

Development

Getting Started

First, install requirements and initialize the database following INSTALL.md. For development install also development requirements from requirements-dev.txt.

Then, start the server and create your first competition, test set and submission:

  1. Login to the admin panel (http://127.0.0.1:8000/admin) with your superuser account.
  2. Add two new languages.
  3. Add a new competition.
  4. Add a new test set. For example, WMT test sets in SGML and TXT format can be used. For testing you may use sample data from unit tests.
  5. Logout and "Register your team". Save the token number.
  6. Logged in as a team "Create submission". If none test set is available, check the campaign deadline and start time.
  7. Submissions should be visible on the competition leaderboard.

Directory Structure

.
├── evaluation   # App implementing comparison of two systems/submissions.
├── leaderboard  # App implementing competitions, test sets, submissions, etc.
├── ocelot       # Main Django App files
├── submissions  # Storage for submitted files, automatically created
└── testsets     # Storage for test sets, automatically created

Database

Generating the database diagram. On Ubuntu 20.04, install packages:

sudo apt-get install graphviz-dev graphviz pkg-config python3-pygraphviz
pip install django-extensions pygraphviz graphviz

Add django_extensions to INSTALLED_APPS in ocelot/settings.py, then run:

python manage.py graph_models -a -g -o db.png

The diagram generated for v0.0.1:

Python Code Validation

Code format/type checks are run automatically for new code. You may test them locally via:

pip install -r requirements-dev.txt  # Install development requirements if needed
black -S -l 75 --check .
find . -name "*.py" -not -path "./venv*" | xargs mypy
find . -name "*.py" -not -path "./venv*" | xargs pylint --fail-under 9 --rcfile setup.cfg
find . -name "*.py" -not -path "./venv*" | xargs reorder-python-imports --diff-only

Notes:

  • All migration files will start with # pylint: disable=invalid-name,missing-docstring

Testing

Unit tests:

python manage.py test
Clone this wiki locally