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:

Inheritance diagram of PackageRecord, PackageCacheRecord, PrefixRecord

Classes#

LinkTypeField

Fields are doing something very similar to boxing and unboxing

NoarchField

Fields are doing something very similar to boxing and unboxing

TimestampField

Fields are doing something very similar to boxing and unboxing

Link

_FeaturesField

Fields are doing something very similar to boxing and unboxing

ChannelField

Fields are doing something very similar to boxing and unboxing

SubdirField

Fields are doing something very similar to boxing and unboxing

FilenameField

Fields are doing something very similar to boxing and unboxing

PackageTypeField

Fields are doing something very similar to boxing and unboxing

PathData

PathDataV1

PathsData

PackageRecord

Representation of a concrete package archive (tarball or .conda file).

Md5Field

Fields are doing something very similar to boxing and unboxing

PackageCacheRecord

Representation of a package that has been downloaded or unpacked in the local package cache.

PrefixRecord

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.EnumField

Fields 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:
  • types (primitive literal or type or sequence of types)

  • default (any, callable, optional) -- If default is callable, it's guaranteed to return a valid value at the time of Entity creation.

  • required (boolean, optional)

  • validation (callable, optional)

  • dump (boolean, optional)

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.EnumField

Fields 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:
  • types (primitive literal or type or sequence of types)

  • default (any, callable, optional) -- If default is callable, it's guaranteed to return a valid value at the time of Entity creation.

  • required (boolean, optional)

  • validation (callable, optional)

  • dump (boolean, optional)

box(instance, instance_type, val)#
class TimestampField#

Bases: conda.auxlib.entity.NumberField

Fields 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:
  • types (primitive literal or type or sequence of types)

  • default (any, callable, optional) -- If default is callable, it's guaranteed to return a valid value at the time of Entity creation.

  • required (boolean, optional)

  • validation (callable, optional)

  • dump (boolean, optional)

static _make_seconds(val)#
static _make_milliseconds(val)#
box(instance, instance_type, val)#
dump(instance, instance_type, val)#
__get__(instance, instance_type)#

Bases: conda.auxlib.entity.DictSafeMixin, conda.auxlib.entity.Entity

source#
type#
class _FeaturesField(**kwargs)#

Bases: conda.auxlib.entity.ListField

Fields 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:
  • types (primitive literal or type or sequence of types)

  • default (any, callable, optional) -- If default is callable, it's guaranteed to return a valid value at the time of Entity creation.

  • required (boolean, optional)

  • validation (callable, optional)

  • dump (boolean, optional)

box(instance, instance_type, val)#
dump(instance, instance_type, val)#
class ChannelField(aliases=())#

Bases: conda.auxlib.entity.ComposableField

Fields 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:
  • types (primitive literal or type or sequence of types)

  • default (any, callable, optional) -- If default is callable, it's guaranteed to return a valid value at the time of Entity creation.

  • required (boolean, optional)

  • validation (callable, optional)

  • dump (boolean, optional)

dump(instance, instance_type, val)#
__get__(instance, instance_type)#
class SubdirField#

Bases: conda.auxlib.entity.StringField

Fields 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:
  • types (primitive literal or type or sequence of types)

  • default (any, callable, optional) -- If default is callable, it's guaranteed to return a valid value at the time of Entity creation.

  • required (boolean, optional)

  • validation (callable, optional)

  • dump (boolean, optional)

__get__(instance, instance_type)#
class FilenameField(aliases=())#

Bases: conda.auxlib.entity.StringField

Fields 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:
  • types (primitive literal or type or sequence of types)

  • default (any, callable, optional) -- If default is callable, it's guaranteed to return a valid value at the time of Entity creation.

  • required (boolean, optional)

  • validation (callable, optional)

  • dump (boolean, optional)

__get__(instance, instance_type)#
class PackageTypeField#

Bases: conda.auxlib.entity.EnumField

Fields 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:
  • types (primitive literal or type or sequence of types)

  • default (any, callable, optional) -- If default is callable, it's guaranteed to return a valid value at the time of Entity creation.

  • required (boolean, optional)

  • validation (callable, optional)

  • dump (boolean, optional)

__get__(instance, instance_type)#
class PathData(**kwargs)#

Bases: conda.auxlib.entity.Entity

property path#
_path#
prefix_placeholder#
file_mode#
path_type#
class PathDataV1(**kwargs)#

Bases: PathData

sha256#
size_in_bytes#
inode_paths#
sha256_in_prefix#
class PathsData(**kwargs)#

Bases: conda.auxlib.entity.Entity

paths_version#
paths#
class PackageRecord(*args, **kwargs)#

Bases: conda.auxlib.entity.DictSafeMixin, conda.auxlib.entity.Entity

Representation 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 two subclasses, PrefixRecord and PackageCacheRecord. These capture the same information, but are augmented with additional information relevant for these two sources of packages.

Further note that PackageRecord makes use of its _pkey for comparison and hash generation. This means that for common operations, like comparisons between PackageRecord s and reference of PackageRecord s 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.

property schannel#

The canonical name of the channel of this package.

Part of the _pkey.

Type:

str

property _pkey#

The components of the PackageRecord that are used for comparison and hashing.

The _pkey is a tuple made up of the following fields of the PackageRecord. Two PackageRecord s test equal if their respective _pkey s are equal. The hash of the PackageRecord (important for dictionary access) is the hash of the _pkey.

The included fields are:

Type:

tuple

property is_unmanageable#
property combined_depends#
property namekey#
name#
version#
build#
build_number#
channel#
subdir#
fn#
md5#
legacy_bz2_md5#
legacy_bz2_size#
url#
sha256#
arch#
platform#
depends#
constrains#
track_features#
features#
noarch#
preferred_env#
python_site_packages_path#
license#
license_family#
package_type#
timestamp#
date#
size#
metadata: set[str]#
__hash__()#

Return hash(self).

__eq__(other)#

Return self==value.

dist_str()#
dist_fields_dump()#
__str__()#

Return str(self).

to_match_spec()#
to_simple_match_spec()#
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.StringField

Fields 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:
  • types (primitive literal or type or sequence of types)

  • default (any, callable, optional) -- If default is callable, it's guaranteed to return a valid value at the time of Entity creation.

  • required (boolean, optional)

  • validation (callable, optional)

  • dump (boolean, optional)

__get__(instance, instance_type)#
class PackageCacheRecord(*args, **kwargs)#

Bases: PackageRecord

Representation of a package that has been downloaded or unpacked in the local package cache.

Specialization of PackageRecord that 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._pkey so that a pure PackageRecord object that has the same _pkey fields as a different PackageCacheRecord object (or, indeed, a PrefixRecord object) will be considered equal and will produce the same hash.

property is_fetched#

Whether the package file exists locally.

Type:

bool

property is_extracted#

Whether the package has been extracted locally.

Type:

bool

property tarball_basename#

The basename of the local package file.

Type:

str

package_tarball_full_path#
extracted_package_dir#
md5#
_calculate_md5sum()#
class PrefixRecord(*args, **kwargs)#

Bases: PackageRecord

Representation of a package that is installed in a local conda environmnet.

Specialization of PackageRecord that 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._pkey so that a pure PackageRecord object that has the same _pkey fields as a different PrefixRecord object (or, indeed, a PackageCacheRecord object) 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#
extracted_package_dir#
files#
paths_data#
requested_spec#
auth#