Skip to content

Allow to mamba install environments #2204

@janjagusch

Description

@janjagusch

Thanks for maintaining pre-commit, we really enjoying working with it!

When installing conda environments, mamba is often the preferred option, as it is faster and requires less memory when solving an environment.

As of today, pre-commit uses conda for creating environments, as this is hard-coded into the source code:

with clean_path_on_failure(env_dir):
cmd_output_b(
'conda', 'env', 'create', '-p', env_dir, '--file',
'environment.yml', cwd=prefix.prefix_dir,
)

We have a use case, where we want to install pre-commit hooks in CI, but the installation fails because of out-of-memory errors. Installing the same environment with mamba however, succeeds.

It would be nice if one could define whether pre-commit uses conda or mamba for installing environments. This could for example be accomplished by introducing an environment variable PRE_COMMIT_USE_MAMBA. If there is a better way to pass such configuration to pre-commit, please let me know.

I'd be glad to work on this feature, if this is something you'd like to see added to pre-commit.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions