python-infrakit-dev 0.1.0__tar.gz → 0.1.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.
- {python_infrakit_dev-0.1.0 → python_infrakit_dev-0.1.2}/.gitignore +1 -1
- {python_infrakit_dev-0.1.0 → python_infrakit_dev-0.1.2}/PKG-INFO +1 -1
- python_infrakit_dev-0.1.2/infrakit/cli/commands/config.py +149 -0
- {python_infrakit_dev-0.1.0 → python_infrakit_dev-0.1.2}/infrakit/scaffolder/ai.py +1 -0
- {python_infrakit_dev-0.1.0 → python_infrakit_dev-0.1.2}/pyproject.toml +1 -1
- {python_infrakit_dev-0.1.0 → python_infrakit_dev-0.1.2}/.python-version +0 -0
- {python_infrakit_dev-0.1.0 → python_infrakit_dev-0.1.2}/README.md +0 -0
- {python_infrakit_dev-0.1.0 → python_infrakit_dev-0.1.2}/infrakit/__init__.py +0 -0
- {python_infrakit_dev-0.1.0 → python_infrakit_dev-0.1.2}/infrakit/cli/__init__.py +0 -0
- {python_infrakit_dev-0.1.0 → python_infrakit_dev-0.1.2}/infrakit/cli/commands/__init__.py +0 -0
- {python_infrakit_dev-0.1.0 → python_infrakit_dev-0.1.2}/infrakit/cli/commands/deps.py +0 -0
- {python_infrakit_dev-0.1.0 → python_infrakit_dev-0.1.2}/infrakit/cli/commands/init.py +0 -0
- {python_infrakit_dev-0.1.0 → python_infrakit_dev-0.1.2}/infrakit/cli/commands/llm.py +0 -0
- {python_infrakit_dev-0.1.0 → python_infrakit_dev-0.1.2}/infrakit/cli/commands/logger.py +0 -0
- {python_infrakit_dev-0.1.0 → python_infrakit_dev-0.1.2}/infrakit/cli/commands/module.py +0 -0
- {python_infrakit_dev-0.1.0 → python_infrakit_dev-0.1.2}/infrakit/cli/commands/time.py +0 -0
- {python_infrakit_dev-0.1.0 → python_infrakit_dev-0.1.2}/infrakit/cli/main.py +0 -0
- {python_infrakit_dev-0.1.0 → python_infrakit_dev-0.1.2}/infrakit/core/__init__.py +0 -0
- {python_infrakit_dev-0.1.0 → python_infrakit_dev-0.1.2}/infrakit/core/config/__init__.py +0 -0
- {python_infrakit_dev-0.1.0 → python_infrakit_dev-0.1.2}/infrakit/core/config/converter.py +0 -0
- {python_infrakit_dev-0.1.0 → python_infrakit_dev-0.1.2}/infrakit/core/config/exporter.py +0 -0
- {python_infrakit_dev-0.1.0 → python_infrakit_dev-0.1.2}/infrakit/core/config/loader.py +0 -0
- {python_infrakit_dev-0.1.0 → python_infrakit_dev-0.1.2}/infrakit/core/config/validator.py +0 -0
- {python_infrakit_dev-0.1.0 → python_infrakit_dev-0.1.2}/infrakit/core/logger/__init__.py +0 -0
- {python_infrakit_dev-0.1.0 → python_infrakit_dev-0.1.2}/infrakit/core/logger/formatters.py +0 -0
- {python_infrakit_dev-0.1.0 → python_infrakit_dev-0.1.2}/infrakit/core/logger/handlers.py +0 -0
- {python_infrakit_dev-0.1.0 → python_infrakit_dev-0.1.2}/infrakit/core/logger/retention.py +0 -0
- {python_infrakit_dev-0.1.0 → python_infrakit_dev-0.1.2}/infrakit/core/logger/setup.py +0 -0
- {python_infrakit_dev-0.1.0 → python_infrakit_dev-0.1.2}/infrakit/deps/__init__.py +0 -0
- {python_infrakit_dev-0.1.0 → python_infrakit_dev-0.1.2}/infrakit/deps/clean.py +0 -0
- {python_infrakit_dev-0.1.0 → python_infrakit_dev-0.1.2}/infrakit/deps/depfile.py +0 -0
- {python_infrakit_dev-0.1.0 → python_infrakit_dev-0.1.2}/infrakit/deps/health.py +0 -0
- {python_infrakit_dev-0.1.0 → python_infrakit_dev-0.1.2}/infrakit/deps/optimizer.py +0 -0
- {python_infrakit_dev-0.1.0 → python_infrakit_dev-0.1.2}/infrakit/deps/scanner.py +0 -0
- {python_infrakit_dev-0.1.0 → python_infrakit_dev-0.1.2}/infrakit/llm/__init__.py +0 -0
- {python_infrakit_dev-0.1.0 → python_infrakit_dev-0.1.2}/infrakit/llm/batch.py +0 -0
- {python_infrakit_dev-0.1.0 → python_infrakit_dev-0.1.2}/infrakit/llm/client.py +0 -0
- {python_infrakit_dev-0.1.0 → python_infrakit_dev-0.1.2}/infrakit/llm/key_manager.py +0 -0
- {python_infrakit_dev-0.1.0 → python_infrakit_dev-0.1.2}/infrakit/llm/llm_readme.md +0 -0
- {python_infrakit_dev-0.1.0 → python_infrakit_dev-0.1.2}/infrakit/llm/models.py +0 -0
- {python_infrakit_dev-0.1.0 → python_infrakit_dev-0.1.2}/infrakit/llm/providers/__init__.py +0 -0
- {python_infrakit_dev-0.1.0 → python_infrakit_dev-0.1.2}/infrakit/llm/providers/base.py +0 -0
- {python_infrakit_dev-0.1.0 → python_infrakit_dev-0.1.2}/infrakit/llm/providers/gemini.py +0 -0
- {python_infrakit_dev-0.1.0 → python_infrakit_dev-0.1.2}/infrakit/llm/providers/openai.py +0 -0
- {python_infrakit_dev-0.1.0 → python_infrakit_dev-0.1.2}/infrakit/llm/rate_limiter.py +0 -0
- {python_infrakit_dev-0.1.0 → python_infrakit_dev-0.1.2}/infrakit/scaffolder/__init__.py +0 -0
- {python_infrakit_dev-0.1.0 → python_infrakit_dev-0.1.2}/infrakit/scaffolder/backend.py +0 -0
- {python_infrakit_dev-0.1.0 → python_infrakit_dev-0.1.2}/infrakit/scaffolder/cli_tool.py +0 -0
- {python_infrakit_dev-0.1.0 → python_infrakit_dev-0.1.2}/infrakit/scaffolder/generator.py +0 -0
- {python_infrakit_dev-0.1.0 → python_infrakit_dev-0.1.2}/infrakit/scaffolder/pipeline.py +0 -0
- {python_infrakit_dev-0.1.0 → python_infrakit_dev-0.1.2}/infrakit/scaffolder/registry.py +0 -0
- {python_infrakit_dev-0.1.0 → python_infrakit_dev-0.1.2}/infrakit/time/__init__.py +0 -0
- {python_infrakit_dev-0.1.0 → python_infrakit_dev-0.1.2}/infrakit/time/profiler.py +0 -0
- {python_infrakit_dev-0.1.0 → python_infrakit_dev-0.1.2}/tests/__init__.py +0 -0
- {python_infrakit_dev-0.1.0 → python_infrakit_dev-0.1.2}/tests/cli/__init__.py +0 -0
- {python_infrakit_dev-0.1.0 → python_infrakit_dev-0.1.2}/tests/cli/conftest.py +0 -0
- {python_infrakit_dev-0.1.0 → python_infrakit_dev-0.1.2}/tests/cli/test_config.py +0 -0
- {python_infrakit_dev-0.1.0 → python_infrakit_dev-0.1.2}/tests/cli/test_init.py +0 -0
- {python_infrakit_dev-0.1.0 → python_infrakit_dev-0.1.2}/tests/cli/test_logger.py +0 -0
- {python_infrakit_dev-0.1.0 → python_infrakit_dev-0.1.2}/tests/cli/test_module.py +0 -0
- {python_infrakit_dev-0.1.0 → python_infrakit_dev-0.1.2}/tests/core/__init__.py +0 -0
- {python_infrakit_dev-0.1.0 → python_infrakit_dev-0.1.2}/tests/core/config/__init__.py +0 -0
- {python_infrakit_dev-0.1.0 → python_infrakit_dev-0.1.2}/tests/core/config/test_converter.py +0 -0
- {python_infrakit_dev-0.1.0 → python_infrakit_dev-0.1.2}/tests/core/config/test_exporter.py +0 -0
- {python_infrakit_dev-0.1.0 → python_infrakit_dev-0.1.2}/tests/core/config/test_loader.py +0 -0
- {python_infrakit_dev-0.1.0 → python_infrakit_dev-0.1.2}/tests/core/config/test_validator.py +0 -0
- {python_infrakit_dev-0.1.0 → python_infrakit_dev-0.1.2}/tests/core/logger/__init__.py +0 -0
- {python_infrakit_dev-0.1.0 → python_infrakit_dev-0.1.2}/tests/core/logger/test_formatters.py +0 -0
- {python_infrakit_dev-0.1.0 → python_infrakit_dev-0.1.2}/tests/core/logger/test_handler.py +0 -0
- {python_infrakit_dev-0.1.0 → python_infrakit_dev-0.1.2}/tests/core/logger/test_retention.py +0 -0
- {python_infrakit_dev-0.1.0 → python_infrakit_dev-0.1.2}/tests/core/logger/test_setup.py +0 -0
- {python_infrakit_dev-0.1.0 → python_infrakit_dev-0.1.2}/tests/test_llm.py +0 -0
- {python_infrakit_dev-0.1.0 → python_infrakit_dev-0.1.2}/tests/test_time.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-infrakit-dev
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.2
|
|
4
4
|
Summary: A comprehensive Python developer infrastructure toolkit
|
|
5
5
|
Project-URL: Homepage, https://github.com/chiragg21/infrakit
|
|
6
6
|
Project-URL: Repository, https://github.com/chiragg21/infrakit
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
"""
|
|
2
|
+
infrakit.cli.commands.config
|
|
3
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
4
|
+
``infrakit config`` subcommand group.
|
|
5
|
+
|
|
6
|
+
Commands
|
|
7
|
+
--------
|
|
8
|
+
infrakit config convert <src> <target> [--overwrite] [--quiet]
|
|
9
|
+
infrakit config export <src> [target] --format FORMAT [--overwrite]
|
|
10
|
+
target is optional — omit to print to stdout
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
from __future__ import annotations
|
|
14
|
+
|
|
15
|
+
import warnings
|
|
16
|
+
from pathlib import Path
|
|
17
|
+
from typing import Optional
|
|
18
|
+
|
|
19
|
+
import typer
|
|
20
|
+
|
|
21
|
+
from infrakit.core.config.converter import convert_file, ConversionWarning
|
|
22
|
+
from infrakit.core.config.exporter import export_file, export_dict
|
|
23
|
+
from infrakit.core.config.loader import load
|
|
24
|
+
|
|
25
|
+
config_app = typer.Typer(
|
|
26
|
+
name="config",
|
|
27
|
+
help="Convert and export configuration files.",
|
|
28
|
+
no_args_is_help=True,
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
# ── helpers ───────────────────────────────────────────────────────────────────
|
|
32
|
+
|
|
33
|
+
def _abort(msg: str) -> None:
|
|
34
|
+
typer.echo(typer.style(f"✗ {msg}", fg=typer.colors.RED), err=True)
|
|
35
|
+
raise typer.Exit(1)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def _ok(msg: str) -> None:
|
|
39
|
+
typer.echo(typer.style(f"✓ {msg}", fg=typer.colors.GREEN))
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def _info(msg: str) -> None:
|
|
43
|
+
typer.echo(typer.style(f" {msg}", fg=typer.colors.BRIGHT_BLACK))
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def _warn(msg: str) -> None:
|
|
47
|
+
typer.echo(typer.style(f"⚠ {msg}", fg=typer.colors.YELLOW), err=True)
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
# ── infrakit config convert ───────────────────────────────────────────────────
|
|
51
|
+
|
|
52
|
+
@config_app.command("convert")
|
|
53
|
+
def cmd_convert(
|
|
54
|
+
src: Path = typer.Argument(..., help="Source config file."),
|
|
55
|
+
target: Path = typer.Argument(..., help="Target config file (format inferred from extension)."),
|
|
56
|
+
overwrite: bool = typer.Option(False, "--overwrite", "-y", help="Overwrite target if it already exists."),
|
|
57
|
+
quiet: bool = typer.Option(False, "--quiet", "-q", help="Suppress lossy-conversion warnings."),
|
|
58
|
+
) -> None:
|
|
59
|
+
"""
|
|
60
|
+
Convert a config file from one format to another.
|
|
61
|
+
|
|
62
|
+
Format is inferred from the file extension.
|
|
63
|
+
Supported: json, yaml, ini, env.
|
|
64
|
+
|
|
65
|
+
\b
|
|
66
|
+
Examples
|
|
67
|
+
--------
|
|
68
|
+
ik config convert config.yaml config.json
|
|
69
|
+
ik config convert settings.ini settings.yaml --overwrite
|
|
70
|
+
ik config convert config.json .env -y
|
|
71
|
+
"""
|
|
72
|
+
if not src.exists():
|
|
73
|
+
_abort(f"Source file not found: {src}")
|
|
74
|
+
|
|
75
|
+
if target.exists() and not overwrite:
|
|
76
|
+
_abort(f"Target already exists: {target} (pass --overwrite / -y to replace)")
|
|
77
|
+
|
|
78
|
+
caught: list = []
|
|
79
|
+
|
|
80
|
+
with warnings.catch_warnings(record=True) as w:
|
|
81
|
+
warnings.simplefilter("always", ConversionWarning)
|
|
82
|
+
try:
|
|
83
|
+
convert_file(src, target, overwrite=overwrite)
|
|
84
|
+
except Exception as exc: # noqa: BLE001
|
|
85
|
+
_abort(f"Conversion failed: {exc}")
|
|
86
|
+
caught = [x.message for x in w if issubclass(x.category, ConversionWarning)]
|
|
87
|
+
|
|
88
|
+
if caught and not quiet:
|
|
89
|
+
for cw in caught:
|
|
90
|
+
_warn(f"Lossy conversion — key '{cw.key}': {cw.reason}") # type: ignore[attr-defined]
|
|
91
|
+
|
|
92
|
+
_ok(f"Converted {src} → {target}")
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
# ── infrakit config export ────────────────────────────────────────────────────
|
|
96
|
+
|
|
97
|
+
_VALID_FORMATS = {"json", "yaml", "ini", "env"}
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
@config_app.command("export")
|
|
101
|
+
def cmd_export(
|
|
102
|
+
src: Path = typer.Argument(..., help="Source config file to sanitize."),
|
|
103
|
+
target: Optional[Path] = typer.Argument(None, help="Output file. Omit to print the template to stdout."),
|
|
104
|
+
fmt: str = typer.Option("json", "--format", "-f", help="Output format: json | yaml | ini | env."),
|
|
105
|
+
overwrite: bool = typer.Option(False, "--overwrite", "-y", help="Overwrite target if it already exists. Ignored when printing to stdout."),
|
|
106
|
+
) -> None:
|
|
107
|
+
"""
|
|
108
|
+
Export a sanitized config template — all values become YOUR_VALUE_HERE.
|
|
109
|
+
|
|
110
|
+
When no target file is given the template is printed to stdout, which is
|
|
111
|
+
useful for quick inspection or piping into another tool.
|
|
112
|
+
|
|
113
|
+
\b
|
|
114
|
+
Examples
|
|
115
|
+
--------
|
|
116
|
+
ik config export .env -f env # print to terminal
|
|
117
|
+
ik config export .env template.env -f env # write to file
|
|
118
|
+
ik config export config.yaml config.template.yaml -f yaml
|
|
119
|
+
ik config export secrets.json safe.json -f json -y
|
|
120
|
+
"""
|
|
121
|
+
if not src.exists():
|
|
122
|
+
_abort(f"Source file not found: {src}")
|
|
123
|
+
|
|
124
|
+
if fmt not in _VALID_FORMATS:
|
|
125
|
+
_abort(f"Unknown format '{fmt}'. Choose from: {', '.join(sorted(_VALID_FORMATS))}")
|
|
126
|
+
|
|
127
|
+
# ── stdout mode ───────────────────────────────────────────────────────────
|
|
128
|
+
if target is None:
|
|
129
|
+
try:
|
|
130
|
+
data = load(src, cast_values=False)
|
|
131
|
+
output = export_dict(data, to_format=fmt)
|
|
132
|
+
except Exception as exc: # noqa: BLE001
|
|
133
|
+
_abort(f"Export failed: {exc}")
|
|
134
|
+
return
|
|
135
|
+
typer.echo(output)
|
|
136
|
+
return
|
|
137
|
+
|
|
138
|
+
# ── file mode ─────────────────────────────────────────────────────────────
|
|
139
|
+
if target.exists() and not overwrite:
|
|
140
|
+
_abort(f"Target already exists: {target} (pass --overwrite / -y to replace)")
|
|
141
|
+
|
|
142
|
+
try:
|
|
143
|
+
export_file(src, target, to_format=fmt, overwrite=overwrite)
|
|
144
|
+
except Exception as exc: # noqa: BLE001
|
|
145
|
+
_abort(f"Export failed: {exc}")
|
|
146
|
+
return
|
|
147
|
+
|
|
148
|
+
_ok(f"Exported sanitized template {src} → {target} (format: {fmt})")
|
|
149
|
+
_info("All values have been replaced with YOUR_VALUE_HERE.")
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
{python_infrakit_dev-0.1.0 → python_infrakit_dev-0.1.2}/tests/core/logger/test_formatters.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|