Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: version management #74

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open

WIP: version management #74

wants to merge 10 commits into from

Conversation

Hahihula
Copy link
Collaborator

@Hahihula Hahihula commented Nov 27, 2024

We are moving towards the management of the installations:
new CLI looks like


Usage: eim [OPTIONS] <COMMAND>

Commands:
  install   Install ESP-IDF versions and tools
  list      List installed ESP-IDF versions and tools
  select    Select an ESP-IDF version as active
  discover  Discover available ESP-IDF versions
  remove    Remove specific ESP-IDF version
  rename    Remove specific ESP-IDF version
  purge     Purge all ESP-IDF installations
  help      Print this message or the help of the given subcommand(s)

Options:
  -l, --locale <LOCALE>
          Set the language for the wizard (en, cn)

  -v, --verbose...
          Increase verbosity level (can be used multiple times)

      --log-file <LOG_FILE>
          file in which logs will be stored (default: eim.log)

  -h, --help
          Print help (see a summary with '-h')

  -V, --version
          Print version

where the current CLI is hidden under the install command

@kolipakakondal
Copy link
Collaborator

Hi @Hahihula Plan looks good to me. Can we have the builds for this so that we can run?

@Hahihula
Copy link
Collaborator Author

Hahihula commented Dec 2, 2024

Hi @Hahihula Plan looks good to me. Can we have the builds for this so that we can run?

sorry, now the build should be going

Copy link
Collaborator

@kolipakakondal kolipakakondal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ESP-IDF Install Manager
Usage: eim4 [OPTIONS]

Can we use the consistent naming "ESP-IDF Installation Manager" everywhere?

@kolipakakondal
Copy link
Collaborator

Do you want to save the installer configuration? (y/n) › no

Can we set saving the configuration as the default option?

@kolipakakondal
Copy link
Collaborator

Configuration saved successfully to config.toml

  1. It seems the generated file name is eim_config.toml, but the messages display it as config.toml. Can you check this?
  2. Can we display the absolute path to the user so that users know where it's generated?

@kolipakakondal
Copy link
Collaborator

============================================
to activate the environment, run the following command in your terminal:
source "/Users/kondalkolipaka/.espressif/activate_idf_v5.3.1.sh"

Is it possible to highlight the source /Users/kondalkolipaka/.espressif/activate_idf_v5.3.1.sh in color so that the user can clearly identify the command from the entire log and know which command to run?"

@kolipakakondal
Copy link
Collaborator

Options:
  -l, --locale <LOCALE>
          Set the language for the wizard (en, cn)

  -v, --verbose...
          Increase verbosity level (can be used multiple times)

      --log-file <LOG_FILE>
          file in which logs will be stored (default: eim.log)

  -h, --help
          Print help (see a summary with '-h')

  -V, --version
          Print version

Can we remove the newline between each command option and show the text message in the same line so that users can view them more clearly?

Something like this

Options:
  -l, --locale <LOCALE>      Set the language for the wizard (en, cn)
  -v, --verbose...           Increase verbosity level (can be used multiple times)
      --log-file <LOG_FILE>  file in which logs will be stored (default: eim.log)
  -h, --help                 Print help (see more with '--help')
  -V, --version              Print version

@kolipakakondal
Copy link
Collaborator

/Users/kondalkolipaka/Downloads/eim4 -V
idf-im-cli 0.1.5

Instead of using idf-im-cli, can we use eim or ESP-IDF Installation Manager when displaying the version number, so that users don't have to worry about what idf-im-cli is?

@kolipakakondal
Copy link
Collaborator

? Please select the desired ESP-IDF version ›
✔ v5.3.1
⬚ v5.2.3
⬚ v5.1.5
⬚ v5.0.7
⬚ master

User experience issue: When I move my cursor to v5.2.3 and press Enter, it would be great if that version could be selected by default and installed, instead of requiring me to press the space bar to select it and then press Enter. I believe this change could improve the user experience and reduce the number of clicks required for the user. Think about it!

@kolipakakondal
Copy link
Collaborator

The path already exists. Do you want to proceed with installation without redownloading IDF(y/s)? · no

Can we set the default response to 'yes' instead of 'no'? Isn't 'yes' typically the default action when a user is trying to install something?

@kolipakakondal
Copy link
Collaborator

% source "/Users/kondalkolipaka/.espressif/activate_idf_v5.2.3.sh"
Added environment variable ESP_IDF_VERSION = v5.2.3
Added environment variable IDF_TOOLS_PATH = /Users/kondalkolipaka/.espressif/v5.2.3/tools
Added environment variable IDF_PATH = /Users/kondalkolipaka/.espressif/v5.2.3/esp-idf
Added environment variable ESP_ROM_ELF_DIR = /Users/kondalkolipaka/.espressif/v5.2.3/tools/tools/esp-rom-elfs
Added environment variable OPENOCD_SCRIPTS = /Users/kondalkolipaka/.espressif/v5.2.3/tools/tools/openocd-esp32/v0.12.0-esp32-20240821/openocd-esp32/share/openocd/scripts
Added environment variable IDF_PYTHON_ENV_PATH = /Users/kondalkolipaka/.espressif/v5.2.3/tools/python
Added proper directory to PATH
Activated virtual environment at /Users/kondalkolipaka/.espressif/v5.2.3/tools/python
Environment setup complete for the current shell session.
These changes will be lost when you close this terminal.
You are now using IDF version v5.2.3.
(python) kondalkolipaka@kondals-MacBook-Pro-2024 cert % /Users/kondalkolipaka/Downloads/eim4 list
Listing installed versions...
Installed versions:

  • v5.3.1 (selected)
  • v5.2.3

% idf.py --version
ESP-IDF v5.2.3

It looks like eim list doesn't show the currently activated version. Could you check? I have activated v5.2.3 version but it still shows v5.3.1 as selected

@kolipakakondal
Copy link
Collaborator

% source "/Users/kondalkolipaka/.espressif/activate_idf_v5.2.3.sh"
Added environment variable ESP_IDF_VERSION = v5.2.3
Added environment variable IDF_TOOLS_PATH = /Users/kondalkolipaka/.espressif/v5.2.3/tools
Added environment variable IDF_PATH = /Users/kondalkolipaka/.espressif/v5.2.3/esp-idf
Added environment variable ESP_ROM_ELF_DIR = /Users/kondalkolipaka/.espressif/v5.2.3/tools/tools/esp-rom-elfs
Added environment variable OPENOCD_SCRIPTS = /Users/kondalkolipaka/.espressif/v5.2.3/tools/tools/openocd-esp32/v0.12.0-esp32-20240821/openocd-esp32/share/openocd/scripts
Added environment variable IDF_PYTHON_ENV_PATH = /Users/kondalkolipaka/.espressif/v5.2.3/tools/python
Added proper directory to PATH
Activated virtual environment at /Users/kondalkolipaka/.espressif/v5.2.3/tools/python
Environment setup complete for the current shell session.
These changes will be lost when you close this terminal.
You are now using IDF version v5.2.3.
(python) kondalkolipaka@kondals-MacBook-Pro-2024 cert % /Users/kondalkolipaka/Downloads/eim4 list
Listing installed versions...
Installed versions:

  • v5.3.1 (selected)
  • v5.2.3

% idf.py --version
ESP-IDF v5.2.3

It looks like eim list doesn't show the currently activated version. Could you check? I have activated v5.2.3 version but it still shows v5.3.1 as selected

Got it! So, I need to run eim select to switch the version, which is good. But can we also align the source activate command with this? When I run the source command to activate a particular version, it doesn't reflect in the version shown by eim list. Right after the installation, we ask the user to run the source command to activate, but when the user uses eim list, it shows a different version as selected. This might be confusing for the user.

@kolipakakondal
Copy link
Collaborator

(python) kondalkolipaka@kondals-MacBook-Pro-2024 Downloads % ./eim4 list
Listing installed versions...
Installed versions:

When no versions are available, can we make the text clearer by saying, 'No versions found. Use eim install to install a new ESP-IDF version.

That's basically driving the user what action user could take next.

@kolipakakondal
Copy link
Collaborator

? Please select all of the target platforms (esp chips) ›
✔ all
⬚ esp32
⬚ esp32c2
⬚ esp32c3
⬚ esp32c5
⬚ esp32c6
⬚ esp32h2
⬚ esp32p4
⬚ esp32s2
⬚ esp32s3

Can we change the text to Please select the target platforms:(esp chips):

@kolipakakondal
Copy link
Collaborator

? Select the source from which to download esp-idf ›
https://github.com
https://jihulab.com/esp-mirror

Can we change this to Select a source from which to download ESP-IDF' considering that we are asking the user to choose one from the list?

@kolipakakondal
Copy link
Collaborator

esp_idf.json

Can we rename this file to 'eim_idf.json'? Following the 'eim_' naming convention (we can follow the same convention for all other files as well which are generated by eim tool) would make it clearer to the user which tool generated the file. For example, if the user goes to the /Users/x/.espressif/ folder, they might find both 'eim_idf.json' and 'idf-env.json,' but it wouldn't be clear which tool generated each file.

@kolipakakondal
Copy link
Collaborator

./eim purge

After purging, I thought it would remove the entire entry(in this case 5.3.1) from esp_idf.json, but I still see it. Could you check?

{
  "$schema": "http://json-schema.org/schema#",
  "$id": "http://dl.espressif.com/dl/schemas/esp_idf",
  "_comment": "Configuration file for ESP-IDF IDEs.",
  "_warning": "Use / or \\ when specifying path. Single backslash is not allowed by JSON format.",
  "gitPath": "/opt/homebrew/bin/git",
  "idfToolsPath": "/Users/kondalkolipaka/.espressif",
  "idfSelectedId": "esp-idf-af01f4be6b7d192340c83b9de8f69002",
  "idfInstalled": {
    "esp-idf-567b30732b8ffca6f13db971a5f7878e": {
      "version": "5.4.0",
      "python": "/Users/kondalkolipaka/.espressif/python_env/idf5.4_py3.12_env/bin/python",
      "path": "/Users/kondalkolipaka/esp/esp-idf-master"
    },
    "esp-idf-af01f4be6b7d192340c83b9de8f69002": {
      "version": "5.3.1",
      "python": "/Users/kondalkolipaka/.espressif/python_env/idf5.3_py3.12_env/bin/python",
      "path": "/Users/kondalkolipaka/esp/v5.3.1/esp-idf"
    }
  }
}

@kolipakakondal
Copy link
Collaborator

kolipakakondal commented Dec 3, 2024

2024-12-03T13:42:28.665497+05:30 - WARN - No OpenOCD scripts found in /Users/kondalkolipaka/.espressif2/v5.1.5/tools/tools/openocd-esp32
✔ Do you want to save the installer configuration? · yes
Configuration saved successfully to config.toml

I was expecting the configuration file to be saved in /Users/kondalkolipaka/.espressif2 as well, but I couldn't find it. This is the case when I use a different installation directory.

@kolipakakondal
Copy link
Collaborator

2024-12-03T13:51:53.100777+05:30 - WARN - No ELF ROM directories found in /Users/kondalkolipaka/.espressif2/v5.3.1/tools/tools/esp-rom-elfs
2024-12-03T13:51:53.102686+05:30 - WARN - No OpenOCD scripts found in /Users/kondalkolipaka/.espressif2/v5.3.1/tools/tools/openocd-esp32

Isn't it confusing to the user when we show this warning saying 'No OpenOCD scripts found,' while you're actually verifying and downloading them and then It will be available after that. Please check?

@kolipakakondal
Copy link
Collaborator

Screenshot 2024-12-03 at 2 07 11 PM

There seems to be an issue finding all available versions when you've selected a different directory for installation. I don't see v5.1.5 in the list

Screenshot 2024-12-03 at 2 07 44 PM

@kolipakakondal
Copy link
Collaborator

(python) kondalkolipaka@kondals-MacBook-Pro-2024 Downloads % ./eim4 remove
Available versions:
✔ Which version do you want to remove? · v5.2.3
Removed version: v5.2.3
(python) kondalkolipaka@kondals-MacBook-Pro-2024 Downloads % ./eim4 select
Available versions:
✔ Which version do you want to select? · v5.3.1
Selected version: v5.3.1
(python) kondalkolipaka@kondals-MacBook-Pro-2024 Downloads % idf.py --version
zsh: no such file or directory: /Users/kondalkolipaka/.espressif/v5.2.3/tools/python/bin/python3

There seems to be some issue in activating the environment and setting the environment variables. After running eim select for v5.3.1, if I run idf.py version, it points to v5.2.3

@kolipakakondal
Copy link
Collaborator

Overall good work @Hahihula it would be great if we can improve on the reported issues.

@Hahihula
Copy link
Collaborator Author

Hahihula commented Dec 3, 2024

The path already exists. Do you want to proceed with installation without redownloading IDF(y/s)? · no

Can we set the default response to 'yes' instead of 'no'? Isn't 'yes' typically the default action when a user is trying to install something?

I think this typically means he has chosen a directory which he didn't want to choose because the IDF is already installed there, so it made sense to me to to have 'no' as default. I'ts defensive approach. But we can also provide him with more options, like overwrite the directory and start over, or choose different directory. WDYT?

@Hahihula
Copy link
Collaborator Author

Hahihula commented Dec 3, 2024

esp_idf.json

Can we rename this file to 'eim_idf.json'? Following the 'eim_' naming convention (we can follow the same convention for all other files as well which are generated by eim tool) would make it clearer to the user which tool generated the file. For example, if the user goes to the /Users/x/.espressif/ folder, they might find both 'eim_idf.json' and 'idf-env.json,' but it wouldn't be clear which tool generated each file.

Are you sure? I mean, we wanted to maintain the name because current installer uses that name

@Hahihula
Copy link
Collaborator Author

Hahihula commented Dec 3, 2024

./eim purge

After purging, I thought it would remove the entire entry(in this case 5.3.1) from esp_idf.json, but I still see it. Could you check?

{
  "$schema": "http://json-schema.org/schema#",
  "$id": "http://dl.espressif.com/dl/schemas/esp_idf",
  "_comment": "Configuration file for ESP-IDF IDEs.",
  "_warning": "Use / or \\ when specifying path. Single backslash is not allowed by JSON format.",
  "gitPath": "/opt/homebrew/bin/git",
  "idfToolsPath": "/Users/kondalkolipaka/.espressif",
  "idfSelectedId": "esp-idf-af01f4be6b7d192340c83b9de8f69002",
  "idfInstalled": {
    "esp-idf-567b30732b8ffca6f13db971a5f7878e": {
      "version": "5.4.0",
      "python": "/Users/kondalkolipaka/.espressif/python_env/idf5.4_py3.12_env/bin/python",
      "path": "/Users/kondalkolipaka/esp/esp-idf-master"
    },
    "esp-idf-af01f4be6b7d192340c83b9de8f69002": {
      "version": "5.3.1",
      "python": "/Users/kondalkolipaka/.espressif/python_env/idf5.3_py3.12_env/bin/python",
      "path": "/Users/kondalkolipaka/esp/v5.3.1/esp-idf"
    }
  }
}

COuld you please provide the output of the command? Remove should remove the version, purge should remove all of the versions/

@Hahihula
Copy link
Collaborator Author

Hahihula commented Dec 3, 2024

2024-12-03T13:42:28.665497+05:30 - WARN - No OpenOCD scripts found in /Users/kondalkolipaka/.espressif2/v5.1.5/tools/tools/openocd-esp32
✔ Do you want to save the installer configuration? · yes
Configuration saved successfully to config.toml

I was expecting the configuration file to be saved in /Users/kondalkolipaka/.espressif2 as well, but I couldn't find it. This is the case when I use a different installation directory.

installator config is always saved to current working directory

@Hahihula
Copy link
Collaborator Author

Hahihula commented Dec 3, 2024

There seems to be an issue finding all available versions when you've selected a different directory for installation. I don't see v5.1.5 in the list

aren't you referring to the same issue as ticket EIM-83 ?

@Hahihula
Copy link
Collaborator Author

Hahihula commented Dec 3, 2024

(python) kondalkolipaka@kondals-MacBook-Pro-2024 Downloads % ./eim4 remove
Available versions:
✔ Which version do you want to remove? · v5.2.3
Removed version: v5.2.3
(python) kondalkolipaka@kondals-MacBook-Pro-2024 Downloads % ./eim4 select
Available versions:
✔ Which version do you want to select? · v5.3.1
Selected version: v5.3.1
(python) kondalkolipaka@kondals-MacBook-Pro-2024 Downloads % idf.py --version
zsh: no such file or directory: /Users/kondalkolipaka/.espressif/v5.2.3/tools/python/bin/python3

There seems to be some issue in activating the environment and setting the environment variables. After running eim select for v5.3.1, if I run idf.py version, it points to v5.2.3

As we discussed, the eim select select version in the config for the purposes of IDE, it can not modify your current shell

Copy link

github-actions bot commented Dec 3, 2024

Test Results

3 files   -  6  10 suites   - 26   50s ⏱️ - 1h 17m 2s
2 tests  -  9   0 ✅  -  9  0 💤 ±0  2 ❌ ±0 
4 runs   - 26   1 ✅  - 23  0 💤 ±0  3 ❌  - 3 

For more details on these failures, see this check.

Results for commit b483578. ± Comparison against base commit 3ba9997.

This pull request removes 9 tests.
"after all" hook for "Should install IDF using specified parameters" ‑ Installation using custom settings run custom installation using given parameters "after all" hook for "Should install IDF using specified parameters"
Should build project for the selected target ‑ Installation using default settings create and build sample project Should build project for the selected target
Should create a new project based on a template ‑ Installation using default settings create and build sample project Should create a new project based on a template
Should install IDF using specified parameters ‑ Installation using custom settings run custom installation using given parameters Should install IDF using specified parameters
Should install IDF using wizard and default values ‑ Installation using default settings Check IDF Install Wizard steps Should install IDF using wizard and default values
Should set the target ‑ Installation using default settings create and build sample project Should set the target
should handle invalid arguments ‑ Installation using default settings CLI Arguments Tests should handle invalid arguments
should show correct version number ‑ Installation using default settings CLI Arguments Tests should show correct version number
should show help with --help argument ‑ Installation using default settings CLI Arguments Tests should show help with --help argument

@kolipakakondal
Copy link
Collaborator

esp_idf.json

Can we rename this file to 'eim_idf.json'? Following the 'eim_' naming convention (we can follow the same convention for all other files as well which are generated by eim tool) would make it clearer to the user which tool generated the file. For example, if the user goes to the /Users/x/.espressif/ folder, they might find both 'eim_idf.json' and 'idf-env.json,' but it wouldn't be clear which tool generated each file.

Are you sure? I mean, we wanted to maintain the name because current installer uses that name

I was considering a scenario where a user has already been using the Windows offline installer, which would have generated an esp_idf.json file with some content. If they then use the EIM tool for installation, what should we do? Are we going to overwrite the file? Users might continue using the Windows offline installer for the CLI even after the EIM release, which could create a conflict.

@kolipakakondal
Copy link
Collaborator

As we discussed, the eim select select version in the config for the purposes of IDE, it can not modify your current shell

I understand this is a technical challenge but won't be a good experience to the end user. Please see if you can bring some solution for this. Maybe unsetting and cleaning the all the environment variables and PATH before we call add_env_variable() because we already know the existing variables and what paths appended to the PATH in the current shell by referring to the currently activated script file(activate_idf_v5.3.1.sh)

@brianignacio5
Copy link

brianignacio5 commented Dec 4, 2024

How about source the activation script in the current terminal ? Shouldn't it provide the desired result to re-configure it ? Something like . "C:\Path\To\Script.ps1" or source /path/to/shell.sh.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants