env
DevcontainerEnvVars
¶
Bases: BaseModel
Collection of variables required for devcontainer operations.
All properties are prefixed with MDC
to denote that those are variables
generated by M Dev Container
.
Attributes:
Name | Type | Description |
---|---|---|
mdc_repo |
str
|
... |
mdc_workspace |
str
|
... |
mdc_pnpm_workspace |
str
|
... |
mdc_venv_workspace |
str
|
... |
Source code in m/devcontainer/env.py
MissingEnvVars
¶
devcontainer_env_vars()
¶
Get the environment variables for a devcontainer.
This function is intended to be used in a devcontainer or in a Github runner. It will return the following values::
- repo: The repository name.
- workspace: The path to directory containing the repo files.
- pnpmWorkspace: The path where pnpm operations should take place.
- venvWorkspace: The path where venv operations should take place.
Returns:
Type | Description |
---|---|
DevcontainerEnvVars
|
A dictionary with the values described above. |
Source code in m/devcontainer/env.py
require_env_vars(env_vars)
¶
Require that the given environment variables are defined.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
env_vars |
list[str]
|
list of environment variables to check. |
required |
Returns:
Type | Description |
---|---|
OneOf[MissingEnvVars, None]
|
None if all environment variables are defined, otherwise a |
OneOf[MissingEnvVars, None]
|
MissingEnvVars instance. |