Skip to content

v0.2.0

Choose a tag to compare

@wangxingjun778 wangxingjun778 released this 01 Aug 14:59

Release notes

Breaking Changes

  • HubApi.login() now raises NetworkError, ServerError, or RequestTimeoutError for non‑authentication failures instead of always raising AuthenticationError. Callers that used except AuthenticationError to catch any login failure should widen it to HubError.

Fixed

  • Login failures are no longer misreported as an invalid token – network, timeout, and 5xx errors now surface correctly.
  • A failed login no longer deletes stored credentials; persisted credentials are left untouched.
  • The server’s explanation and RequestId are preserved, restoring traceability.
  • Bare and upper‑case endpoints now work (e.g., --endpoint modelscope.ai or HTTPS://...).
  • Credential teardown is all‑or‑nothing; clear_token() removes the session cookie while leaving git token and cached identity consistent.
  • A cleared token now propagates to already constructed legacy clients.

Enhancements

  • Errors are classified by the server business code for 4xx responses (10010103009 → AuthenticationError/E3001); 5xx remain retryable ServerError.
  • When the endpoint is not pinned, a rejected login probes the peer ModelScope site and suggests --endpoint if the token is valid there.
  • --verbose now prints the full error cause chain (bounded and cycle‑safe).
  • Endpoint normalisation is centralised in HubConfig.normalize_endpoint() for consistent behaviour across all entry points.

Tests

  • Added 29 regression tests covering login failure paths, credential lifecycle, and error reporting. The tests stub only the requests transport, exercising the config, facade, legacy client, and error‑translation layers.

What's Changed

Full Changelog: v0.1.9...v0.2.0