Skip to main content
Version: 2.28.1

Edge CLI App Example: Project Structure

Top-Level Files

  • app_config.yaml Main configuration file for the application.

    Example:

    app_deps:
    edm:
    - enthought_edge>=2.16.0
    - packaging
    - pip
    - pyparsing
    - setuptools
    - six
    - click
    - flask>2
    - gunicorn
    - opencv_python
    - enthought_edge
    - flask
    pip:
    - Flask-Session
    app_id: docsuui
    app_version: 1.0.0
    cmd_deps:
    - docker
    config_version: 2
    env_deps:
    edm:
    - click
    - enthought_edge
    - filetype
    - gunicorn
    - oauthlib
    - pip
    - python_dateutil
    - pyyaml
    - requests
    - setuptools
    pip:
    - questionary
    exclude:
    - bootstrap.py
    framework: react
    organisation: testorg
    python_version: '3.11'
    quay_org: edge-edge-edge
    repository: quay.enthought.com
    target: prod
  • dev_settings.json.example This is an optional settings file to make development more convenient. The dev_settings inject environment variables for edge app check and edge app run.

    Usage:

    • Make a copy of this file, named 'dev_settings.json', and fill in the values.
    • This will allow EdgeSession() to work locally for testing/development.
    • DO NOT CHECK THE dev_settings.json FILE INTO SOURCE CONTROL
    {
    "EDGE_API_TOKEN": "<YOUR_API_TOKEN>",
    "EDGE_API_ORG": "<ORG_ID>",
    "EDGE_API_SERVICE_URL": "https://edge.enthought.com/services/api"
    }
  • Dockerfile Instructions for building a Docker image of the application.

    Note:

    • Make any global changes (yum install, e.g.) in the second stage.
    • Don't change the user, and in particular don't make the user "root".
  • requirements.txt Python dependencies required for the backend.

    Install with:

    pip install -r requirements.txt

React App Example

ci/

main.py

  • This is the "ci" module for the React example.

src/

startup-script.sh

  • Shell script for initializing or starting the application.

application/

app.py

  • Main backend application file.

    Example:

    from flask import Flask
    app = Flask(__name__)

    @app.route('/')
    def home():
    return "Hello, World!"

frontend/

package.json
  • Node.js project manifest for the frontend.

    Common commands:

    {
    "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build"
    }
    }

    Run the frontend:

    npm install
    npm start
src/
  • index.tsx Entry point for the React frontend app.

    Example:

    import React from 'react';
    import ReactDOM from 'react-dom';
    import App from './main';

    ReactDOM.render(<App />, document.getElementById('root'));
  • main.tsx Main application logic or root component.

    Example:

    export default function App() {
    return <h1>Welcome to the App!</h1>;
    }
style/style.css
  • Stylesheet for the frontend UI.

    Example:

    body {
    font-family: Arial, sans-serif;
    background: #f9f9f9;
    }
templates/index.html
  • HTML template for the frontend.

    Example:

    <!DOCTYPE html>
    <html lang="en">
    <head>
    <meta charset="UTF-8" />
    <title>My App</title>
    </head>
    <body>
    <div id="root"></div>
    </body>
    </html>