google-analytics-cli 0.2.0__py3-none-any.whl → 0.2.2__py3-none-any.whl
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.
- ga_cli/__init__.py +1 -1
- ga_cli/config/constants.py +39 -5
- {google_analytics_cli-0.2.0.dist-info → google_analytics_cli-0.2.2.dist-info}/METADATA +15 -2
- {google_analytics_cli-0.2.0.dist-info → google_analytics_cli-0.2.2.dist-info}/RECORD +6 -6
- {google_analytics_cli-0.2.0.dist-info → google_analytics_cli-0.2.2.dist-info}/WHEEL +0 -0
- {google_analytics_cli-0.2.0.dist-info → google_analytics_cli-0.2.2.dist-info}/entry_points.txt +0 -0
ga_cli/__init__.py
CHANGED
ga_cli/config/constants.py
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"""Application constants and configuration paths."""
|
|
2
2
|
|
|
3
3
|
import os
|
|
4
|
+
import shutil
|
|
4
5
|
from pathlib import Path
|
|
5
6
|
|
|
6
|
-
from platformdirs import user_config_dir
|
|
7
|
-
|
|
8
7
|
# App identity
|
|
9
8
|
APP_NAME = "ga-cli"
|
|
10
9
|
|
|
@@ -21,14 +20,49 @@ OAUTH_SCOPES = [
|
|
|
21
20
|
# OAuth callback server
|
|
22
21
|
OAUTH_CALLBACK_PORT = 8085
|
|
23
22
|
|
|
23
|
+
# Track whether we've already attempted the legacy macOS migration this process.
|
|
24
|
+
_legacy_migration_attempted = False
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def _migrate_legacy_macos_config(new_dir: Path) -> None:
|
|
28
|
+
"""Move config from the legacy macOS path to the new XDG-style path.
|
|
29
|
+
|
|
30
|
+
Versions <=0.2.1 used ``platformdirs``, which on macOS resolves to
|
|
31
|
+
``~/Library/Application Support/ga-cli/``. We now standardize on
|
|
32
|
+
``~/.config/ga-cli/`` across all platforms. If the legacy directory exists
|
|
33
|
+
and the new one doesn't, move it. Runs at most once per process.
|
|
34
|
+
"""
|
|
35
|
+
global _legacy_migration_attempted
|
|
36
|
+
if _legacy_migration_attempted:
|
|
37
|
+
return
|
|
38
|
+
_legacy_migration_attempted = True
|
|
39
|
+
|
|
40
|
+
legacy_dir = Path.home() / "Library" / "Application Support" / APP_NAME
|
|
41
|
+
if legacy_dir.is_dir() and not new_dir.exists():
|
|
42
|
+
try:
|
|
43
|
+
new_dir.parent.mkdir(parents=True, exist_ok=True)
|
|
44
|
+
shutil.move(str(legacy_dir), str(new_dir))
|
|
45
|
+
except OSError:
|
|
46
|
+
# Migration is best-effort; fall through and let callers create
|
|
47
|
+
# the new directory themselves if needed.
|
|
48
|
+
pass
|
|
49
|
+
|
|
50
|
+
|
|
24
51
|
# Configuration directory
|
|
25
|
-
# Priority: GA_CLI_CONFIG_DIR env var >
|
|
52
|
+
# Priority: GA_CLI_CONFIG_DIR env var > ~/.config/ga-cli/ (all platforms)
|
|
26
53
|
def get_config_dir() -> Path:
|
|
27
|
-
"""Get the configuration directory path.
|
|
54
|
+
"""Get the configuration directory path.
|
|
55
|
+
|
|
56
|
+
Resolution order:
|
|
57
|
+
1. ``GA_CLI_CONFIG_DIR`` environment variable (used in tests too).
|
|
58
|
+
2. ``~/.config/ga-cli/`` on all platforms.
|
|
59
|
+
"""
|
|
28
60
|
env_dir = os.environ.get("GA_CLI_CONFIG_DIR")
|
|
29
61
|
if env_dir:
|
|
30
62
|
return Path(env_dir)
|
|
31
|
-
|
|
63
|
+
config_dir = Path.home() / ".config" / APP_NAME
|
|
64
|
+
_migrate_legacy_macos_config(config_dir)
|
|
65
|
+
return config_dir
|
|
32
66
|
|
|
33
67
|
|
|
34
68
|
def get_credentials_path() -> Path:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: google-analytics-cli
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.2
|
|
4
4
|
Summary: Command-line interface for Google Analytics 4
|
|
5
5
|
Project-URL: Homepage, https://github.com/daidalytics/google-analytics-cli
|
|
6
6
|
Project-URL: Repository, https://github.com/daidalytics/google-analytics-cli
|
|
@@ -24,7 +24,6 @@ Requires-Dist: google-api-python-client>=2.0
|
|
|
24
24
|
Requires-Dist: google-auth-oauthlib>=1.0
|
|
25
25
|
Requires-Dist: google-auth>=2.0
|
|
26
26
|
Requires-Dist: packaging>=23.0
|
|
27
|
-
Requires-Dist: platformdirs>=4.0
|
|
28
27
|
Requires-Dist: questionary>=2.0
|
|
29
28
|
Requires-Dist: rich>=13.0
|
|
30
29
|
Requires-Dist: shellingham>=1.3.0
|
|
@@ -298,6 +297,20 @@ jobs:
|
|
|
298
297
|
rm /tmp/sa-key.json
|
|
299
298
|
```
|
|
300
299
|
|
|
300
|
+
## Troubleshooting
|
|
301
|
+
|
|
302
|
+
**`ga` runs `git add` instead of GA CLI.** You have a shell alias shadowing the command — commonly `alias ga='git add'` in `~/.gitconfig`-style setups or `~/.zshrc`/`~/.bashrc`. Run `type ga` to confirm, then `unalias ga` (or remove the alias from your shell config) and restart your shell.
|
|
303
|
+
|
|
304
|
+
**`ga: command not found` after install.** Your Python user bin directory isn't on `PATH`. For `pip install --user`, `pipx`, or `uv tool install`, the binary lives in `~/.local/bin` on Linux/macOS. Add it to your shell config:
|
|
305
|
+
|
|
306
|
+
```bash
|
|
307
|
+
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc # or ~/.bashrc
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
Then restart your shell. `pipx ensurepath` and `uv tool update-shell` can do this automatically.
|
|
311
|
+
|
|
312
|
+
**Upgrading from 0.2.1 or earlier on macOS.** Older versions stored config at `~/Library/Application Support/ga-cli/`. GA CLI now uses `~/.config/ga-cli/` on all platforms and will migrate the directory automatically the first time you run any command. No action required.
|
|
313
|
+
|
|
301
314
|
## Privacy
|
|
302
315
|
|
|
303
316
|
GA CLI stores authentication credentials locally on your machine. No data is sent to any third party — all communication is directly between your machine and Google's APIs.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
ga_cli/__init__.py,sha256=
|
|
1
|
+
ga_cli/__init__.py,sha256=EVdY_GaBSodKq6rMkyKBcUzQLGOHaPDoyFqcDzlnTnY,241
|
|
2
2
|
ga_cli/main.py,sha256=QB_s_-Tq3uxmKbEduMtOQ6hFwo4T_0WDOpHuJLdbUwA,4562
|
|
3
3
|
ga_cli/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
4
|
ga_cli/api/client.py,sha256=GM53azK0cT0a_T9AYGmJfQZdCPanlXTnLXhKXUfLkWA,4375
|
|
@@ -36,7 +36,7 @@ ga_cli/commands/property_settings.py,sha256=TJbpmSZBUJ9NIYmaVprYIqw8X3-Lp8AC7t1V
|
|
|
36
36
|
ga_cli/commands/reports.py,sha256=QE6hVHnv0maz-0Bt4owdlBvVe9Hp4C0dVslo-aMRViA,39198
|
|
37
37
|
ga_cli/commands/upgrade_cmd.py,sha256=RSYEz97sNKibVwiINsdX4j6TrEhNrg2cd9BWMGPNYJA,4876
|
|
38
38
|
ga_cli/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
39
|
-
ga_cli/config/constants.py,sha256=
|
|
39
|
+
ga_cli/config/constants.py,sha256=p-1l8q7vv2FEbOGsi0NKJEEbuZprTlXSpU6h614KVHY,2926
|
|
40
40
|
ga_cli/config/store.py,sha256=fqB3AV3DcAz94sq2qXNEI8d6MBfXA945QFaYq25NraU,3294
|
|
41
41
|
ga_cli/utils/__init__.py,sha256=iGF_XKuesFSCPmC-AA7WByxZeQutN6dQqlO_BG4_u3Q,1356
|
|
42
42
|
ga_cli/utils/describe.py,sha256=QtCXB4Nm3DKb9BBxDEQbHv6UbDL3bo7WRYRucIEWaXs,3999
|
|
@@ -45,7 +45,7 @@ ga_cli/utils/errors.py,sha256=l0Iwjmj1QqzLU032QAiVUnIbfntkxoIAZqyQCfgACCE,4465
|
|
|
45
45
|
ga_cli/utils/filters.py,sha256=tYtajCWC5CGPtrlpT95KA19y86a6cg0ejQXXjzguheg,8378
|
|
46
46
|
ga_cli/utils/output.py,sha256=0ihWQi7-kGSkNb-0OTFv_12ZmqVUjpZQLEGjvNrxUeE,6092
|
|
47
47
|
ga_cli/utils/pagination.py,sha256=w6_To6luCR54M04Uk_WFFydvProG2yGxN-CzkzSk9c4,2380
|
|
48
|
-
google_analytics_cli-0.2.
|
|
49
|
-
google_analytics_cli-0.2.
|
|
50
|
-
google_analytics_cli-0.2.
|
|
51
|
-
google_analytics_cli-0.2.
|
|
48
|
+
google_analytics_cli-0.2.2.dist-info/METADATA,sha256=SYDIzjG8dtMtttGgRndffEUCOeWL61CXhBS1udcUM_E,12870
|
|
49
|
+
google_analytics_cli-0.2.2.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
|
|
50
|
+
google_analytics_cli-0.2.2.dist-info/entry_points.txt,sha256=J1Jvi1IZo4YujxqhyipvHz4NAepNhxZo7g_WyQIIOz0,39
|
|
51
|
+
google_analytics_cli-0.2.2.dist-info/RECORD,,
|
|
File without changes
|
{google_analytics_cli-0.2.0.dist-info → google_analytics_cli-0.2.2.dist-info}/entry_points.txt
RENAMED
|
File without changes
|