Skip to content

PypiPackageData#

A pinned Pypi package.

hash: Optional[PackageHashes] property #

Hashes of the file pointed to by url.

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][0]
>>> data.hash
PackageHashes()
>>>

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][0]
>>> data.is_editable
False
>>>

name: str property #

The name of the package.

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][0]
>>> data.name
'charset-normalizer'
>>>

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][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][0]
>>> data.requires_python
'>=3.7.0'
>>>

url_or_path: str property #

The URL that points to where the artifact can be downloaded from.

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][0]
>>> data.url_or_path
'https://files.pythonhosted.org/...'
>>>

version: str property #

The version of the package.

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][0]
>>> data.version
'3.3.2'
>>>

__repr__() #

Returns a representation of the PypiPackageData.

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