gabriel / musehub public
musehub_release_packager.py python
39 lines 1.2 KB
Raw
sha256:3c58668648c7323bb9f5c6881cfe6a3f14fc93fcb73b537d253732952a5bf8bf chore: bump version to 0.2.0rc12 Sonnet 4.6 patch 8 days ago
1 """MuseHub release packager — builds download package URL maps for releases.
2
3 A release exposes artifacts so consumers can download the snapshot in their
4 preferred format. At MVP the only available package is the metadata JSON
5 manifest. Additional artifact types (source archives, etc.) can be added later.
6
7 This module contains NO database access. It operates purely on the release
8 and repo identifiers to construct URL strings.
9 """
10
11 from musehub.models.musehub import ReleaseDownloadUrls
12
13 _BASE_API = "/api"
14
15
16 def build_download_urls(
17 repo_id: str,
18 release_id: str,
19 ) -> ReleaseDownloadUrls:
20 """Construct download package URLs for a release.
21
22 Args:
23 repo_id: The ID of the MuseHub repo.
24 release_id: The ID of the release row.
25
26 Returns:
27 ``ReleaseDownloadUrls`` with the metadata URL populated.
28 """
29 base = f"{_BASE_API}/repos/{repo_id}/releases/{release_id}/packages"
30 return ReleaseDownloadUrls(metadata=f"{base}/metadata")
31
32
33 def build_empty_download_urls() -> ReleaseDownloadUrls:
34 """Return a ``ReleaseDownloadUrls`` with all fields set to ``None``.
35
36 Used when a release has no pinned commit or the commit has no stored
37 objects yet.
38 """
39 return ReleaseDownloadUrls()
File History 1 commit
sha256:3c58668648c7323bb9f5c6881cfe6a3f14fc93fcb73b537d253732952a5bf8bf chore: bump version to 0.2.0rc12 Sonnet 4.6 patch 8 days ago