Conversation
New musicbrainzpy.coverart module with async CoverArtClient and SyncCoverArtClient for the Cover Art Archive API: - get_image_list / get_release_group_image_list (JSON listings) - get_front / get_back / get_release_group_front (binary images) - get_image (by numeric ID, with optional thumbnail size) - Pydantic models: CoverArtImageList, CoverArtImage, Thumbnails - Separate httpx client with follow_redirects for 307s - Update migration guide with full CAA coverage
Add examples/cover_art.py showing cover art retrieval for Sufjan Stevens — Carrie & Lowell (PDF booklet, PNG scans, comments, diverse image types). Add image_info() to both CoverArtClient and SyncCoverArtClient for HEAD-based metadata (content-type, content-length) without downloading the full image. Fix CoverArtImage.id type to accept int (real API returns integers, not strings as documented).
- New _retry module with async_retry/sync_retry helpers - Exponential backoff on transient errors (httpx.TransportError, RateLimitedError) with configurable max_retries and base_delay - Respect Retry-After header on 429/503 responses - Map HTTP 429 to RateLimitedError (alongside existing 503) - RateLimitedError now carries retry_after attribute - Enable follow_redirects=True on both MB client httpx instances (CAA clients already had this) - Rate limiter acquire() inside retry loop so retries respect rate limits - All clients accept max_retries/retry_base_delay constructor params
Constructor args (app_name, app_version, app_contact) are now optional and fall back to MUSICBRAINZPY_APP, MUSICBRAINZPY_VERSION, MUSICBRAINZPY_CONTACT env vars. Raises ValueError if neither is set. Also supports: - MUSICBRAINZPY_BASE_URL — override API base URL - MUSICBRAINZPY_USERNAME / MUSICBRAINZPY_PASSWORD — digest auth Explicit constructor arguments always take precedence over env vars.
- README: add Cover Art Archive usage, env vars table, mention retry - architecture.md: add new modules to layout (coverart, _retry, annotation/collection/coverart models), add retry/CAA/env vars sections - api-reference.md: add retry behavior, Cover Art Archive endpoints, env vars table, note 429 alongside 503 for rate limiting
- Replace PEP 695 type parameter syntax (def func[T], class Foo[T]) with TypeVar + Generic for 3.10 compatibility - Replace StrEnum (3.11+) with str+Enum base class - Update requires-python, classifiers, README, and migration guide
Test matrix: Python 3.10-3.14 on Linux, macOS, and Windows. Runs pytest, ruff check, and ruff format.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.