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

Support micromamba (umamba) : a light weight version of mamba #850

Open
phreed opened this issue Jul 5, 2024 · 7 comments
Open

Support micromamba (umamba) : a light weight version of mamba #850

phreed opened this issue Jul 5, 2024 · 7 comments
Labels
C-feature request New feature request

Comments

@phreed
Copy link

phreed commented Jul 5, 2024

I want to suggest a new step for micromamba

This is related to issues #395 #443 #495 #750 #829 #832 #841 which support conda and mamba.

The micromamba update command options

Topgrade should provide access to the micromamba update command.

example:

micromamba update --name env1 --all --yes

This will update all of the packages in the environment named env1.

The following is the output from micromamba update --help.


Usage: /var/home/linuxbrew/.linuxbrew/Cellar/micromamba/1.5.8/bin/micromamba update [OPTIONS] [specs...]

Positionals:
  specs TEXT ...              Specs to update in the environment

Options:
  -h,--help                   Print this help message and exit
  -c,--channel TEXT ...       Define the list of channels
  --override-channels         Override channels
  --channel-priority ENUM:value in {disabled->0,flexible->1,strict->2} OR {0,1,2}
                              Define the channel priority ('strict' or 'disabled')
  --channel-alias TEXT        The prepended url location to associate with channel names
  --strict-channel-priority   Enable strict channel priority
  --no-channel-priority       Disable channel priority
  -f,--file TEXT ...          File (yaml, explicit or plain)
  --no-pin,--pin{false}       Ignore pinned packages
  --no-py-pin,--py-pin{false} Do not automatically pin Python
  --pyc,--no-pyc{false}       Defines if PYC files will be compiled or not
  --allow-uninstall,--no-allow-uninstall{false}
                              Allow uninstall when installing or updating packages. Default is true.
  --allow-downgrade,--no-allow-downgrade{false}
                              Allow downgrade when installing packages. Default is false.
  --allow-softlinks,--no-allow-softlinks{false}
                              Allow to use soft-links when hard-links are not possible
  --always-softlink,--no-always-softlink{false}
                              Use soft-link instead of hard-link
  --always-copy,--no-always-copy{false}
                              Use copy instead of hard-link
  --extra-safety-checks,--no-extra-safety-checks{false}
                              Run extra verifications on packages
  --lock-timeout UINT         Lockfile timeout
  --shortcuts,--no-shortcuts{false}
                              Install start-menu shortcuts on Windows (not implemented on Linux / macOS)
  --safety-checks ENUM:value in {disabled->0,enabled->2,warn->1} OR {0,2,1}
                              Safety checks policy ('enabled', 'warn', or 'disabled')
  --verify-artifacts          Run verifications on packages signatures
  --platform TEXT             The platform description
  --no-deps                   Do not install dependencies. This WILL lead to broken environments and inconsistent behavior. Use at your own risk
  --only-deps                 Only install dependencies
  --category TEXT ...         Categories of package to install from environment lockfile
  --prune,--no-prune{false}   Prune dependencies (default)
  -a,--all                    Update all packages in the environment


Configuration options:
  --rc-file TEXT ...          Paths to the configuration files to use
  --no-rc                     Disable the use of configuration files
  --no-env                    Disable the use of environment variables


Global options:
  -v,--verbose                Set verbosity (higher verbosity with multiple -v, e.g. -vvv)
  --log-level ENUM:value in {critical->5,debug->1,error->4,info->2,off->6,trace->0,warning->3} OR {5,1,4,2,6,0,3}
                              Set the log level
  -q,--quiet                  Set quiet mode (print less output)
  -y,--yes                    Automatically answer yes on prompted questions
  --json                      Report all output as json
  --offline                   Force use cached repodata
  --dry-run                   Only display what would have been done
  --download-only             Only download and extract packages, do not link them into environment.
  --experimental              Enable experimental features


Prefix options:
  -r,--root-prefix TEXT       Path to the root prefix
  -p,--prefix TEXT            Path to the target prefix
  --relocate-prefix TEXT      Path to the relocation prefix
  -n,--name TEXT              Name of the target prefix

Network options:
  --ssl-verify TEXT           Verify SSL certificates for HTTPS requests
  --ssl-no-revoke             SSL certificate revocation checks
  --cacert-path TEXT          Path (file or directory) SSL certificate(s)
  --repodata-ttl UINT         Repodata time-to-live
  --retry-clean-cache         If solve fails, try to fetch updated repodata

More information

This tool is used by conda-forge https://conda-forge.org/

@phreed phreed added the C-feature request New feature request label Jul 5, 2024
@phreed phreed changed the title Support micromamba : a light weight version of mamba Support micromamba (umamba) : a light weight version of mamba Jul 5, 2024
@phreed
Copy link
Author

phreed commented Jul 5, 2024

Here is the related block https://github.com/topgrade-rs/topgrade/blob/a9f57d420519f74d05b6ed4fb6bbf1519d7233b0/src/steps/generic.rs#L435C1-L454C2 :
With some notes and modifications

pub fn run_umamba_update(ctx: &ExecutionContext) -> Result<()> {
    let umamba = require("umamba")?;

    # acquire a list of the available target environments
    let output = Command::new(&umamba)
        .args(["env", "list", "--json"])
        .output_checked_utf8()?;
    debug!("Micromamba output: {}", output.stdout);

    print_separator("MicroMamba");

    // loop over the target environments
     for target_env in targets {
        let mut command = ctx.run_type().execute(umamba);
        command.args(["update", "--all", "--name", target_env ]);
        if ctx.config().yes(Step::MicroMamba) {
            command.arg("--yes");
        }
        command.status_checked()
}

@niStee
Copy link
Contributor

niStee commented Jul 27, 2024

Instead of using the GitHub issues page, you could consider posting your suggestion on the Topgrade discussions page at https://github.com/topgrade-rs/topgrade/discussions/categories/ideas. The discussions section is often a better place to share ideas and get feedback from the project maintainers and community.

@SteveLauC
Copy link
Member

The discussions section is often a better place to share ideas and get feedback from the project maintainers and community.

This issue looks like a feature request issue

@rmolina
Copy link
Contributor

rmolina commented Aug 6, 2024

I would not like Micromamba to update my environments blindly. I keep outdated environments for testing purposes.

Conda and Mamba only update the base environment and only after checking whether it is auto-activated (i.e., they check the config option "auto_activate_base").

However, I would like Micromamba to run its "self-update" option. That only updates the Micromamba binary and the list of packages available.

Here is a diff implementing such behavior: 6f932ed

@SteveLauC
Copy link
Member

Conda and Mamba only update the base environment

That's right.

only after checking whether it is auto-activated (i.e., they check the config option "auto_activate_base").

There is an on-going PR that removes this check because it seems unnecessary: #905

However, I would like Micromamba to run its "self-update" option. That only updates the Micromamba binary and the list of packages available.

I am wondering do Mamba and Conda have such an option?

@rmolina
Copy link
Contributor

rmolina commented Sep 15, 2024

only after checking whether it is auto-activated (i.e., they check the config option "auto_activate_base").

There is an on-going PR that removes this check because it seems unnecessary: #905

Interesting. If I still used conda, I would prefer to preserve the auto_activate_base condition. When I used conda, I always disabled auto_activate_base and never updated the base environment. I only used base to warrant repeatable results: "If you use a clean installation of Anaconda version X, and you use these inputs, you will get these outputs." This worked better than providing requirements.txt or environment.yml files since some of my users were not familiar with Python. That's probably not a common use case, though.

However, I would like Micromamba to run its "self-update" option. That only updates the Micromamba binary and the list of packages available.

I am wondering do Mamba and Conda have such an option?

No, I don't think they do.

@SteveLauC
Copy link
Member

I would prefer to preserve the auto_activate_base condition.

If you think we should preserve it, welcome to leave a comment there:)

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

No branches or pull requests

4 participants