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__ #

__init__(envs)

Create a new rattler-lock file.

envs maps each environment to its name.

__repr__ #

__repr__()

Returns a representation of the LockFile.

default_environment #

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 #

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 #

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()), ('repl', Environment()), ('docs', Environment()), ('test', Environment())]
>>>

from_path staticmethod #

from_path(path)

Parses a rattler-lock file from a file.

Examples#

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

to_path #

to_path(path)

Writes the rattler-lock to a file.

Examples#

>>> import tempfile
>>> lock_file = LockFile.from_path("./pixi.lock")
>>> with tempfile.NamedTemporaryFile() as fp:
...     lock_file.to_path(fp.name)
>>>