mamba-org / setup-micromamba

GitHub Action to set up micromamba
MIT License
105 stars 16 forks source link

Add cli for use in NPM scripts #168

Open thewtex opened 1 year ago

thewtex commented 1 year ago

When used in NPM scripts, setup-micromamba provides a convenient way to download micromamba and create conda environments.

Set options through environment variables or command line flags in invocation. Command line flag parsing is very basic. If micromamba has already been downloaded or an environment already exists, it will not be recreated.

Example:

  "scripts": {
  [...]
    "micromamba": "MICROMAMBA_ROOT_PATH=micromamba CREATE_ENVIRONMENT=true CREATE_ARGS=\"python=3.11\" ENVIRONMENT_NAME=test-env setup-micromamba",
  [...]

or

  "scripts": {
  [...]
    "micromamba": "setup-micromamba --micromamba-root-path micromamba --create-environment true --create-args \"python=3.11\" --environment-name test-env",
  [...]

We re-use the mocking core. Determination of the core backend is moved to a separate module to prevent duplication and circular imports.

The default micro mamba bin path is set to ${MICROMAMBA_ROOT_PATH}/micromamba if MICROMAMBA_ROOT_PATH is set.

Have the mocking core respect the log level.