Skip to content

Commit

Permalink
Add tqdm descriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
orf committed Oct 20, 2024
1 parent 6d1e39d commit 161a73b
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/pypi_data/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def load_repos(

log.info("Loaded: writing file")
with open_path(repos_file, mode="wb") as fd:
for repo in tqdm.tqdm(repos, mininterval=1):
for repo in tqdm.tqdm(repos, mininterval=1, desc="Writing repos"):
fd.write(repo.model_dump_json().encode("utf-8"))
fd.write(b"\n")

Expand Down Expand Up @@ -139,7 +139,9 @@ def load_repos(
log.info("Writing package index")

with open_path(packages_file, mode="wb") as fd:
for package_index in tqdm.tqdm(packages, mininterval=1):
for package_index in tqdm.tqdm(
packages, mininterval=1, desc="Writing package index"
):
fd.write(package_index.model_dump_json().encode("utf-8"))
fd.write(b"\n")

Expand All @@ -150,7 +152,9 @@ async def load_indexes(
semaphore = asyncio.Semaphore(concurrency)
results = []
async with httpx.AsyncClient() as client:
with tqdm.tqdm(total=len(repositories), mininterval=1) as pbar:
with tqdm.tqdm(
total=len(repositories), mininterval=1, desc="Loading indexes"
) as pbar:

async def _run(r: CodeRepository) -> CodeRepository | None:
async with semaphore:
Expand Down Expand Up @@ -225,7 +229,9 @@ async def resolve_dataset_redirects(
) -> list[str]:
semaphore = asyncio.Semaphore(concurrency)
async with httpx.AsyncClient() as client:
with tqdm.tqdm(total=len(repositories), mininterval=1) as pbar:
with tqdm.tqdm(
total=len(repositories), mininterval=1, desc="Resolving redirects"
) as pbar:

async def _run(r: CodeRepository) -> str | None:
async with semaphore:
Expand Down

0 comments on commit 161a73b

Please sign in to comment.