PackageRecord#
PackageRecord
#
A single record in the Conda repodata. A single record refers to a single binary distribution of a package on a Conda channel.
constrains: List[str]
property
#
Additional constraints on packages. Constrains are different from depends in that packages specified in depends must be installed next to this package, whereas packages specified in constrains are not required to be installed, but if they are installed they must follow these constraints.
Examples#
features: Optional[str]
property
#
Features are a deprecated way to specify different feature sets for the conda solver. This is not supported anymore and should not be used. Instead, mutex packages should be used to specify mutually exclusive features.
legacy_bz2_md5: Optional[bytes]
property
#
A deprecated md5 hash.
legacy_bz2_size: Optional[int]
property
#
A deprecated package archive size.
sha256: Optional[bytes]
property
#
Optionally a SHA256 hash of the package archive.
Examples#
```python
from rattler import PrefixRecord record = PrefixRecord.from_path( ... "../test-data/conda-meta/libsqlite-3.40.0-hcfcfb64_0.json" ... ) record.sha256.hex() '4e50b3d90a351c9d47d239d3f90fce4870df2526e4f7fef35203ab3276a6dfc9'
track_features: List[str]
property
#
Track features are nowadays only used to downweight packages (ie. give them less priority). To that effect, the number of track features is counted (number of commas) and the package is downweighted by the number of track_features.
Examples#
from_index_json(path, size=None, sha256=None, md5=None)
staticmethod
#
Builds a PackageRecord from an index.json
.
These can be found in info
directory inside an
extracted package archive.
Examples#
matches(spec)
#
Match a [PackageRecord
] against a [MatchSpec
].
sort_topologically(records)
staticmethod
#
Sorts the records topologically. This function is deterministic, meaning that it will return the same result regardless of the order of records and of the depends vector inside the records. Note that this function only works for packages with unique names.
Examples#
>>> from os import listdir
>>> from os.path import isfile, join
>>> from rattler import PrefixRecord
>>> records = [
... PrefixRecord.from_path(join("../test-data/conda-meta/", f))
... for f in listdir("../test-data/conda-meta")
... if isfile(join("../test-data/conda-meta", f))
... ]
>>> sorted = PackageRecord.sort_topologically(records)
>>> sorted[0].name
PackageName("python_abi")
>>>