Skip to content

Latest commit

 

History

History
94 lines (66 loc) · 4.94 KB

README.md

File metadata and controls

94 lines (66 loc) · 4.94 KB

labdiscoverylib

CircleCI documentation Version Python versions

labdiscoverylib is a library for creating LabDiscoveryEngine remote laboratories, based on weblablib.

A remote laboratory is a software and hardware system that enables students to access real laboratories through the Internet. For example, a student can be learning how to program a robot by writing code in a computer at home and sending it to a remote laboratory, where the student can see how the program behaves in a real environment.

Creating a remote laboratory may imply many layers, such as authentication, authorization, scheduling, etc., so Remote Laboratory Management Systems (RLMS) were created to make the common layers of remote laboatories. WebLab-Deusto is an Open Source RLMS, and it has multiple ways (see the docs) to create a remote laboratory (in different programming languages, etc.).

In the case of Python, with the popular Flask microframework, labdiscoverylib is the wrapper used to create unmanaged labs. Unmanaged labs is a term used in WebLab-Deusto to refer laboratories where the authors develop the full stack (server, client, deployment), as opposed to managed labs.

If you are familiar with Flask and with Web development, and want to be able to customize everything but not need to implement all the layers of authentication, administration, etc., this library would be very useful. Furthermore, this library allows you to develop remote laboratories for many environments (from regular computers with Linux to systems such as Raspberry Pi). And it integrates very well with other Flask components such as Flask-SocketIO, Flask-SQLAlchemy for databases or Flask-Assets.

Documentation

Read the documentation: https://developers.labsland.com/labdiscoverylib/

Installation

Simply use pip:

  pip install labdiscoverylib

Simple usage

from flask import Flask, url_for
from labdiscoverylib import WebLab, weblab_user, requires_active

app = Flask(__name__)
app.config.update({
    'SECRET_KEY': 'secret', # MUST CHANGE
    'WEBLAB_USERNAME': 'lde',
    'WEBLAB_PASSWORD': 'password',
})

weblab = WebLab(app)

@weblab.on_start
def on_start(client_data, server_data):
    # ...
    print("Starting user")

@weblab.on_dispose
def on_dispose():
    # ...
    print("Ending user")

@weblab.initial_url
def initial_url():
    return url_for('index')

@app.route('/')
@requires_active
def index():
    return "Hello, {}".format(weblab_user.username)

if __name__ == '__main__':
    app.run(debug=True)

Advanced examples

You may find here the following examples:

  • simple: basic usage, all in one file.
  • advanced: more advanced usage, with separation of files, tasks, more complex session management
  • complete: based on advanced, but using WebSockets with Flask-SocketIO, internationalization with Flask-Babel and minimified static files with Flask-Assets.

There is another example called quickstart, which is the one used in the documentation, which is something in between simple and advanced.

Example Reference Remote Labs

As part of the LabDiscoveryEngine project, two reference remote labs have been developed using the LabDiscoveryEngine to serve as full examples:

FPGA remote lab

The FPGA remote lab provides control over a FPGA device and is oriented towards computer vision and other applications. It is developed and hosted by H-BRS (Germany). The repository is found in: https://github.com/Andrea-Schwandt/LabDiscoverEngine-FPGA-Lab Andrea Schanwdt, its main developer, presents it here: https://youtu.be/2Da-6_kJjmI

Buck and Bust Converters remote lab

The buck and bust converters remote labs allow students to experiment with these circuits. They are developed and hosted by CPNU (Ukraine). The repositories are found in: