DHARPA-Project / lumy

Modular research platform for digital humanities.
0 stars 0 forks source link

Lumy

Structure

All front end Typescript packages are in packages directory, except the jupyterlab-extension package which is in applications directory.

JSON schema files are in schema/json.

Front end packages

Configuration files for eslint, prettier and base configuration file (tsconfig.base.json) for Typescript are here, in the top level directory.

Use yarn instead of npm because yarn has mono repo support without external packages.

VSCode support

A .vscode directory contains basic settings for linter, formatter and Python. If working with python, the settings expect virtualenv directory to be in this top directory as .venv.

Code generation

Data types are defined as JSON schemas. Corresponding Python and TypeScript code is generated from the schemas. Code can be regenerated from tools directory (run yarn install there first):

yarn gen

Code health check

To lint and type check all code (especially useful before pushing to GitHub which runs this as a post push action):

yarn verify

Or do it separately for each language:

yarn typescript:check
yarn python:check

Running in development mode

Running within JupyterLab

Convenient because it manages iPython kernels and either terminal or a notebook can be attached to a running kernel.

1. Virtualenv

Prepare a dedicated virtualenv with Python 3.7+.

virtualenv .venv
source .venv/bin/activate

2. Install Python requirements

Jupyter Lab

pip install jupyterlab>=3.0.0

Lumy middleware in development mode

pip install -U --extra-index-url https://pypi.fury.io/dharpa/ lumy-middleware

3. Install Jupyter Lab extension

The following steps are executed in applications/jupyterlab-extension directory.

Prepare dependencies and install the extension into Jupyter Lab:

yarn install
yarn develop

Start Jupyter Lab in a terminal session:

jupyter lab

In another terminal session start the watcher process that will watch for changes in the Typescript code, recompile them and make them available in Jupyter Lab extension:

yarn watch

Jupyter Lab tab needs to be reloaded to get the changes applied.

Running front end as a standalone web app with mocked back end

The following steps are executed in applications/standalone directory.

yarn install

Then start Webpack dev server that will watch and recompile TypeScript files and then reload the browser tab.

yarn start

The web app is available on http://localhost:8080/.