swh.loader.package.hex.loader module#

class swh.loader.package.hex.loader.HexPackageInfo(url: str, filename: str | None, version: str, name: str, release_url: str, inserted_at: str, updated_at: str, author: Person, *, directory_extrinsic_metadata: List[RawExtrinsicMetadataCore] = [], checksums: Dict[str, str] = {})[source]#

Bases: BasePackageInfo

Method generated by attrs for class HexPackageInfo.

name#

Name of the package related to the release

release_url#

URL to the release metadata (e.g. https://hex.pm/api/packages/phoenix/releases/1.7.0-rc.2)

inserted_at#

35.171799Z) This is slightly later than the package inserted_at time

Type:

Release insert time in UTC (e.g. 2015-10-11T06

Type:

19

updated_at#

35.171799Z) This is slightly later than the release inserted_at time because of docs build. It can only be updated further within 1 hour of the release

Type:

Release update time in UTC (e.g. 2015-10-11T06

Type:

19

author#

Author of the release

EXTID_TYPE: str = 'hexpm-sha256'#
MANIFEST_FORMAT: Template | None = <string.Template object>#

If not None, used by the default extid() implementation to format a manifest, before hashing it to produce an ExtID.

class swh.loader.package.hex.loader.HexLoader(storage: StorageInterface, url: str, releases: Dict[str, Any], **kwargs: Any)[source]#

Bases: PackageLoader[HexPackageInfo]

Load a Hex package from a given hex.pm URL into the SWH archive.

visit_type: str = 'hex'#
get_versions() Sequence[str][source]#

Return the list of all published package versions.

Raises:

classswh.loader.exception.NotFound error when failing to read the published package versions.

Returns:

Sequence of published versions

get_default_version() str[source]#

Retrieve the latest release version if any.

Returns:

Latest version

get_metadata_authority()[source]#

For package loaders that get extrinsic metadata, returns the authority the metadata are coming from.

get_package_info(version: str) Iterator[Tuple[str, HexPackageInfo]][source]#
Given a release version of a package, retrieve the associated

package information for such version.

Parameters:

version – Package version

Returns:

(branch name, package metadata)

build_release(p_info: HexPackageInfo, uncompressed_path: str, directory: bytes) Release | None[source]#

Build the release from the archive metadata (extrinsic artifact metadata) and the intrinsic metadata.

Parameters:
  • p_info – Package information

  • uncompressed_path – Artifact uncompressed path on disk