Skip to content

Environment#

Environment #

Information about a specific environment in the lock-file.

__init__(name, requirements) #

Create a new environment.

__repr__() #

Returns a representation of the Environment.

channels() #

Returns the channels that are used by this environment. Note that the order of the channels is significant. The first channel is the highest priority channel.

Examples#
>>> from rattler import LockFile
>>> lock_file = LockFile.from_path("../test-data/test.lock")
>>> env = lock_file.default_environment()
>>> env.channels()
[LockChannel(url="https://conda.anaconda.org/conda-forge/")]
>>>

conda_repodata_records() #

Returns all conda packages for all platforms.

Examples#
>>> from rattler import LockFile
>>> lock_file = LockFile.from_path("../test-data/test.lock")
>>> env = lock_file.default_environment()
>>> env.conda_repodata_records()
{'osx-arm64': [RepoDataRecord(...), ...]}
>>>

conda_repodata_records_for_platform(platform) #

Takes all the conda packages, converts them to [RepoDataRecord] and returns them or returns an error if the conversion failed. Returns None if the specified platform is not defined for this environment.

Examples#
>>> from rattler import LockFile, Platform
>>> lock_file = LockFile.from_path("../test-data/test.lock")
>>> env = lock_file.default_environment()
>>> rdr = env.conda_repodata_records_for_platform(Platform("osx-arm64"))
>>> rdr
[...]
>>> rdr[0]
RepoDataRecord(...)
>>>

packages(platform) #

Returns all the packages for a specific platform in this environment.

Examples#
>>> from rattler import Platform, LockFile
>>> lock_file = LockFile.from_path("../test-data/test.lock")
>>> env = lock_file.default_environment()
>>> env.packages(Platform("osx-arm64"))[0]
LockedPackage()
>>>

packages_by_platform() #

Returns a list of all packages and platforms defined for this environment.

Examples#
>>> from rattler import LockFile
>>> lock_file = LockFile.from_path("../test-data/test.lock")
>>> env = lock_file.default_environment()
>>> pkgs = env.packages_by_platform()
>>> list(pkgs.keys())
[Platform(...)]
>>>

platforms() #

Returns all the platforms for which we have a locked-down environment.

Examples#
>>> from rattler import LockFile
>>> lock_file = LockFile.from_path("../test-data/test.lock")
>>> env = lock_file.default_environment()
>>> env.platforms()
[...]
>>>

pypi_packages() #

Returns all pypi packages for all platforms.

Examples#
>>> from rattler import LockFile, Platform
>>> lock_file = LockFile.from_path("../test-data/test.lock")
>>> env = lock_file.default_environment()
>>> pypi_packages = env.pypi_packages()
>>> pypi_packages[Platform("osx-arm64")][0]
(PypiPackageData(), PypiPackageEnvironmentData())
>>>

pypi_packages_for_platform(platform) #

Returns all the pypi packages and their associated environment data for the specified platform. Returns None if the platform is not defined for this environment.

Examples#
>>> from rattler import LockFile, Platform
>>> lock_file = LockFile.from_path("../test-data/test.lock")
>>> env = lock_file.default_environment()
>>> osx_pypi_pkgs = env.pypi_packages_for_platform(Platform("osx-arm64"))
>>> osx_pypi_pkgs
[...]
>>> osx_pypi_pkgs[0]
(PypiPackageData(), PypiPackageEnvironmentData())
>>>