Summary
The env configuration as described in https://prek.j178.dev/configuration/#args,
only have effect during the execution of the hook,
but have no effect during the virtualenv installation.
The current document is a bit unclear:
- The scope of the
env configuration, if it is effective during virtualenv installation.
- The doc of the upstream pre-commit, describe the semantic of
.pre-commit-hooks.yaml and .pre-commit-config.yaml separately. The preks only describe the semantic of .pre-commit-config.yaml and Prek says that it followes the format of upstream .pre-commit-hooks.yaml.
So env field does not work in .pre-commit-hooks.yaml? Is this a delibreate design choice?
I am asking for additional configuration option, to set the env variable during the virtualenv installation.
This is useful for enterprise to setup mirror to download the package, because the internet access is often restricted.
Actually, setup env variable during venv installation, is more needed than env for hook execution, because the env can always be set by alternative entry, but no similar way for additional_dependencies.
I currently setup mirror by --index-url in additional_dependencies of python language,
but for several language, this is not possible,
such as setting mirror for the node language,
because both the mirror to nodeenv to download the nodejs,
and the mirror to npm registry, need to be set.
I know I can run the git hooks in a docker container with all mirror related env vars set,
but I would like to distribute the env as part of the git hooks.
Alternatively, a separate .env file may be desired, so it is easier to apply the environment variable globally, for both local hooks defined in .pre-commit-config.yaml
and the remote hooks defined in .pre-commit-hooks.yaml.
Document should describe how the configuration are merged, and if the local .env can unset the env variable set by the remote .env
Platform
Linux 6.6.87.2-microsoft-standard-WSL2 x86_64 GNU/Linux
Version
prek 0.3.2
.pre-commit-config.yaml
N/A
Log file
N/A
Summary
The
envconfiguration as described in https://prek.j178.dev/configuration/#args,only have effect during the execution of the hook,
but have no effect during the virtualenv installation.
The current document is a bit unclear:
envconfiguration, if it is effective during virtualenv installation..pre-commit-hooks.yamland.pre-commit-config.yamlseparately. The preks only describe the semantic of.pre-commit-config.yamland Prek says that it followes the format of upstream.pre-commit-hooks.yaml.So
envfield does not work in.pre-commit-hooks.yaml? Is this a delibreate design choice?I am asking for additional configuration option, to set the env variable during the virtualenv installation.
This is useful for enterprise to setup mirror to download the package, because the internet access is often restricted.
Actually, setup env variable during venv installation, is more needed than
envfor hook execution, because the env can always be set by alternativeentry, but no similar way foradditional_dependencies.I currently setup mirror by
--index-urlin additional_dependencies of python language,but for several language, this is not possible,
such as setting mirror for the
nodelanguage,because both the mirror to
nodeenvto download the nodejs,and the mirror to npm registry, need to be set.
I know I can run the git hooks in a docker container with all mirror related env vars set,
but I would like to distribute the env as part of the git hooks.
Alternatively, a separate
.envfile may be desired, so it is easier to apply the environment variable globally, for both local hooks defined in.pre-commit-config.yamland the remote hooks defined in
.pre-commit-hooks.yaml.Document should describe how the configuration are merged, and if the local
.envcan unset the env variable set by the remote.envPlatform
Linux 6.6.87.2-microsoft-standard-WSL2 x86_64 GNU/Linux
Version
prek 0.3.2
.pre-commit-config.yaml
N/A
Log file
N/A