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

Add cli for use in NPM scripts #168

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open

Add cli for use in NPM scripts #168

wants to merge 9 commits into from

Conversation

thewtex
Copy link

@thewtex thewtex commented Oct 30, 2023

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.

@thewtex thewtex requested a review from pavelzw as a code owner October 30, 2023 18:01
When used in NPM scripts, `setup-micromamba` provides a convenient way to
download micromamba and create conda environments.

Set options through environment variables in invocation. 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",
  [...]
```

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 micromamba bin path is set to
`${MICROMAMBA_ROOT_PATH}/micromamba` if `MICROMAMBA_ROOT_PATH` is set.

Have the mocking core respect the log level.
And running passing argument other that a shell script.
Example:

  setup-micromamba --micromamba-root-path micromamba debug --init-shell none --create-environment true --environment-file environment.yml --generate-run-shell true --micromamba-run-shell-path ./micromamba/run-shell --log-level debug
Separate run() invocations in src/main.ts and src/operations.ts.
In an NPM run script.

Todo: verify that this is not set in GitHub Actions.
Results in an error in GitHub Actions:

```
Error: Unable to process command '  ::add-path::<the path>
Error: The `add-path` command is disabled. Please upgrade to using
Environment Files or opt into unsecure command execution by setting the
`ACTIONS_ALLOW_UNSECURE_COMMANDS` environment variable to `true`. For
more information see:
https://github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/
```
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.

1 participant