Skip to content

Commit 09dd517

Browse files
feat(registry): add transient dim status on cache refresh
1 parent df97e58 commit 09dd517

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

hatch/registry_retriever.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,23 @@
66

77
import json
88
import logging
9+
import sys
910
import requests
1011
import datetime
1112
from pathlib import Path
1213
from typing import Dict, Any, Optional
1314

1415

16+
def _print_registry_status(msg: str) -> None:
17+
if sys.stderr.isatty():
18+
print(f"\033[2m{msg}\033[0m", end="\r", file=sys.stderr, flush=True)
19+
20+
21+
def _clear_registry_status() -> None:
22+
if sys.stderr.isatty():
23+
print(" " * 60, end="\r", file=sys.stderr, flush=True)
24+
25+
1526
class RegistryRetriever:
1627
"""Manages the retrieval and caching of the Hatch package registry.
1728
@@ -297,8 +308,9 @@ def get_registry(self, force_refresh: bool = False) -> Dict[str, Any]:
297308
# In simulation mode, we must have a local registry file
298309
registry_data = self._read_local_cache()
299310
else:
300-
# In online mode, fetch from remote URL
311+
_print_registry_status(" Refreshing registry cache...")
301312
registry_data = self._fetch_remote_registry()
313+
_clear_registry_status()
302314

303315
# Update local cache
304316
# Note that in case of simulation mode AND default cache path,

0 commit comments

Comments
 (0)