eolas-data 1.3.19__tar.gz → 1.3.20__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. {eolas_data-1.3.19 → eolas_data-1.3.20}/PKG-INFO +1 -1
  2. {eolas_data-1.3.19 → eolas_data-1.3.20}/eolas_data/__init__.py +1 -1
  3. {eolas_data-1.3.19 → eolas_data-1.3.20}/eolas_data/cli.py +16 -3
  4. {eolas_data-1.3.19 → eolas_data-1.3.20}/eolas_data/client.py +6 -2
  5. {eolas_data-1.3.19 → eolas_data-1.3.20}/pyproject.toml +1 -1
  6. {eolas_data-1.3.19 → eolas_data-1.3.20}/tests/test_progress.py +14 -0
  7. {eolas_data-1.3.19 → eolas_data-1.3.20}/.github/workflows/catalog-drift.yml +0 -0
  8. {eolas_data-1.3.19 → eolas_data-1.3.20}/.github/workflows/pre-release.yml +0 -0
  9. {eolas_data-1.3.19 → eolas_data-1.3.20}/.github/workflows/publish.yml +0 -0
  10. {eolas_data-1.3.19 → eolas_data-1.3.20}/.github/workflows/smoke.yml +0 -0
  11. {eolas_data-1.3.19 → eolas_data-1.3.20}/.github/workflows/test.yml +0 -0
  12. {eolas_data-1.3.19 → eolas_data-1.3.20}/.gitignore +0 -0
  13. {eolas_data-1.3.19 → eolas_data-1.3.20}/LICENSE +0 -0
  14. {eolas_data-1.3.19 → eolas_data-1.3.20}/README.md +0 -0
  15. {eolas_data-1.3.19 → eolas_data-1.3.20}/eolas_data/_dataset_names.py +0 -0
  16. {eolas_data-1.3.19 → eolas_data-1.3.20}/eolas_data/_regen_names.py +0 -0
  17. {eolas_data-1.3.19 → eolas_data-1.3.20}/eolas_data/cdc.py +0 -0
  18. {eolas_data-1.3.19 → eolas_data-1.3.20}/eolas_data/console.py +0 -0
  19. {eolas_data-1.3.19 → eolas_data-1.3.20}/eolas_data/dataset.py +0 -0
  20. {eolas_data-1.3.19 → eolas_data-1.3.20}/eolas_data/exceptions.py +0 -0
  21. {eolas_data-1.3.19 → eolas_data-1.3.20}/eolas_data/library.py +0 -0
  22. {eolas_data-1.3.19 → eolas_data-1.3.20}/eolas_data/meta.py +0 -0
  23. {eolas_data-1.3.19 → eolas_data-1.3.20}/eolas_data/rows.py +0 -0
  24. {eolas_data-1.3.19 → eolas_data-1.3.20}/eolas_data/schedule.py +0 -0
  25. {eolas_data-1.3.19 → eolas_data-1.3.20}/eolas_data/search.py +0 -0
  26. {eolas_data-1.3.19 → eolas_data-1.3.20}/scripts/check_client_contract.py +0 -0
  27. {eolas_data-1.3.19 → eolas_data-1.3.20}/scripts/preflight.sh +0 -0
  28. {eolas_data-1.3.19 → eolas_data-1.3.20}/tests/fixtures/source_helpers.json +0 -0
  29. {eolas_data-1.3.19 → eolas_data-1.3.20}/tests/test_as_arrow.py +0 -0
  30. {eolas_data-1.3.19 → eolas_data-1.3.20}/tests/test_cdc_roundtrip.py +0 -0
  31. {eolas_data-1.3.19 → eolas_data-1.3.20}/tests/test_changes_http.py +0 -0
  32. {eolas_data-1.3.19 → eolas_data-1.3.20}/tests/test_cli.py +0 -0
  33. {eolas_data-1.3.19 → eolas_data-1.3.20}/tests/test_client.py +0 -0
  34. {eolas_data-1.3.19 → eolas_data-1.3.20}/tests/test_date_filter.py +0 -0
  35. {eolas_data-1.3.19 → eolas_data-1.3.20}/tests/test_get_local.py +0 -0
  36. {eolas_data-1.3.19 → eolas_data-1.3.20}/tests/test_keyring.py +0 -0
  37. {eolas_data-1.3.19 → eolas_data-1.3.20}/tests/test_library.py +0 -0
  38. {eolas_data-1.3.19 → eolas_data-1.3.20}/tests/test_meta.py +0 -0
  39. {eolas_data-1.3.19 → eolas_data-1.3.20}/tests/test_rows.py +0 -0
  40. {eolas_data-1.3.19 → eolas_data-1.3.20}/tests/test_schedule.py +0 -0
  41. {eolas_data-1.3.19 → eolas_data-1.3.20}/tests/test_search.py +0 -0
  42. {eolas_data-1.3.19 → eolas_data-1.3.20}/tests/test_smoke_live.py +0 -0
  43. {eolas_data-1.3.19 → eolas_data-1.3.20}/tests/test_source_helpers.py +0 -0
  44. {eolas_data-1.3.19 → eolas_data-1.3.20}/tests/test_sync_bulk.py +0 -0
  45. {eolas_data-1.3.19 → eolas_data-1.3.20}/tests/test_sync_changes.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: eolas-data
3
- Version: 1.3.19
3
+ Version: 1.3.20
4
4
  Summary: Python client for the eolas.fyi statistical data API (NZ + OECD; Australia on roadmap)
5
5
  Project-URL: Homepage, https://eolas.fyi
6
6
  Project-URL: Documentation, https://docs.eolas.fyi/
@@ -15,7 +15,7 @@ from .exceptions import (
15
15
  WatermarkExpired,
16
16
  )
17
17
 
18
- __version__ = "1.3.19"
18
+ __version__ = "1.3.20"
19
19
 
20
20
  __all__ = [
21
21
  "Client",
@@ -401,6 +401,10 @@ def download_cmd(
401
401
  False, "--no-progress",
402
402
  help="Disable the download progress bar (useful when output is captured by a log collector).",
403
403
  ),
404
+ show_progress: bool = typer.Option(
405
+ False, "--progress",
406
+ help="Always show the download progress bar (even when stdout/stderr are not a TTY).",
407
+ ),
404
408
  api_key: Optional[str] = typer.Option(None, "--api-key"),
405
409
  ) -> None:
406
410
  """Download a dataset as a single file (Parquet, CSV, or GeoParquet).
@@ -438,6 +442,15 @@ def download_cmd(
438
442
  except EolasError as e:
439
443
  _bail(str(e), _exit_for(e))
440
444
 
445
+ if show_progress and no_progress:
446
+ _bail("--progress and --no-progress are mutually exclusive", EXIT_USAGE)
447
+ if show_progress:
448
+ _progress: Optional[bool] = True
449
+ elif no_progress:
450
+ _progress = False
451
+ else:
452
+ _progress = None
453
+
441
454
  if use_live:
442
455
  if freshness != "auto":
443
456
  err_console.print(
@@ -455,7 +468,7 @@ def download_cmd(
455
468
  name,
456
469
  path=out,
457
470
  format=live_fmt,
458
- progress=False if no_progress else None,
471
+ progress=_progress,
459
472
  )
460
473
  except EolasError as e:
461
474
  _bail(str(e), _exit_for(e))
@@ -474,7 +487,7 @@ def download_cmd(
474
487
  freshness=freshness,
475
488
  format=server_fmt,
476
489
  path=out,
477
- progress=False if no_progress else None,
490
+ progress=_progress,
478
491
  )
479
492
  except BulkUpgradeRequired as e:
480
493
  err_console.print(f"[red]error:[/red] {e}")
@@ -488,7 +501,7 @@ def download_cmd(
488
501
  name,
489
502
  path=out,
490
503
  format=live_fmt,
491
- progress=False if no_progress else None,
504
+ progress=_progress,
492
505
  )
493
506
  except EolasError as e:
494
507
  _bail(str(e), _exit_for(e))
@@ -1296,7 +1296,9 @@ class Client:
1296
1296
  return False
1297
1297
  if "ipykernel" in sys.modules:
1298
1298
  return True
1299
- return sys.stdout.isatty()
1299
+ # tqdm writes to stderr; many terminals/IDEs pipe stdout but keep stderr
1300
+ # on the controlling TTY (Cursor, VS Code, script wrappers).
1301
+ return sys.stderr.isatty() or sys.stdout.isatty()
1300
1302
 
1301
1303
  @staticmethod
1302
1304
  def _resolve_progress_phases(progress: ProgressControl) -> dict[str, bool]:
@@ -1401,8 +1403,10 @@ class Client:
1401
1403
  unit_scale=True,
1402
1404
  unit_divisor=1024,
1403
1405
  desc=label,
1406
+ file=sys.stderr,
1407
+ dynamic_ncols=True,
1404
1408
  disable=not show_progress,
1405
- leave=False,
1409
+ leave=True,
1406
1410
  ) as bar:
1407
1411
  with dest.open("wb") as fh:
1408
1412
  # 1 MiB chunks: responsive bar updates (bar refreshes ~once per
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "eolas-data"
7
- version = "1.3.19"
7
+ version = "1.3.20"
8
8
  description = "Python client for the eolas.fyi statistical data API (NZ + OECD; Australia on roadmap)"
9
9
  readme = "README.md"
10
10
  license = { text = "MIT" }
@@ -478,6 +478,20 @@ def test_progress_phase_selectors():
478
478
  assert Client._resolve_show_progress("download", "read") is False
479
479
 
480
480
 
481
+ def test_progress_auto_detect_uses_stderr_tty():
482
+ """tqdm writes to stderr; progress should show when stderr is a TTY even if stdout is piped."""
483
+ from unittest.mock import patch
484
+ from eolas_data.client import Client
485
+
486
+ with patch("sys.stdout.isatty", return_value=False), \
487
+ patch("sys.stderr.isatty", return_value=True):
488
+ assert Client._progress_auto_detect() is True
489
+
490
+ with patch("sys.stdout.isatty", return_value=False), \
491
+ patch("sys.stderr.isatty", return_value=False):
492
+ assert Client._progress_auto_detect() is False
493
+
494
+
481
495
  def test_progress_resolver_detects_jupyter():
482
496
  """Jupyter wraps stdout so isatty() is False, but the user IS interactive
483
497
  and tqdm.auto can render a widget. Resolver must return True when
File without changes
File without changes
File without changes