Skip to main content

Python SDK for our Tutorial Framework

Project description

TFW SDK for Python developers

This package is part of our next-gen Tutorial Framework (which just an additional abstraction layer). The purpose of the project is to decrease the learning curve of creating tutorial exercises, but it requires mandatory changes in the TFW baseimage as well.

Usage

In your solvable container you should prepare an app.py like this:

from tfwsdk import sdk

def on_step(curent_state: int):
    sdk.message_send('CURRENT STATE: ' + str(curent_state))

def on_deploy(curent_state: int):
    sdk.message_send('DEPLOY BUTTON CLICKED')
    return True

def on_message_button_click(curent_state: int, button_value: str):
    sdk.message_send('MESSAGE BUTTON CLICKED: ' + button_value)

def on_ide_write(current_state: int, name_of_file: str, content_of_file: str):
    sdk.message_send('IDE WRITE')

def on_terminal_command(current_state: int, executed_command: str):
    sdk.message_send('COMMAND EXECUTED: ' + executed_command)

if __name__ == '__main__':
    print('🎉 SDK STARTED 🎉')
    sdk.start()

The SDK is running in the background (with supervisor), imports your app.py and executes the above functions on corresponding events. Also, it provides some really useful functions to communicate with the TFW. Naming convention is based on the app.yml file:

---
dashboard:
  stepToFirstStateAutomatically: true
  messageSpeed: 400 # Word per minute
  layout: web-only
  enabledLayouts:
    #- terminal-ide-web
    #- terminal-ide-vertical
    #- terminal-web
    #- ide-web-vertical
    - terminal-ide-horizontal
    #- terminal-only
    #- ide-only
    - web-only
webservice:
  iframeUrl: /webservice
  showUrlBar: false
  reloadIframeOnDeploy: false
terminal:
  directory: /home/user
  terminalMenuItem: terminal # terminal / console
ide:
  patterns: 
   - /home/user/tutorial/*
  showDeployButton: true
  deployButtonText:
    TODEPLOY:  Deploy
    DEPLOYED:  Deployed
    DEPLOYING: Reloading app...
    FAILED:    Deployment failed

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tfwsdk-1.0.2.tar.gz (8.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tfwsdk-1.0.2-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

Details for the file tfwsdk-1.0.2.tar.gz.

File metadata

  • Download URL: tfwsdk-1.0.2.tar.gz
  • Upload date:
  • Size: 8.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.1 pkginfo/1.7.0 requests/2.25.0 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.2

File hashes

Hashes for tfwsdk-1.0.2.tar.gz
Algorithm Hash digest
SHA256 26ab0f8a8e9c42f9b4eb2ebf00918e4d7643ded53e336fb2755f68d62c16e54f
MD5 1f36396540f5f2e99ce56ceb8039c5ef
BLAKE2b-256 6ded0cd5a3869d727fd66ecab32ff05c287ff85cacc74820343dbe316047b344

See more details on using hashes here.

File details

Details for the file tfwsdk-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: tfwsdk-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 9.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.1 pkginfo/1.7.0 requests/2.25.0 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.2

File hashes

Hashes for tfwsdk-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a72a8d0f6f6c3877ac25b7fe9992b9351253da4c351e73086b9a95a6c6d1ba17
MD5 92b41bc2bd745180d753594b8bd43831
BLAKE2b-256 ad153720472bc1f749f68efe61aa854e07300fe324817f6d7166c04ec8b82643

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page