Coder Social home page Coder Social logo

axem-solutions / dem Goto Github PK

View Code? Open in Web Editor NEW
84.0 5.0 12.0 7 MB

Containerized Development Environment Manager for embedded development

License: Other

Python 99.76% Shell 0.24%
containerization containers devops edge edge-computing embedded embedded-systems iot toolchains tools

dem's Issues

[BUG] DEM loads irrelevant registries/repositories from Docker Hub

Description

Something has changed in the Docker Hub API. When DEM tries to load the repositories from the saved Docker Hub registries many other non-relevant repositories are loaded. This affects all commands that load the repositories.

The communication with Docker Hub must be fixed, so the proper repositories are loaded.

Example faulty behavior

Prerequisite: at least one Docker Hub registry should be added to DEM, for example axemsolutions.
image

  1. dem create test
    In the status row, it is already visible that unexpected repositories are loading.
  2. On the Dev Env Settings Window, the available tool list contains irrelevant items from unknown repositories.

Expected behavior

Prerequisite: at least one Docker Hub registry should be added to DEM, for example axemsolutions.
image

  1. dem create test
    The DEM should load the repositories from the added registries.
  2. On the Dev Env Settings Window only the added registries' repositories should be visible.

Jira: https://axem.atlassian.net/browse/DEM-284

[FeatureRequest] Tool types can be named anything

Currently, when the user creates a new Dev Env, they can only select from the “supported” tool types. The DEM doesn’t accept any Dev Env descriptor that is not included in the supported tool type list.

This behavior should be changed because it limits the usability for no reason.

The DEM should not check whether the tool type is supported or not. Any name can be given for a tool type.

The “supported” tool types are stored in the DevEnv class’s supported_tool_types class variable.

[BUG] - v0.2.0 - Check parameter handling of the commands

Describe the bug
If there is any additional parameter, the DEM raises an error, except if the --help option is used.

To Reproduce
Currently, if I try to execute

dem list --help asd
dem ignores the extra asd parameter and gives back the expected result of the

dem list --help
but if I try to execute

dem list --all --env asd
I get back an error message highlighting there is an unexpected argument.

Expected behavior

The DEM should raise an error if any additional parameter has been added with the --help option.

Test all the commands with the --help option.

[FeatureRequest] List host command

dem list-host
List the available hosts from the config file.

If there is no host in the config file, inform the user that no remote host availalbe.

[BUG] - v0.2.0 - Whitespace in Dev Env name is not acceptable.

Describe the bug
The DEM should not accept any whitespace in the name of a Dev Env.

To Reproduce

  1. Create a new Dev Env with the name “ “
    dem create " "
  2. Set the parameters for the new Dev Env.
  3. The Dev Env gets created with the name “ “.

Expected behavior

The DEM should notify the user that the name of the Dev Env can’t contain any spaces.

[DOC] Update Readme

Is your Documentation request related to a problem? Please describe.
A user always frustrated when trying to find specific parts of readme

Describe the solution you'd like
A Table of content

Additional context
Add Table of Content and Contributors to Readme

would love to work, please assign

[BUG] - v0.2.0 - DEM export - "" and '' not handled as bad parameters

Describe the bug
An unclear error message is presented when the path for the export command is ““ or “

To Reproduce

  1. dem export DEV_ENV_NAME ""
  2. The following error message is presented: FileNotFoundError: [Errno 2] No such file or directory: ''

or

  1. dem export DEV_ENV_NAME "
  2. The following error message is presented: FileNotFoundError: [Errno 2] No such file or directory: ''

Expected behavior

After the execution of the export command with ““ or “ as the path input parameter, the DEM should report: Error: Invalid input path.

[FeatureRequest] Improve the output of the `list-tools` command

Highlighting

In the output of the dem list-tools command using the color #8f64eb highlight the following text:

Local Tool Images

In the output of the dem list-tools --reg command using the color #8f64eb highlight the following text:

Available Tool Images from all registries

Add pager option to the output

The user should be able to enable the pager mechanism for the dem list-tools and dem list-tools --reg commands.

This should be an entry in the config file.

Jira: https://axem.atlassian.net/browse/DEM-286

[FeatureRequest] Create a new functionality for the clone command: get the Dev Env descriptor from the catalog

dem clone DEV_ENV_NAME

  1. The DEM looks for DEV_ENV_NAME in the added catalogs.
    If it can’t find it, an error should be presented for the user and the DEM stops the execution.
  2. The DEM saves the Dev Env descriptor to the dev_env.json file.
    If a Dev Env already exists with the name DEV_ENV_NAME in the local dev_env.json the DEM asks the user what to do.
    Overwrite it: the Dev Env descriptor in the dev_env.json gets overwritten with the one coming from the catalog.
    Abort: the DEM stops the execution. The original Dev Env descriptor remains in the local dev_env.json file
  3. The DEM finally informs the user about the successful clone operation.
  4. If the DEV_ENV_NAME is an empty string, the DEM should raise an error. (Handled by typer)
  5. The DEM should autocomplete the DEV_ENV_NAME parameter from the catalog’s available Dev Envs.

image

[FeatureRequest] Delete host command

dem del-host NAME

Deletes the host from the config file.

If the NAME is an empty string, the DEM should raise an error. (Handled by typer).

If the DEM can’t find the NAME in the list of the available hosts, it should raise an error and abort.

The DEM should autocomplete the NAME with the already available host names from the config file.

image-20231003-110214

[FeatureRequest] Dev Env Settings Window option to add unkown repository name

The user should be able to add a repository path to the Dev Env, which is located in a registry unknown to DEM.

Example

Prerequisite: The rust Docker Hub registry has not been added to DEM.

  1. Run dem create test
  2. On the Dev Env Settings Window, in the input field enter rust/rust:bookworm.
  3. Press enter. The repo should be added to the Selected Tool Images.

The repo with the given tag should be also added to the available tool images to search from in the Dev Env Settings Window.

TBD: How to remove such an item from the list?

Jira: https://axem.atlassian.net/browse/DEM-285

[FeatureRequest] DEM modify - modify the Dev Env without the UI

User shall be able to modify single images of the Env by a command:

dem modify DEV_ENV_NAME TOOL_TYPE TOOL_IMAGE
Where

  • the DEV_ENV_NAME is the Dev Env to modify
  • the TOOL_TYPE is the tool type to modify or add
  • the TOOL_IMAGE is the new tool’s image

DEM should handle at minimum the following error cases:

  • Dev Env exists locally?
  • Img exists locally or in the registry?

The DEM should autocomplete the command and the arguments:

  • DEV_ENV_NAME: the locally available Dev Envs
  • TOOL_TYPE: the tool types already present in the Dev Env
  • TOOL_IMAGE: the local and registry images

b511d83c-c3bb-4255-be0b-71e7da8e0a46

[FeatureRequest] Uninstall command - remove all images required by the Dev Env descriptor

dem uninstall DEV_ENV_NAME

  1. The DEM should look for the DEV_ENV_NAME
    If it can’t find the Dev Env, raise an error and abort.
    If found, but the Dev Env is not installed. Raise a warning for the user and abort.
  2. Go through all the required images and remove those, which are not required anymore by any other Dev Env.
  3. In the Dev Env descriptor set the “installed” key to “False”.
  4. If the DEV_ENV_NAME is an empty string, then the DEM should raise an error. (Handled by typer)
  5. The DEM should autocomplete the DEV_ENV_NAME to the locally available Dev Envs.

image

[FeatureRequest] Dev Env init for given workspace

Implement the dem init [PATH] command.


The .axem directory

Project-specific DEM settings should be placed in the project’s root under the .axem directory. The .axem directory can contain a dev_env_descriptor.json file. This file describes a template Dev Env that can be used for the project. The dev_env_descriptor.json should have the same format as the available Dev Envs from a catalog or an exported Dev Env descriptor (with the export command).


Input parameters

PATH:

  • If not set, the DEM looks for the .axem/dev_env_descriptor.json file in the CWD.
  • If the input parameter is a directory PATH, use that as the root of the project.
  1. The DEM must check if a dev_env_descriptor.json is available for the project. If not, report an error.
  2. The Dev Env is already available locally: The DEM should ask the user to overwrite the locally available Dev Env descriptor with the one from the dev_env_descriptor.json file. If the locally available one is already installed, the user should be asked if they would like to have the locally available Dev Env to get uninstalled. If the user says no, the operation should be aborted.
  3. Save the Dev Env descriptor to the dev_env.json file.

[FeatureRequest] Autocomplete and smart suggestions for commands

To learn more about autocompletion: Link

Autocomplete when typing in command:

_When the user types in dem and presses tab, then all the available commands should be listed. When the user starts to type in the name of the command, and presses the tab, only the matching commands should be listed.

These commands should be covered: info, list, create, rename, modify, delete, export, load, list-cat, add-cat, del-cat, list-reg, add-reg, del-reg._

Smart suggestion for arguments

dem info DEV_ENV_NAME
Auto complete for the DEV_ENV_NAME. Should list all the local and catalog Dev Envs.

dem list
Auto complete for the options: local, all, env, tool

dem rename DEV_ENV_NAME NEW_DEV_ENV_NAME
Auto complete for the DEV_ENV_NAME with the list of the locally available Dev Envs.

dem modify DEV_ENV_NAME
Auto complete for the DEV_ENV_NAME with the list of the locally available Dev Envs.

dem delete DEV_ENV_NAME
Auto complete for the DEV_ENV_NAME with the list of the locally available Dev Envs.

dem export DEV_ENV_NAME
Auto complete for the DEV_ENV_NAME with the list of the locally available Dev Envs.

dem del-cat NAME
Auto complete for the NAME with the list of the added catalogs.

dem del-reg NAME
Auto complete for the NAME with the list of the added registries.

[FeatureRequest] Add host command

dem add-host NAME ADDRESS
The user should be able to add a host.

NAME: name of the host

ADDRESS: IP or hostname of the host

The DEM should save this information in the ~/.home/axem/dem/config.json file:

"hosts": [{
  "name": "host name",
  "address": "host address"
}]

Example:

"hosts": [{
        "name": "strong",
        "address": "192.168.1.70"
    },
    {
        "name": "CI/CD",
        "address": "10.0.0.1"
    },
    {
        "name": "cloud",
        "address": "169.254.7.137"
    }
]

If the NAME is already takes, the DEM should ask the use if they would like to overwrite it or not.

If either the NAME or the ADDRESS command is empty the DEM should raise an error. (Handled by type).

image-20231003-110025

[BUG] During the installation of a Dev Env, the tool image can't be pulled, if the image's registry is not available

Problem description

The user can’t install a Dev Env that requires a tool image located in a registry, which is not added to DEM. Meaning, for example, if someone would like to install a Dev Env from axem’s open catalog, they also must add the registries that are not yet added.

Possible solutions

Make it possible to install the Dev Env without the catalogs

This is possible because Dev Env descriptors contain the registries where the images are stored.

This approach is problematic though, because if the user would like to modify the Dev Env, all the required images with repositories not added to DEM will report an error.

Cloning the Dev Env automatically adds the referenced repositories

DEM should check if a cloned Dev Env’s tool images are located in repositories that have not yet been added and then add them. The newly added repository names should be reported to the user.

The check should happen after the clone, create, and modify commands.

How to reproduce the issue

  1. Add the crops repository:
    dem add-reg crops https://registry.hub.docker.com

  2. Create a new Dev Env:
    dem create yocto

  • From the Tool list select an image. (E.g. crops/poky:ubuntu-22.04)
  • Save the Dev Env
  1. Delete the crops repo:
    dem del-reg crops

  2. Install the Dev Env:
    dem install yocto

Now you should see the following error:
Platform error: The crops/poky:ubuntu-22.04 image is not available.

Output of dem info yocto:
image

When trying to modify the Dev Env (dem modify yocto):

The crops/poky:ubuntu-22.04 is not available anymore.
By continuing, the missing tool images will be removed from the Development Environment. [y/N]:

Expected behaviour
The user should be able to install the Dev Env even if a repo is not added. The DEM should add the missing repo.

Jira: https://axem.atlassian.net/browse/DEM-283

[FeatureRequest] Dev Env Settings Window input field

After the Dev Env Settings Window has been loaded, the input field should be the active UI item. If the input field is active, the '*' (asterisk) cursor should disappear.
The input field should implement a simple search functionality:

  • Match any part of the Tool image names (the full name, so with the registry).
  • Case insensitive.
  • No regex or special character handling is needed.

As the user types into the search field, the item list should be filtered accordingly, after every keypress.
If the user presses enter, the cursor should appear again, but in the filtered list. The list should become the active UI item.
Pressing 'esc' should clear the search.

The user should be able to navigate between the UI items by pressing the ‘tab’ or ‘shift’ + ‘tab’ keys.

The Dev Env Settings window should look like this:
dev_env_settings_window_tool_search_option

Entering the text to search for should look like this:
dev_env_settings_window_searched

Jira: https://axem.atlassian.net/browse/DEM-282

[FeatureRequest] Rewrite the Dev Env Settings Window

Is your feature request related to a problem? Please describe.
The Dev Env Settings Window utilizes the rich library to create UI elements. These UI elements are implemented in the menu.py file. It's tedious and redundant to implement these components because other Python libraries already provide them.

Describe the solution you'd like
Rewrite the Dev Env Settings Window using Textual. Textual provides textual UI elements.
Everything should look and work the same as now, so the current UI can be used as a reference for validation.

This is how the Dev Env Settings Window looks like:
image

Easiest way to reach this UI is by the dem create command.

The functionality of the window should remain the same, but the sizes of the upper two panels should change. In v0.6.x the upper two panels dynamically changed with the number of items included in them. For the new layout, these two panels should always take all the available sizes regardless of the number of items listed in them.

Describe alternatives you've considered
Alternative libraries might also be used instead of Textual, but please let's discuss your recommendation before you jump into the implementation.

Additional context
The two affected files: menu.py and dev_env_settings_window.py

Jira: https://axem.atlassian.net/browse/DEM-267

[FeatureRequest] Dev Env Settings Window scrolling

The not-fitting items are simply cut off if the list can’t fit in the Tool Image selector panel. not_fitting_dev_env_settings_window

Describe the solution you'd like
Implement the scrolling feature, so the not-fitting items are also accessible.
If the cursor reaches the last list item and the user presses the down arrow or 'j' the cursor should jump back to the beginning of the list. If the cursor is at the first item, pressing the up arrow or 'k' should move the cursor to the last list item.
A scrollbar indicating where the cursor is in the whole list is nice to have but not mandatory.

Additional context
First, the #199 issue should be implemented.
The Textual module has scrollable container objects.

Jira: https://axem.atlassian.net/browse/DEM-281

[FeatureRequest] Modify the existing delete command - delete the Dev Env descriptor from the dev_env.json file

dem delete DEV_ENV_NAME

Deletes the Dev Env descriptor from the dev_env.json and removes all required unused tools images.

  1. The DEM looks for the DEV_ENV_NAME.
  • If it can’t find the Dev Env, an error should be raised and the execution should be aborted.
  1. The DEM runs the uninstall for the Dev Env. It removes all the tool images, which are not required anymore by any other Dev Env.
  2. The DEM finally removes the Dev Env descriptor from the dev_env.json file.
  3. If the DEV_ENV_NAME is an empty parameter, the DEM should raise an error. (Handled by type)
  4. The DEM should autocomplete the DEV_ENV_NAME parameter with the locally available Dev Envs.

image-20231003-101549

[FeatureRequest] Install command - install a Dev Env from a locally available Dev Env descriptor

dem install DEV_ENV_NAME

  1. The DEM looks for the DEV_ENV_NAME in the local dev_env.json.
    If the DEM can’t find the Dev Env, it should report an error for the user and stop the execution.
  2. The DEM pulls the images one-by-one from the registries to the local host machine.
  3. The DEM should inform the user about the successful operation if all the images are pulled.
  4. In the Dev Env descriptor set the “installed” key to “True”.
    "installed": "True",
  5. If the DEV_ENV_NAME is an empty parameter, the DEM shall raise an error. (Handled by typer.)
  6. The DEM should autocomplete the DEV_ENV_NAME with the locally already available Dev Envs.

image

[FeatureRequest] Rename the existing clone command to `cp`

The dem clone command will have a new purpose: it will copy the selected Dev Env descriptor from the catalog and save it in the local dev_env.json.

The new dem cp command should have the same functionality as the current dem clone one, meaning there is no need to modify the command logic.

Documentation: Commands - dem

The expected behavior (this is already implemented as the clone command):

  1. The DEM looks for the DEV_ENV_NAME in the local dev_env.json file.
    If it can’t find it, an error should be raised and the DEM aborts the execution.
  2. The DEM should check if there is already a Dev Env with the name of NEW_DEV_ENV_NAME.
    If the new name has already been taken, the DEM should ask the user to overwrite it:
    If yes, overwrite the Dev Env descriptor with the one coming from the DEV_ENV_NAME
    If no, abort the execution.
    If the name is not taken, then just create a new Dev Env descriptor entry in the local dev_env.json file.
  3. If either the DEV_ENV_NAME or the NEW_DEV_ENV_NAME are empty strings, then the DEM should report an error and abort the execution. (Handled by typer)
  4. The DEM should autocomplete the DEV_ENV_NAME parameter from the list of already available local Dev Envs.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.