Development install
This guide explains how to install covfee for development. This type of install is recommended for modifying covfee's Javascript code, including the implementation of custom tasks, covfee documentation, or the Pyton backend. A good understanding of Javascript and/or Python is recommended.
Setup
Covfee runs on Linux, Mac OS X and Windows, but you are more likely to encounter bugs on Windows. We recommend that you use WSL on Windows.
Covfee's frontend is built using webpack, which has a convenient hot-reloading development server. The Flask server used for the backend also supports reloading on changes. This guide will get you to run backend and frontend development servers:
- Install the latest version of node.js. Make sure that the
npm
command is available in your terminal.
We strongly recommend that you install covfee in a Python virtual environment. To create and activate one using venv:
python3 -m venv ./env
source ./env/bin/activate
- Install the covfee Python package in editable mode:
git clone git@github.com:josedvq/covfee.git
cd covfee
python3 -m pip install -e .
The covfee
command should now be available in the terminal. Type covfee --help
to make sure.
- Install Javascript dependencies:
yarn install
- Generate schemata (for validation) and build webpack bundles:
covfee-dev schemata
covfee-dev build
The development install is ready.
Running a covfee project in dev mode
Covfee requires a project folder with at least one project file to run. Covfee provides sample projects, or see Getting Started for instructions on how to create your own project folder and specification.
To run one of the covfee samples:
- Move to the sample project folder:
cd samples/basic
covfee make . --no-launch
- Start the webpack server from the same folder:
covfee webpack
This will start a Webpack development server with hot-reloading.
- In another terminal, at the same folder, start the flask server in dev mode. This will start the Python backend server with hot-reloading:
covfee start --dev
You should now be able to access the admin panel and open the covfee HITs. Any changes made to Python or Javascript code should be immediately hot-reloaded.
Schemata updates
The covfee schemata file created previously (covfee-dev schemata
) is used by covfee make
for validating covfee specifications. Therefore, if you make changes to covfee's Typescript interfaces in covfee/shared
during development (by, for, example, adding a new task specification), the schemata file must be re-generated for covfee validate your new interfaces correctly. To regenerate covfee schemata run:
covfee-dev schemata
This command may also need to be called when switching branches if the Typescript specification differs between branches.