records#
Implements the data model for conda packages.
A PackageRecord is the record of a package present in a channel. A PackageCache is the record of a downloaded and cached package. A PrefixRecord is the record of a package installed into a conda environment.
Object inheritance:

Classes#
Fields are doing something very similar to boxing and unboxing |
|
Fields are doing something very similar to boxing and unboxing |
|
Fields are doing something very similar to boxing and unboxing |
|
Fields are doing something very similar to boxing and unboxing |
|
Fields are doing something very similar to boxing and unboxing |
|
Fields are doing something very similar to boxing and unboxing |
|
Fields are doing something very similar to boxing and unboxing |
|
Fields are doing something very similar to boxing and unboxing |
|
Representation of a concrete package archive (tarball or .conda file). |
|
Fields are doing something very similar to boxing and unboxing |
|
Representation of a package that has been downloaded or unpacked in the local package cache. |
|
Representation of a package that has been returned as part of a solver solution. |
|
Representation of a package that is installed in a local conda environmnet. |
Attributes#
- class LinkTypeField(enum_class, default=NULL, required=True, validation=None, in_dump=True, default_in_dump=True, nullable=False, immutable=False, aliases=())#
Bases:
conda.auxlib.entity.EnumFieldFields are doing something very similar to boxing and unboxing of c#/java primitives. __set__ should take a "primitive" or "raw" value and create a "boxed" or "programmatically usable" value of it. While __get__ should return the boxed value, dump in turn should unbox the value into a primitive or raw value.
- Parameters:
- box(instance, instance_type, val)#
- class NoarchField(enum_class, default=NULL, required=True, validation=None, in_dump=True, default_in_dump=True, nullable=False, immutable=False, aliases=())#
Bases:
conda.auxlib.entity.EnumFieldFields are doing something very similar to boxing and unboxing of c#/java primitives. __set__ should take a "primitive" or "raw" value and create a "boxed" or "programmatically usable" value of it. While __get__ should return the boxed value, dump in turn should unbox the value into a primitive or raw value.
- Parameters:
- box(instance, instance_type, val)#
- class TimestampField#
Bases:
conda.auxlib.entity.NumberFieldFields are doing something very similar to boxing and unboxing of c#/java primitives. __set__ should take a "primitive" or "raw" value and create a "boxed" or "programmatically usable" value of it. While __get__ should return the boxed value, dump in turn should unbox the value into a primitive or raw value.
- Parameters:
- static _make_seconds(val)#
- static _make_milliseconds(val)#
- box(instance, instance_type, val)#
- dump(instance, instance_type, val)#
- __get__(instance, instance_type)#
- class Link(**kwargs)#
Bases:
conda.auxlib.entity.DictSafeMixin,conda.auxlib.entity.Entity- source#
- type#
- EMPTY_LINK#
- class _FeaturesField(**kwargs)#
Bases:
conda.auxlib.entity.ListFieldFields are doing something very similar to boxing and unboxing of c#/java primitives. __set__ should take a "primitive" or "raw" value and create a "boxed" or "programmatically usable" value of it. While __get__ should return the boxed value, dump in turn should unbox the value into a primitive or raw value.
- Parameters:
- box(instance, instance_type, val)#
- dump(instance, instance_type, val)#
- class ChannelField(aliases=())#
Bases:
conda.auxlib.entity.ComposableFieldFields are doing something very similar to boxing and unboxing of c#/java primitives. __set__ should take a "primitive" or "raw" value and create a "boxed" or "programmatically usable" value of it. While __get__ should return the boxed value, dump in turn should unbox the value into a primitive or raw value.
- Parameters:
- dump(instance, instance_type, val)#
- __get__(instance, instance_type)#
- class SubdirField#
Bases:
conda.auxlib.entity.StringFieldFields are doing something very similar to boxing and unboxing of c#/java primitives. __set__ should take a "primitive" or "raw" value and create a "boxed" or "programmatically usable" value of it. While __get__ should return the boxed value, dump in turn should unbox the value into a primitive or raw value.
- Parameters:
- __get__(instance, instance_type)#
- class FilenameField(aliases=())#
Bases:
conda.auxlib.entity.StringFieldFields are doing something very similar to boxing and unboxing of c#/java primitives. __set__ should take a "primitive" or "raw" value and create a "boxed" or "programmatically usable" value of it. While __get__ should return the boxed value, dump in turn should unbox the value into a primitive or raw value.
- Parameters:
- __get__(instance, instance_type)#
- class PackageTypeField#
Bases:
conda.auxlib.entity.EnumFieldFields are doing something very similar to boxing and unboxing of c#/java primitives. __set__ should take a "primitive" or "raw" value and create a "boxed" or "programmatically usable" value of it. While __get__ should return the boxed value, dump in turn should unbox the value into a primitive or raw value.
- Parameters:
- __get__(instance, instance_type)#
- class PathData(**kwargs)#
Bases:
conda.auxlib.entity.Entity- _path#
- prefix_placeholder#
- file_mode#
- no_link#
- path_type#
- property path#
- class PathsData(**kwargs)#
Bases:
conda.auxlib.entity.Entity- paths_version#
- paths#
- class PackageRecord(*args, **kwargs)#
Bases:
conda.auxlib.entity.DictSafeMixin,conda.auxlib.entity.EntityRepresentation of a concrete package archive (tarball or .conda file).
It captures all the relevant information about a given package archive, including its source, in the following attributes.
Note that there are three subclasses,
SolvedRecord,PrefixRecordandPackageCacheRecord. These capture the same information, but are augmented with additional information relevant for these sources of packages.Further note that
PackageRecordmakes use of its_pkeyfor comparison and hash generation. This means that for common operations, like comparisons betweenPackageRecords and reference ofPackageRecords in mappings, _different_ objects appear identical. The fields taken into account are marked in the following list of attributes. The subclasses do not add further attributes to the_pkey.- channel#
The channel where the package can be found.
- fn#
The filename of the package.
Only part of the
_pkeyif separate_format_cache istrue(default:false).
- md5#
The md5 checksum of the package.
- legacy_bz2_md5#
If this is a
.condapackage and a corresponding.tar.bz2package exists, this may contain the md5 checksum of that package.
- legacy_bz2_size#
If this is a
.condapackage and a corresponding.tar.bz2package exists, this may contain the size of that package.
- url#
The download url of the package.
- sha256#
The sha256 checksum of the package.
- property channel_name: str | None#
The canonical name of the channel of this package.
Part of the
_pkey.- Type:
- property _pkey#
The components of the PackageRecord that are used for comparison and hashing.
The
_pkeyis a tuple made up of the following fields of thePackageRecord. TwoPackageRecords test equal if their respective_pkeys are equal. The hash of thePackageRecord(important for dictionary access) is the hash of the_pkey.The included fields are:
fnonly if separate_format_cache is set to true (default: false)
- Type:
- __hash__()#
- __eq__(other)#
- dist_fields_dump()#
- arch#
- platform#
- depends#
- constrains#
- track_features#
- features#
- noarch#
- preferred_env#
- python_site_packages_path#
- license#
- license_family#
- package_type#
- property is_unmanageable#
- timestamp#
- property combined_depends#
- date#
- size#
- __str__()#
- to_match_spec()#
- to_simple_match_spec()#
- property namekey#
- property spec#
name=version=build
- Type:
Return package spec
- property spec_no_build#
name=version
- Type:
Return package spec without build
- record_id()#
- classmethod feature(feature_name) PackageRecord#
- classmethod virtual_package(name: str, version: str | None = None, build_string: str | None = None) PackageRecord#
Create a virtual package record.
- Parameters:
name -- The name of the virtual package.
version -- The version of the virtual package, defaults to "0".
build_string -- The build string of the virtual package, defaults to "0".
- Returns:
A PackageRecord representing the virtual package.
- class Md5Field#
Bases:
conda.auxlib.entity.StringFieldFields are doing something very similar to boxing and unboxing of c#/java primitives. __set__ should take a "primitive" or "raw" value and create a "boxed" or "programmatically usable" value of it. While __get__ should return the boxed value, dump in turn should unbox the value into a primitive or raw value.
- Parameters:
- __get__(instance, instance_type)#
- class PackageCacheRecord(*args, **kwargs)#
Bases:
PackageRecordRepresentation of a package that has been downloaded or unpacked in the local package cache.
Specialization of
PackageRecordthat adds information for packages that exist in the local package cache, either as the downloaded package file, or unpacked in its own package dir, or both.Note that this class does not add new fields to the
PackageRecord._pkeyso that a purePackageRecordobject that has the same_pkeyfields as a differentPackageCacheRecordobject (or, indeed, aPrefixRecordobject) will be considered equal and will produce the same hash.- package_tarball_full_path#
Full path to the local package file.
- extracted_package_dir#
Full path to the local extracted package.
- md5#
The md5 checksum of the package.
If the package file exists locally, this class can calculate a missing checksum on-the-fly.
- _calculate_md5sum()#
- class SolvedRecord(*args, **kwargs)#
Bases:
PackageRecordRepresentation of a package that has been returned as part of a solver solution.
This sits between
PackageRecordandPrefixRecord, simply addingrequested_spec(andrequested_specs) so they can be used in lockfiles without requiring the artifact on disk.- requested_spec#
The
MatchSpecthat the user requested orNoneif the package it was installed as a dependency.
- _requested_specs#
The
MatchSpecobjects that the user requested or()if the package was installed as a dependency. See also .requested_specs property.
- property requested_specs: tuple[str, Ellipsis]#
This property will use 'requested_spec' as the source for 'requested_specs' for old conda-meta/*.json files that did not define the plural version.
- dump()#
We need to expose _requested_specs as its public counterpart, and also expose single specs as a plural list for backwards compatibility.
- class PrefixRecord(*args, **kwargs)#
Bases:
SolvedRecordRepresentation of a package that is installed in a local conda environmnet.
Specialization of
PackageRecordthat adds information for packages that are installed in a local conda environment or prefix.Note that this class does not add new fields to the
PackageRecord._pkeyso that a purePackageRecordobject that has the same_pkeyfields as a differentPrefixRecordobject (or, indeed, aPackageCacheRecordobject) will be considered equal and will produce the same hash.Objects of this class are generally constructed from metadata in json files inside $prefix/conda-meta.
- package_tarball_full_path#
The path to the originating package file, usually in the local cache.
- extracted_package_dir#
The path to the extracted package directory, usually in the local cache.
- files#
The list of all files comprising the package as relative paths from the prefix root.
- paths_data#
List with additional information about the files, e.g. checksums and link type.
- link#
Information about how the package was linked into the prefix.
- auth#
Authentication information.
- package_size(prefix_path: pathlib.Path) int#
Compute the installed size of this package within a prefix.
This sums up the size_in_bytes of all non-softlink paths in paths_data, and stats the files on disk if size_in_bytes is missing and for the package's conda-meta JSON manifest.
- Returns:
Total size in bytes of all files installed by this package.