Skip to content

LockedPackage#

is_conda: bool property #

Returns true if this package represents a conda package.

Examples#

>>> from rattler import Platform, LockFile
>>> lock_file = LockFile.from_path("../test-data/test.lock")
>>> env = lock_file.default_environment()
>>> lock_packages = env.packages(Platform("osx-arm64"))
>>> conda_pkgs = [pkg for pkg in lock_packages if pkg.url_or_path.startswith("https://conda.anaconda.org/")]
>>> conda_pkgs[0].is_conda
True
>>>

is_pypi: bool property #

Returns true if this package represents a conda package.

Examples#

>>> from rattler import Platform, LockFile
>>> lock_file = LockFile.from_path("../test-data/test.lock")
>>> env = lock_file.default_environment()
>>> lock_packages = env.packages(Platform("osx-arm64"))
>>> pypi_pkgs = [pkg for pkg in lock_packages if pkg.url_or_path.startswith("https://files.pythonhosted.org/")]
>>> pypi_pkgs[0].is_pypi
True
>>>

name: str property #

Returns the name of the package.

Examples#

>>> from rattler import Platform, LockFile
>>> lock_file = LockFile.from_path("../test-data/test.lock")
>>> env = lock_file.default_environment()
>>> lock_package = env.packages(Platform("osx-arm64"))[0]
>>> lock_package.name
'tzdata'
>>>

url_or_path: str property #

Returns the URL of the package

Examples#

>>> from rattler import Platform, LockFile
>>> lock_file = LockFile.from_path("../test-data/test.lock")
>>> env = lock_file.default_environment()
>>> lock_package = env.packages(Platform("osx-arm64"))[0]
>>> lock_package.url_or_path
'https://conda.anaconda.org/...'
>>>

version: str property #

Returns the version string of the package.

Examples#

>>> from rattler import Platform, LockFile
>>> lock_file = LockFile.from_path("../test-data/test.lock")
>>> env = lock_file.default_environment()
>>> lock_package = env.packages(Platform("osx-arm64"))[0]
>>> lock_package.version
'2024a'
>>>

__repr__() #

Returns a representation of the LockedPackage.

as_conda() #

Returns this instance as a [RepoDataRecord] if this instance represents a conda package.

Examples#

>>> from rattler import Platform, LockFile
>>> lock_file = LockFile.from_path("../test-data/test.lock")
>>> env = lock_file.default_environment()
>>> lock_packages = env.packages(Platform("osx-arm64"))
>>> conda_pkg = [pkg for pkg in lock_packages if pkg.is_conda]
>>> conda_pkg[0].as_conda()
RepoDataRecord(...)
>>>

as_pypi() #

Returns this instance as a tuple of [PypiPackageData] & [PypiPackageEnvironmentData] if this instance represents a pypi package.

Examples#

>>> from rattler import Platform, LockFile
>>> lock_file = LockFile.from_path("../test-data/test.lock")
>>> env = lock_file.default_environment()
>>> lock_packages = env.packages(Platform("osx-arm64"))
>>> pypi_pkg = [pkg for pkg in lock_packages if pkg.is_pypi]
>>> pypi_pkg[0].as_pypi()
(PypiPackageData(), PypiPackageEnvironmentData())
>>>