env#

Environment object describing the conda environment.yaml file.

Classes#

Dependencies

A dict subclass that parses the raw dependencies into a conda and pip list

Environment

A class representing an environment.yaml file

Functions#

validate_keys(data, kwargs)

Check for unknown keys, remove them and print a warning

from_environment(name, prefix[, no_builds, ...])

Get Environment object from prefix

from_yaml(yamlstr, **kwargs)

Load and return a Environment from a given yaml string

_expand_channels(data)

Expands Environment variables for the channels found in the yaml data

from_file(filename)

Load and return an Environment from a given file

get_filename(filename)

Expand filename if local path or return the url

print_result(args, prefix, result)

Print the result of an install operation

Attributes#

VALID_KEYS

VALID_KEYS = ('name', 'dependencies', 'prefix', 'channels', 'variables')#
validate_keys(data, kwargs)#

Check for unknown keys, remove them and print a warning

from_environment(name, prefix, no_builds=False, ignore_channels=False, from_history=False)#

Get Environment object from prefix

Parameters:
  • name -- The name of environment

  • prefix -- The path of prefix

  • no_builds -- Whether has build requirement

  • ignore_channels -- whether ignore_channels

  • from_history -- Whether environment file should be based on explicit specs in history

Returns: Environment object

from_yaml(yamlstr, **kwargs)#

Load and return a Environment from a given yaml string

_expand_channels(data)#

Expands Environment variables for the channels found in the yaml data

from_file(filename)#

Load and return an Environment from a given file

class Dependencies(raw, *args, **kwargs)#

Bases: dict

A dict subclass that parses the raw dependencies into a conda and pip list

parse()#

Parse the raw dependencies into a conda and pip list

add(package_name)#

Add a package to the Environment

class Environment(name=None, filename=None, channels=None, dependencies=None, prefix=None, variables=None)#

A class representing an environment.yaml file

add_channels(channels)#

Add channels to the Environment

remove_channels()#

Remove all channels from the Environment

to_dict(stream=None)#

Convert information related to the Environment into a dictionary

to_yaml(stream=None)#

Convert information related to the Environment into a yaml string

save()#

Save the Environment data to a yaml file

get_filename(filename)#

Expand filename if local path or return the url

print_result(args, prefix, result)#

Print the result of an install operation