mamba-org / vscode-micromamba

A VSCode extension to generate development environments using micromamba and conda-forge package repository
BSD 3-Clause "New" or "Revised" License
87 stars 10 forks source link

Please add a feature that allows selecting the programming language version or selecting a personal template prepared in advance when creating a new environment. #40

Open hushoujier opened 1 year ago

hushoujier commented 1 year ago

Environment

  1. node -v: none
  2. npm -v: none
  3. Operating system: Windows 10 21H2 19044.1288

Prerequisite

Install this extension

Steps to Reproduce

1. Open the command palette (Ctrl+Shift+P)
2. Type - micromamba create environment
3. Choose a template from a list
4. The environment is activated automatically

Relevant Debug Info

none

Expected Behavior

1. Open the command palette (Ctrl+Shift+P)
2. Type - micromamba create environment
3. Choose a template from a list
4. Choose the programming language version
5. The environment is activated automatically

Or

1. Open the command palette (Ctrl+Shift+P)
2. Type - micromamba create environment
3. Choose a personal template prepared in advance
4. The environment is activated automatically

Actual Behavior

The environment automatically creates and downloads the latest programming language version


corker commented 1 year ago

Thank you @suuperhu for the feature request. I'm unsure if this is a good way to go, as things could get complicated quickly. Micromamba environment file allows defining libraries and versions in a very flexible format. For example, here is an environment file that I use often:

# Micromamba environment file
# https://marketplace.visualstudio.com/items?itemName=corker.vscode-micromamba

name: default

channels:
  - conda-forge

dependencies:
  - nodejs=18
  - terraform=1
  - pip:
    - azure-cli

As you can see, we pin node and terraform versions and add azure-cli via pip It would be great to define a feature that could cover multiple scenarios for developers in a convenient way. I'm still thinking about how to do it. I'd be glad to hear your thoughts on this.

pklapperich commented 7 months ago

Honestly, I think this could be addressed simply with some README improvements. Today I tried to use this with a project that already had an environment.yml, but my file had prefix: path\to\conda\env set. This caused it to fail without much error. But I didn't even realize that "Create Environment" implied "Create Environment from environment.yml if one already exists, otherwise create a new environment.yml.

I would suggest changing the readme:


Micromamba: create an environment

This command uses environment.yml to create or update a virtual environment. The environment.yml is a mamba environment file which describes the interpreters and packages to install into the environment. If your project doesn't have an environment.yml yet, one will be created. The extension comes with a number of templates, but you could change it to your needs and re-run the create command.


With the suggested wording, I think it should be clear to users that they can do this workflow in a new project:

  1. Micromamba: Create Environment
  2. Edit the environment.yml to add nodejs, python packages, set a specific python version, etc
  3. Run Micromamba: Create Environment again
Xpos587 commented 3 months ago

Честно говоря, я думаю, что эту проблему можно решить простыми улучшениями README. Сегодня я попытался использовать это с проектом, у которого уже был environment.yml, но мой файл имел prefix: path\to\conda\envнабор. Это привело к сбою без особых ошибок. Но я даже не осознавал, что «Создать среду» подразумевало «Создать среду из environment.yml если он уже существует, в противном случае создайте новый environment.yml.

Я бы предложил изменить readme:

Микромамба: создаем среду

This command uses environment.yml to create or update a virtual environment. The environment.yml is a mamba environment file which describes the interpreters and packages to install into the environment. If your project doesn't have an environment.yml yet, one will be created. The extension comes with a number of templates, but you could change it to your needs and re-run the create command.

With the suggested wording, I think it should be clear to users that they can do this workflow in a new project:

1. Micromamba: Create Environment

2. Edit the `environment.yml` to add nodejs, python packages, set a specific python version, etc

3. Run Micromamba: Create Environment again

Thanks for the explanation, I didn't even think about the fact that micromamba has the same config as conda. 😁

Xpos587 commented 3 months ago

I do not know why, but my environment.yml file is not visible in vscode explorer.

corker commented 3 months ago

It should be something local, not related to the extension. Please check if the file is visible in the system terminal or in the file system explorer