Skip to content

Support declaring environment variables in DVC file #2042

@robogeek

Description

@robogeek

Obviously some command-line tool configuration is set using environment variables. DVC does not support setting environment variables in a DVC file. Neither DVC file reference nor dvc run command reference show anything about setting an environment variable.

As to how it should be visible to the users:

  • dvc run -e VARIABLE=value -- support setting this option multiple times
  • In the top level of a DVC file have an env tag, like so:
cmd: echo This is a command
env:
    - VARIABLE_NAME=value
    - VARIABLE_NAME2=value
    - VARIABLE_NAME3=value

OR

cmd: echo This is a command
env:
    VARIABLE_NAME: value
    VARIABLE_NAME2: value
    VARIABLE_NAME3: value

For comparison, this is exactly how environment variables are defined in a Docker Compose file: https://docs.docker.com/compose/compose-file/#environment

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestRequesting a new featurep2-mediumMedium priority, should be done, but less important

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions