Skip to content

PypiLockedPackage#

Bases: LockedPackage

A locked PyPI package in a lock file.

extras: Set[str] property #

The extras enabled for the package. Note that the order doesn't matter.

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()
>>> env_data = pypi_packages[Platform("osx-arm64")][0]
>>> env_data.extras
set()
>>>

is_editable: bool property #

Whether the package should be installed in editable mode or not.

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()
>>> data = pypi_packages[Platform("osx-arm64")][0]
>>> data.is_editable
False
>>>

requires_dist: List[str] property #

A list of dependencies on other packages.

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()
>>> data = pypi_packages[Platform("osx-arm64")][0]
>>> data.requires_dist
[]
>>>

requires_python: Optional[str] property #

The python version that this package requires.

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()
>>> data = pypi_packages[Platform("osx-arm64")][0]
>>> data.requires_python
'>=3.7.0'
>>>

version: str property #

Returns the version of the package as recorded in the lock-file.

satisfies(spec) #

Returns true if this package satisfies the given spec.

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()
>>> data = pypi_packages[Platform("osx-arm64")][0]
>>> data.satisfies("charset-normalizer")
True
>>>