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#
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#
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]
CondaLockedBinaryPackage(name='tzdata',location='https://conda.anaconda.org/conda-forge/noarch/tzdata-2024a-h0c530f3_0.conda')
>>>
packages_by_platform()
#
Returns a list of all packages and platforms defined for this environment.
Examples#
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]
PypiLockedPackage(name='charset-normalizer',location='https://files.pythonhosted.org/packages/3a/52/9f9d17c3b54dc238de384c4cb5a2ef0e27985b42a0e5cc8e8a31d918d48d/charset_normalizer-3.3.2-cp312-cp312-macosx_11_0_arm64.whl#sha256=55086ee1064215781fff39a1af09518bc9255b50d6333f2e4c74ca09fac6a8f6')
>>>
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]
PypiLockedPackage(name='charset-normalizer',location='https://files.pythonhosted.org/packages/3a/52/9f9d17c3b54dc238de384c4cb5a2ef0e27985b42a0e5cc8e8a31d918d48d/charset_normalizer-3.3.2-cp312-cp312-macosx_11_0_arm64.whl#sha256=55086ee1064215781fff39a1af09518bc9255b50d6333f2e4c74ca09fac6a8f6')
>>>