stata-cli 0.5.1__tar.gz → 0.5.2__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.
- {stata_cli-0.5.1 → stata_cli-0.5.2}/PKG-INFO +1 -1
- {stata_cli-0.5.1 → stata_cli-0.5.2}/pyproject.toml +1 -1
- stata_cli-0.5.2/src/stata_cli/__init__.py +1 -0
- {stata_cli-0.5.1 → stata_cli-0.5.2}/src/stata_cli/main.py +52 -0
- {stata_cli-0.5.1 → stata_cli-0.5.2}/src/stata_cli/utils.py +60 -6
- {stata_cli-0.5.1 → stata_cli-0.5.2}/src/stata_cli.egg-info/PKG-INFO +1 -1
- stata_cli-0.5.1/src/stata_cli/__init__.py +0 -1
- {stata_cli-0.5.1 → stata_cli-0.5.2}/README.md +0 -0
- {stata_cli-0.5.1 → stata_cli-0.5.2}/setup.cfg +0 -0
- {stata_cli-0.5.1 → stata_cli-0.5.2}/src/stata_cli/__main__.py +0 -0
- {stata_cli-0.5.1 → stata_cli-0.5.2}/src/stata_cli/daemon.py +0 -0
- {stata_cli-0.5.1 → stata_cli-0.5.2}/src/stata_cli/engine.py +0 -0
- {stata_cli-0.5.1 → stata_cli-0.5.2}/src/stata_cli/graph_artifacts.py +0 -0
- {stata_cli-0.5.1 → stata_cli-0.5.2}/src/stata_cli/output_filter.py +0 -0
- {stata_cli-0.5.1 → stata_cli-0.5.2}/src/stata_cli/skill_registry.py +0 -0
- {stata_cli-0.5.1 → stata_cli-0.5.2}/src/stata_cli/skills/overview.md +0 -0
- {stata_cli-0.5.1 → stata_cli-0.5.2}/src/stata_cli/skills/packages/asdoc.md +0 -0
- {stata_cli-0.5.1 → stata_cli-0.5.2}/src/stata_cli/skills/packages/binsreg.md +0 -0
- {stata_cli-0.5.1 → stata_cli-0.5.2}/src/stata_cli/skills/packages/coefplot.md +0 -0
- {stata_cli-0.5.1 → stata_cli-0.5.2}/src/stata_cli/skills/packages/data-manipulation.md +0 -0
- {stata_cli-0.5.1 → stata_cli-0.5.2}/src/stata_cli/skills/packages/diagnostics.md +0 -0
- {stata_cli-0.5.1 → stata_cli-0.5.2}/src/stata_cli/skills/packages/did.md +0 -0
- {stata_cli-0.5.1 → stata_cli-0.5.2}/src/stata_cli/skills/packages/estout.md +0 -0
- {stata_cli-0.5.1 → stata_cli-0.5.2}/src/stata_cli/skills/packages/event-study.md +0 -0
- {stata_cli-0.5.1 → stata_cli-0.5.2}/src/stata_cli/skills/packages/graph-schemes.md +0 -0
- {stata_cli-0.5.1 → stata_cli-0.5.2}/src/stata_cli/skills/packages/ivreg2.md +0 -0
- {stata_cli-0.5.1 → stata_cli-0.5.2}/src/stata_cli/skills/packages/nprobust.md +0 -0
- {stata_cli-0.5.1 → stata_cli-0.5.2}/src/stata_cli/skills/packages/outreg2.md +0 -0
- {stata_cli-0.5.1 → stata_cli-0.5.2}/src/stata_cli/skills/packages/package-management.md +0 -0
- {stata_cli-0.5.1 → stata_cli-0.5.2}/src/stata_cli/skills/packages/psmatch2.md +0 -0
- {stata_cli-0.5.1 → stata_cli-0.5.2}/src/stata_cli/skills/packages/rdrobust.md +0 -0
- {stata_cli-0.5.1 → stata_cli-0.5.2}/src/stata_cli/skills/packages/reghdfe.md +0 -0
- {stata_cli-0.5.1 → stata_cli-0.5.2}/src/stata_cli/skills/packages/synth.md +0 -0
- {stata_cli-0.5.1 → stata_cli-0.5.2}/src/stata_cli/skills/packages/tabout.md +0 -0
- {stata_cli-0.5.1 → stata_cli-0.5.2}/src/stata_cli/skills/packages/winsor.md +0 -0
- {stata_cli-0.5.1 → stata_cli-0.5.2}/src/stata_cli/skills/packages/xtabond2.md +0 -0
- {stata_cli-0.5.1 → stata_cli-0.5.2}/src/stata_cli/skills/references/advanced-programming.md +0 -0
- {stata_cli-0.5.1 → stata_cli-0.5.2}/src/stata_cli/skills/references/basics-getting-started.md +0 -0
- {stata_cli-0.5.1 → stata_cli-0.5.2}/src/stata_cli/skills/references/bootstrap-simulation.md +0 -0
- {stata_cli-0.5.1 → stata_cli-0.5.2}/src/stata_cli/skills/references/data-import-export.md +0 -0
- {stata_cli-0.5.1 → stata_cli-0.5.2}/src/stata_cli/skills/references/data-management.md +0 -0
- {stata_cli-0.5.1 → stata_cli-0.5.2}/src/stata_cli/skills/references/date-time-functions.md +0 -0
- {stata_cli-0.5.1 → stata_cli-0.5.2}/src/stata_cli/skills/references/descriptive-statistics.md +0 -0
- {stata_cli-0.5.1 → stata_cli-0.5.2}/src/stata_cli/skills/references/difference-in-differences.md +0 -0
- {stata_cli-0.5.1 → stata_cli-0.5.2}/src/stata_cli/skills/references/external-tools-integration.md +0 -0
- {stata_cli-0.5.1 → stata_cli-0.5.2}/src/stata_cli/skills/references/gmm-estimation.md +0 -0
- {stata_cli-0.5.1 → stata_cli-0.5.2}/src/stata_cli/skills/references/graphics.md +0 -0
- {stata_cli-0.5.1 → stata_cli-0.5.2}/src/stata_cli/skills/references/limited-dependent-variables.md +0 -0
- {stata_cli-0.5.1 → stata_cli-0.5.2}/src/stata_cli/skills/references/linear-regression.md +0 -0
- {stata_cli-0.5.1 → stata_cli-0.5.2}/src/stata_cli/skills/references/machine-learning.md +0 -0
- {stata_cli-0.5.1 → stata_cli-0.5.2}/src/stata_cli/skills/references/mata-data-access.md +0 -0
- {stata_cli-0.5.1 → stata_cli-0.5.2}/src/stata_cli/skills/references/mata-introduction.md +0 -0
- {stata_cli-0.5.1 → stata_cli-0.5.2}/src/stata_cli/skills/references/mata-matrix-operations.md +0 -0
- {stata_cli-0.5.1 → stata_cli-0.5.2}/src/stata_cli/skills/references/mata-programming.md +0 -0
- {stata_cli-0.5.1 → stata_cli-0.5.2}/src/stata_cli/skills/references/matching-methods.md +0 -0
- {stata_cli-0.5.1 → stata_cli-0.5.2}/src/stata_cli/skills/references/mathematical-functions.md +0 -0
- {stata_cli-0.5.1 → stata_cli-0.5.2}/src/stata_cli/skills/references/maximum-likelihood.md +0 -0
- {stata_cli-0.5.1 → stata_cli-0.5.2}/src/stata_cli/skills/references/missing-data-handling.md +0 -0
- {stata_cli-0.5.1 → stata_cli-0.5.2}/src/stata_cli/skills/references/nonparametric-methods.md +0 -0
- {stata_cli-0.5.1 → stata_cli-0.5.2}/src/stata_cli/skills/references/panel-data.md +0 -0
- {stata_cli-0.5.1 → stata_cli-0.5.2}/src/stata_cli/skills/references/programming-basics.md +0 -0
- {stata_cli-0.5.1 → stata_cli-0.5.2}/src/stata_cli/skills/references/regression-discontinuity.md +0 -0
- {stata_cli-0.5.1 → stata_cli-0.5.2}/src/stata_cli/skills/references/sample-selection.md +0 -0
- {stata_cli-0.5.1 → stata_cli-0.5.2}/src/stata_cli/skills/references/sem-factor-analysis.md +0 -0
- {stata_cli-0.5.1 → stata_cli-0.5.2}/src/stata_cli/skills/references/spatial-analysis.md +0 -0
- {stata_cli-0.5.1 → stata_cli-0.5.2}/src/stata_cli/skills/references/string-functions.md +0 -0
- {stata_cli-0.5.1 → stata_cli-0.5.2}/src/stata_cli/skills/references/survey-data-analysis.md +0 -0
- {stata_cli-0.5.1 → stata_cli-0.5.2}/src/stata_cli/skills/references/survival-analysis.md +0 -0
- {stata_cli-0.5.1 → stata_cli-0.5.2}/src/stata_cli/skills/references/tables-reporting.md +0 -0
- {stata_cli-0.5.1 → stata_cli-0.5.2}/src/stata_cli/skills/references/time-series.md +0 -0
- {stata_cli-0.5.1 → stata_cli-0.5.2}/src/stata_cli/skills/references/treatment-effects.md +0 -0
- {stata_cli-0.5.1 → stata_cli-0.5.2}/src/stata_cli/skills/references/variables-operators.md +0 -0
- {stata_cli-0.5.1 → stata_cli-0.5.2}/src/stata_cli/skills/references/workflow-best-practices.md +0 -0
- {stata_cli-0.5.1 → stata_cli-0.5.2}/src/stata_cli/smcl_parser.py +0 -0
- {stata_cli-0.5.1 → stata_cli-0.5.2}/src/stata_cli.egg-info/SOURCES.txt +0 -0
- {stata_cli-0.5.1 → stata_cli-0.5.2}/src/stata_cli.egg-info/dependency_links.txt +0 -0
- {stata_cli-0.5.1 → stata_cli-0.5.2}/src/stata_cli.egg-info/entry_points.txt +0 -0
- {stata_cli-0.5.1 → stata_cli-0.5.2}/src/stata_cli.egg-info/requires.txt +0 -0
- {stata_cli-0.5.1 → stata_cli-0.5.2}/src/stata_cli.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.5.2"
|
|
@@ -447,6 +447,58 @@ def skill_cmd(ctx, topic, list_topics):
|
|
|
447
447
|
click.echo(content)
|
|
448
448
|
|
|
449
449
|
|
|
450
|
+
# ── Config subcommands ──────────────────────────────────────────────────
|
|
451
|
+
|
|
452
|
+
@cli.group("config")
|
|
453
|
+
def config_cmd():
|
|
454
|
+
"""Manage stata-cli configuration (~/.stata-cli/config.json)."""
|
|
455
|
+
|
|
456
|
+
|
|
457
|
+
@config_cmd.command("set")
|
|
458
|
+
@click.argument("key")
|
|
459
|
+
@click.argument("value")
|
|
460
|
+
def config_set(key, value):
|
|
461
|
+
"""Set a configuration value.
|
|
462
|
+
|
|
463
|
+
\b
|
|
464
|
+
Examples:
|
|
465
|
+
stata-cli config set stata-path "/usr/local/stata19"
|
|
466
|
+
stata-cli config set edition se
|
|
467
|
+
"""
|
|
468
|
+
from .utils import set_config
|
|
469
|
+
set_config(key, value)
|
|
470
|
+
click.echo(f"{key} = {value}")
|
|
471
|
+
|
|
472
|
+
|
|
473
|
+
@config_cmd.command("get")
|
|
474
|
+
@click.argument("key")
|
|
475
|
+
def config_get(key):
|
|
476
|
+
"""Get a configuration value.
|
|
477
|
+
|
|
478
|
+
\b
|
|
479
|
+
Examples:
|
|
480
|
+
stata-cli config get stata-path
|
|
481
|
+
"""
|
|
482
|
+
from .utils import get_config
|
|
483
|
+
value = get_config(key)
|
|
484
|
+
if value is None:
|
|
485
|
+
click.echo(f"{key}: (not set)")
|
|
486
|
+
else:
|
|
487
|
+
click.echo(f"{key} = {value}")
|
|
488
|
+
|
|
489
|
+
|
|
490
|
+
@config_cmd.command("list")
|
|
491
|
+
def config_list():
|
|
492
|
+
"""Show all configuration values."""
|
|
493
|
+
from .utils import get_all_config
|
|
494
|
+
data = get_all_config()
|
|
495
|
+
if not data:
|
|
496
|
+
click.echo("No configuration set. Use 'stata-cli config set <key> <value>' to configure.")
|
|
497
|
+
return
|
|
498
|
+
for k, v in data.items():
|
|
499
|
+
click.echo(f"{k} = {v}")
|
|
500
|
+
|
|
501
|
+
|
|
450
502
|
# ── Daemon subcommands ───────────────────────────────────────────────────
|
|
451
503
|
|
|
452
504
|
@cli.group()
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"""Platform detection and Stata path auto-discovery."""
|
|
2
2
|
from __future__ import annotations
|
|
3
3
|
|
|
4
|
+
import json
|
|
4
5
|
import os
|
|
5
6
|
import platform
|
|
6
7
|
|
|
@@ -10,37 +11,90 @@ IS_WINDOWS = PLATFORM == "Windows"
|
|
|
10
11
|
IS_MACOS = PLATFORM == "Darwin"
|
|
11
12
|
IS_LINUX = PLATFORM == "Linux"
|
|
12
13
|
|
|
14
|
+
_CONFIG_DIR = os.path.join(os.path.expanduser("~"), ".stata-cli")
|
|
15
|
+
_CONFIG_FILE = os.path.join(_CONFIG_DIR, "config.json")
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def get_config(key: str) -> str | None:
|
|
19
|
+
"""Read a value from ~/.stata-cli/config.json."""
|
|
20
|
+
if not os.path.isfile(_CONFIG_FILE):
|
|
21
|
+
return None
|
|
22
|
+
try:
|
|
23
|
+
with open(_CONFIG_FILE, encoding="utf-8") as f:
|
|
24
|
+
data = json.load(f)
|
|
25
|
+
return data.get(key)
|
|
26
|
+
except (json.JSONDecodeError, OSError):
|
|
27
|
+
return None
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def set_config(key: str, value: str) -> None:
|
|
31
|
+
"""Write a value to ~/.stata-cli/config.json."""
|
|
32
|
+
os.makedirs(_CONFIG_DIR, exist_ok=True)
|
|
33
|
+
data = {}
|
|
34
|
+
if os.path.isfile(_CONFIG_FILE):
|
|
35
|
+
try:
|
|
36
|
+
with open(_CONFIG_FILE, encoding="utf-8") as f:
|
|
37
|
+
data = json.load(f)
|
|
38
|
+
except (json.JSONDecodeError, OSError):
|
|
39
|
+
pass
|
|
40
|
+
data[key] = value
|
|
41
|
+
with open(_CONFIG_FILE, "w", encoding="utf-8") as f:
|
|
42
|
+
json.dump(data, f, indent=2, ensure_ascii=False)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def get_all_config() -> dict:
|
|
46
|
+
"""Read all config values."""
|
|
47
|
+
if not os.path.isfile(_CONFIG_FILE):
|
|
48
|
+
return {}
|
|
49
|
+
try:
|
|
50
|
+
with open(_CONFIG_FILE, encoding="utf-8") as f:
|
|
51
|
+
return json.load(f)
|
|
52
|
+
except (json.JSONDecodeError, OSError):
|
|
53
|
+
return {}
|
|
54
|
+
|
|
13
55
|
|
|
14
56
|
def detect_stata_path() -> str | None:
|
|
15
57
|
"""Auto-detect the Stata installation directory.
|
|
16
58
|
|
|
17
59
|
Checks, in order:
|
|
18
60
|
1. STATA_PATH environment variable
|
|
19
|
-
2.
|
|
61
|
+
2. ~/.stata-cli/config.json (user-configured path)
|
|
62
|
+
3. Platform-specific default locations
|
|
20
63
|
"""
|
|
21
64
|
env_path = os.environ.get("STATA_PATH")
|
|
22
65
|
if env_path and os.path.exists(env_path):
|
|
23
66
|
return env_path
|
|
24
67
|
|
|
68
|
+
config_path = get_config("stata-path")
|
|
69
|
+
if config_path and os.path.exists(config_path):
|
|
70
|
+
return config_path
|
|
71
|
+
|
|
25
72
|
if IS_MACOS:
|
|
26
73
|
for candidate in [
|
|
27
74
|
"/Applications/Stata",
|
|
28
75
|
"/Applications/StataNow",
|
|
29
|
-
"/Applications/Stata18",
|
|
30
|
-
"/Applications/Stata17",
|
|
31
76
|
]:
|
|
32
77
|
if os.path.exists(candidate):
|
|
33
78
|
return candidate
|
|
34
79
|
|
|
35
80
|
elif IS_WINDOWS:
|
|
36
|
-
for version in ["18", "17", "16"]:
|
|
37
|
-
for prefix in [
|
|
81
|
+
for version in ["19", "18", "17", "16"]:
|
|
82
|
+
for prefix in [
|
|
83
|
+
r"C:\Program Files\Stata",
|
|
84
|
+
r"C:\Program Files\StataNow",
|
|
85
|
+
]:
|
|
38
86
|
candidate = prefix + version
|
|
39
87
|
if os.path.exists(candidate):
|
|
40
88
|
return candidate
|
|
41
89
|
|
|
42
90
|
elif IS_LINUX:
|
|
43
|
-
for candidate in [
|
|
91
|
+
for candidate in [
|
|
92
|
+
"/usr/local/stata19",
|
|
93
|
+
"/usr/local/statanow19",
|
|
94
|
+
"/usr/local/stata18",
|
|
95
|
+
"/usr/local/stata17",
|
|
96
|
+
"/usr/local/stata",
|
|
97
|
+
]:
|
|
44
98
|
if os.path.exists(candidate):
|
|
45
99
|
return candidate
|
|
46
100
|
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.5.1"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{stata_cli-0.5.1 → stata_cli-0.5.2}/src/stata_cli/skills/references/basics-getting-started.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{stata_cli-0.5.1 → stata_cli-0.5.2}/src/stata_cli/skills/references/descriptive-statistics.md
RENAMED
|
File without changes
|
{stata_cli-0.5.1 → stata_cli-0.5.2}/src/stata_cli/skills/references/difference-in-differences.md
RENAMED
|
File without changes
|
{stata_cli-0.5.1 → stata_cli-0.5.2}/src/stata_cli/skills/references/external-tools-integration.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{stata_cli-0.5.1 → stata_cli-0.5.2}/src/stata_cli/skills/references/limited-dependent-variables.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{stata_cli-0.5.1 → stata_cli-0.5.2}/src/stata_cli/skills/references/mata-matrix-operations.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{stata_cli-0.5.1 → stata_cli-0.5.2}/src/stata_cli/skills/references/mathematical-functions.md
RENAMED
|
File without changes
|
|
File without changes
|
{stata_cli-0.5.1 → stata_cli-0.5.2}/src/stata_cli/skills/references/missing-data-handling.md
RENAMED
|
File without changes
|
{stata_cli-0.5.1 → stata_cli-0.5.2}/src/stata_cli/skills/references/nonparametric-methods.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{stata_cli-0.5.1 → stata_cli-0.5.2}/src/stata_cli/skills/references/regression-discontinuity.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{stata_cli-0.5.1 → stata_cli-0.5.2}/src/stata_cli/skills/references/workflow-best-practices.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|