v0.2.0
Release notes
Breaking Changes
HubApi.login()now raisesNetworkError,ServerError, orRequestTimeoutErrorfor non‑authentication failures instead of always raisingAuthenticationError. Callers that usedexcept AuthenticationErrorto catch any login failure should widen it toHubError.
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
RequestIdare preserved, restoring traceability. - Bare and upper‑case endpoints now work (e.g.,
--endpoint modelscope.aiorHTTPS://...). - 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 retryableServerError. - When the endpoint is not pinned, a rejected login probes the peer ModelScope site and suggests
--endpointif the token is valid there. --verbosenow 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
requeststransport, exercising the config, facade, legacy client, and error‑translation layers.
What's Changed
- Faithful login errors and safer credential handling by @wangxingjun778 in #48
- [Docs] Update news and bump version by @wangxingjun778 in #49
Full Changelog: v0.1.9...v0.2.0