Skip to content

LockFile#

Represents a lock-file for both Conda packages and Pypi packages. Lock-files can store information for multiple platforms and for multiple environments.

__init__(envs) #

Create a new rattler-lock file.

envs maps each environment to its name.

__repr__() #

Returns a representation of the LockFile.

default_environment() #

Returns the environment with the default name as defined by [DEFAULT_ENVIRONMENT_NAME].

Examples#

>>> lock_file = LockFile.from_path("./pixi.lock")
>>> lock_file.default_environment()
Environment()
>>>

environment(name) #

Returns the environment with the given name.

Examples#

>>> lock_file = LockFile.from_path("./pixi.lock")
>>> lock_file.environment("default")
Environment()
>>> lock_file.environment("doesnt-exist")
>>>

environments() #

Returns an iterator over all environments defined in the lock-file.

Examples#

>>> lock_file = LockFile.from_path("./pixi.lock")
>>> lock_file.environments()
[('default', Environment()), ('docs', Environment()), ('test', Environment())]
>>>

from_path(path) staticmethod #

Parses a rattler-lock file from a file.

Examples#

>>> lock_file = LockFile.from_path("./pixi.lock")
>>> lock_file
LockFile()
>>>

to_path(path) #

Writes the rattler-lock to a file.

Examples#

>>> lock_file = LockFile.from_path("./pixi.lock")
>>> lock_file.to_path("/tmp/test.lock")
>>>