python-infrakit-dev 0.1.4__py3-none-any.whl → 0.1.5__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.
infrakit/__init__.py CHANGED
@@ -0,0 +1,74 @@
1
+ """
2
+ infrakit
3
+ ~~~~~~~~
4
+ A comprehensive Python developer infrastructure toolkit.
5
+
6
+ Quick imports::
7
+
8
+ # Logging
9
+ from infrakit import setup, get_logger
10
+
11
+ # Config
12
+ from infrakit import load, validate
13
+
14
+ # LLM
15
+ from infrakit import LLMClient
16
+
17
+ # Dependencies
18
+ from infrakit import deps
19
+
20
+ # Scaffolding
21
+ from infrakit import scaffolder
22
+
23
+ # Profiling
24
+ from infrakit import time
25
+ """
26
+
27
+ from infrakit.core.logger.setup import setup, get_logger, reset
28
+ from infrakit.core.config import (
29
+ load,
30
+ load_env,
31
+ validate,
32
+ Schema,
33
+ field,
34
+ convert_file,
35
+ convert_dict,
36
+ export_file,
37
+ export_dict,
38
+ export_string,
39
+ )
40
+ from infrakit import deps, scaffolder, time
41
+
42
+ try:
43
+ from infrakit.llm import LLMClient, LLMResponse, Prompt, QuotaConfig
44
+ _LLM_AVAILABLE = True
45
+ except ImportError:
46
+ _LLM_AVAILABLE = False
47
+
48
+ __version__ = "0.1.4"
49
+
50
+ __all__ = [
51
+ "__version__",
52
+ # logging
53
+ "setup",
54
+ "get_logger",
55
+ "reset",
56
+ # config
57
+ "load",
58
+ "load_env",
59
+ "validate",
60
+ "Schema",
61
+ "field",
62
+ "convert_file",
63
+ "convert_dict",
64
+ "export_file",
65
+ "export_dict",
66
+ "export_string",
67
+ # subpackages
68
+ "deps",
69
+ "scaffolder",
70
+ "time",
71
+ ]
72
+
73
+ if _LLM_AVAILABLE:
74
+ __all__ += ["LLMClient", "LLMResponse", "Prompt", "QuotaConfig"]
infrakit/cli/__init__.py CHANGED
@@ -1 +1,5 @@
1
- """infrakit.cli — command-line interface for infrakit."""
1
+ """infrakit.cli — command-line interface for infrakit."""
2
+
3
+ from infrakit.cli.main import main
4
+
5
+ __all__ = ["main"]
@@ -1 +1,19 @@
1
- """infrakit.cli.commands — subcommand groups."""
1
+ """infrakit.cli.commands — subcommand groups."""
2
+
3
+ from infrakit.cli.commands.config import config_app
4
+ from infrakit.cli.commands.logger import logger_app
5
+ from infrakit.cli.commands.module import module_app
6
+ from infrakit.cli.commands.time import time_app
7
+ from infrakit.cli.commands.deps import deps_app
8
+ from infrakit.cli.commands.llm import app as llm_app
9
+ from infrakit.cli.commands.init import cmd_init
10
+
11
+ __all__ = [
12
+ "config_app",
13
+ "logger_app",
14
+ "module_app",
15
+ "time_app",
16
+ "deps_app",
17
+ "llm_app",
18
+ "cmd_init",
19
+ ]
infrakit/core/__init__.py CHANGED
@@ -0,0 +1,46 @@
1
+ """
2
+ infrakit.core
3
+ ~~~~~~~~~~~~~
4
+ Core infrastructure: config management and structured logging.
5
+
6
+ Quick imports::
7
+
8
+ from infrakit.core import setup, get_logger
9
+ from infrakit.core import load, validate
10
+ """
11
+
12
+ from infrakit.core.logger.setup import setup, get_logger, reset
13
+ from infrakit.core.config import (
14
+ load,
15
+ load_env,
16
+ cast_value,
17
+ detect_format,
18
+ validate,
19
+ Schema,
20
+ field,
21
+ convert_file,
22
+ convert_dict,
23
+ export_file,
24
+ export_dict,
25
+ export_string,
26
+ )
27
+
28
+ __all__ = [
29
+ # logger
30
+ "setup",
31
+ "get_logger",
32
+ "reset",
33
+ # config
34
+ "load",
35
+ "load_env",
36
+ "cast_value",
37
+ "detect_format",
38
+ "validate",
39
+ "Schema",
40
+ "field",
41
+ "convert_file",
42
+ "convert_dict",
43
+ "export_file",
44
+ "export_dict",
45
+ "export_string",
46
+ ]
@@ -0,0 +1,71 @@
1
+ """
2
+ infrakit.core.config
3
+ ~~~~~~~~~~~~~~~~~~~~~
4
+ Configuration loading, validation, conversion, and export.
5
+
6
+ Quick imports::
7
+
8
+ from infrakit.core.config import load, load_env, validate, Schema, field
9
+ from infrakit.core.config import convert_file, convert_dict
10
+ from infrakit.core.config import export_file, export_dict, export_string
11
+ """
12
+
13
+ from infrakit.core.config.loader import (
14
+ load,
15
+ load_env,
16
+ cast_value,
17
+ cast_dict,
18
+ detect_format,
19
+ ConfigLoadError,
20
+ UnsupportedFormatError,
21
+ MissingDependencyError,
22
+ )
23
+ from infrakit.core.config.validator import (
24
+ validate,
25
+ Schema,
26
+ field,
27
+ FieldSpec,
28
+ FieldError,
29
+ ValidationResult,
30
+ ConfigValidationError,
31
+ )
32
+ from infrakit.core.config.converter import (
33
+ convert_file,
34
+ convert_dict,
35
+ ConversionError,
36
+ ConversionWarning,
37
+ )
38
+ from infrakit.core.config.exporter import (
39
+ export_file,
40
+ export_dict,
41
+ export_string,
42
+ )
43
+
44
+ __all__ = [
45
+ # loader
46
+ "load",
47
+ "load_env",
48
+ "cast_value",
49
+ "cast_dict",
50
+ "detect_format",
51
+ "ConfigLoadError",
52
+ "UnsupportedFormatError",
53
+ "MissingDependencyError",
54
+ # validator
55
+ "validate",
56
+ "Schema",
57
+ "field",
58
+ "FieldSpec",
59
+ "FieldError",
60
+ "ValidationResult",
61
+ "ConfigValidationError",
62
+ # converter
63
+ "convert_file",
64
+ "convert_dict",
65
+ "ConversionError",
66
+ "ConversionWarning",
67
+ # exporter
68
+ "export_file",
69
+ "export_dict",
70
+ "export_string",
71
+ ]
@@ -1,29 +1,88 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-infrakit-dev
3
- Version: 0.1.4
3
+ Version: 0.1.5
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
7
- Requires-Python: >=3.13
8
- Requires-Dist: google-genai>=1.69.0
7
+ Requires-Python: >=3.10
9
8
  Requires-Dist: isort>=8.0.1
10
- Requires-Dist: openai>=2.30.0
11
9
  Requires-Dist: pydantic>=2.12.5
12
10
  Requires-Dist: python-dotenv>=1.2.2
13
11
  Requires-Dist: pyyaml>=6.0.3
14
- Requires-Dist: tqdm>=4.67.3
15
12
  Requires-Dist: typer>=0.24.1
13
+ Provides-Extra: all
14
+ Requires-Dist: google-genai>=1.69.0; extra == 'all'
15
+ Requires-Dist: openai>=2.30.0; extra == 'all'
16
+ Requires-Dist: tqdm>=4.67.3; extra == 'all'
17
+ Provides-Extra: llm
18
+ Requires-Dist: google-genai>=1.69.0; extra == 'llm'
19
+ Requires-Dist: openai>=2.30.0; extra == 'llm'
20
+ Requires-Dist: tqdm>=4.67.3; extra == 'llm'
16
21
  Description-Content-Type: text/markdown
17
22
 
18
23
  # Infrakit
19
24
 
20
25
  A modular developer toolkit for Python — project scaffolding, logging, config loading, a multi-provider LLM client, and dependency utilities.
21
26
 
27
+ **Requires Python 3.10+**
28
+
29
+ ---
30
+
31
+ ## Installation
32
+
33
+ **Core** — scaffolding, config, logging, deps, profiling, and CLI:
34
+
35
+ ```bash
36
+ pip install python-infrakit-dev
37
+ ```
38
+
39
+ **With LLM support** — adds OpenAI and Gemini providers:
40
+
41
+ ```bash
42
+ pip install python-infrakit-dev[llm]
43
+ ```
44
+
45
+ **Everything:**
46
+
22
47
  ```bash
23
- pip install infrakit
48
+ pip install python-infrakit-dev[all]
49
+ ```
50
+
51
+ The CLI is available as both `infrakit` and `ik`.
52
+
53
+ ---
54
+
55
+ ## Quick Imports
56
+
57
+ Most public symbols are available directly from the top-level package:
58
+
59
+ ```python
60
+ # Logging
61
+ from infrakit import setup, get_logger
62
+
63
+ # Config
64
+ from infrakit import load, load_env, validate, Schema, field
65
+
66
+ # Config conversion / export
67
+ from infrakit import convert_file, convert_dict, export_file, export_dict
68
+
69
+ # LLM (requires infrakit[llm])
70
+ from infrakit import LLMClient, Prompt, QuotaConfig
71
+
72
+ # Subpackages
73
+ from infrakit import deps, scaffolder, time
24
74
  ```
25
75
 
26
- The CLI is available as `ik`.
76
+ Or import from the specific subpackages:
77
+
78
+ ```python
79
+ from infrakit.core.config import load, validate, convert_dict, export_file
80
+ from infrakit.core.logger import setup, get_logger
81
+ from infrakit.llm import LLMClient, Prompt
82
+ from infrakit.deps import scan, export, check, clean, optimise
83
+ from infrakit.scaffolder import scaffold_basic, scaffold_ai, scaffold_backend
84
+ from infrakit.time import pipeline_profiler, track
85
+ ```
27
86
 
28
87
  ---
29
88
 
@@ -60,7 +119,7 @@ Every template generates a config file pre-populated with the variables its util
60
119
  ### Config loader
61
120
 
62
121
  ```python
63
- from infrakit.core.config.loader import load, load_env
122
+ from infrakit.core.config import load, load_env
64
123
 
65
124
  cfg = load_env(".env", cast_values=True) # "true" → bool, "42" → int
66
125
  cfg = load("config.yaml")
@@ -84,6 +143,49 @@ port = cfg.get("APP_PORT", 8000)
84
143
 
85
144
  ---
86
145
 
146
+ ### Config validation
147
+
148
+ ```python
149
+ from infrakit.core.config import validate, Schema, field
150
+ from pydantic import BaseModel
151
+
152
+ # Pydantic model
153
+ class AppConfig(BaseModel):
154
+ host: str
155
+ port: int
156
+ debug: bool = False
157
+
158
+ result = validate({"host": "localhost", "port": 8080}, AppConfig)
159
+ if result.ok:
160
+ cfg = result.data # fully typed AppConfig instance
161
+
162
+ # Lightweight dict schema (no Pydantic model needed)
163
+ schema = Schema({
164
+ "host": field(str, required=True),
165
+ "port": field(int, required=True),
166
+ "debug": field(bool, required=False, default=False),
167
+ })
168
+ result = schema.validate({"host": "localhost", "port": 8080})
169
+ ```
170
+
171
+ ---
172
+
173
+ ### Config conversion and export
174
+
175
+ ```python
176
+ from infrakit.core.config import convert_file, convert_dict, export_file, export_dict
177
+
178
+ # Convert between formats
179
+ convert_file("config.yaml", "config.ini")
180
+ output, warnings = convert_dict(data, from_format="yaml", to_format="env")
181
+
182
+ # Sanitize config for sharing (replaces all values with YOUR_VALUE_HERE)
183
+ export_file("config.yaml", ".env.example", to_format="env")
184
+ safe = export_dict({"PORT": 8080, "SECRET": "abc"}, to_format="env")
185
+ ```
186
+
187
+ ---
188
+
87
189
  ### Logger
88
190
 
89
191
  ```python
@@ -116,6 +218,8 @@ log.info("started on port %d", 8080)
116
218
 
117
219
  ## LLM Client
118
220
 
221
+ > Requires `pip install python-infrakit-dev[llm]`
222
+
119
223
  A unified client for **OpenAI** and **Gemini** with key rotation, rate limiting, quota tracking, and async/batch generation.
120
224
 
121
225
  ```python
@@ -1,7 +1,7 @@
1
- infrakit/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- infrakit/cli/__init__.py,sha256=QZrDqdIn-8fH3wFO0YY-1K05g5PbF6q8-6BlTQcdC8Y,59
1
+ infrakit/__init__.py,sha256=wh0Fo7g1X8CS70ijR-U3k_MFqENiaDqhwJ5HxORaeXE,1305
2
+ infrakit/cli/__init__.py,sha256=Dn4nTZzNDgU1VaMaZ883OjeyemUsVqvzLkY6Xv1IB-8,116
3
3
  infrakit/cli/main.py,sha256=FDKAEMmtpujhGFz2mGGBchz9uas6VYMVdPsgTmZCnKE,1767
4
- infrakit/cli/commands/__init__.py,sha256=9UDid2MU1YFe48lm3zom-SYxMya5DhiRmM9-pqldT5o,50
4
+ infrakit/cli/commands/__init__.py,sha256=v4FDWyO1-RZ6P0xl5Bhxzgar8REqpMnm__47UkBDKEo,537
5
5
  infrakit/cli/commands/config.py,sha256=TsEdKUyLbX7n7uo_Nj9pdkgejQ8KxQ7mcV7Hed7gMEE,5975
6
6
  infrakit/cli/commands/deps.py,sha256=JAYg7dLCVw9UKNInzUeB-RnXr7Uv_dFs1B41plGRVIo,21650
7
7
  infrakit/cli/commands/init.py,sha256=MQGr4kvKwezme2UditokVK8tbENjhtM2yBKgv8s2Ffw,5255
@@ -9,8 +9,8 @@ infrakit/cli/commands/llm.py,sha256=OSsGrUCHAU0Gi4YGFWyO42zlYz7PfQTZuQG0JeKFzOA,
9
9
  infrakit/cli/commands/logger.py,sha256=-OPvCg0x6j7LQ0XJBHQcFkzlG8dkKNCBmEzKNOvAyeA,6148
10
10
  infrakit/cli/commands/module.py,sha256=jsnEQxwBztKWxIj85tqmVpoMYQmYfYXFwzncOjH2xZo,11295
11
11
  infrakit/cli/commands/time.py,sha256=1Q1sFeqRP4GCFqcCxC0BcUDOdB6NjTSPJI_-hrS8DbI,2229
12
- infrakit/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
- infrakit/core/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
+ infrakit/core/__init__.py,sha256=tTt7zxcWJjXbeflKgGA71aGxFnA_q4gbTvm5fqUvAnc,791
13
+ infrakit/core/config/__init__.py,sha256=9QXqdrCkoKC0bSaBARLyxyhfoD8kLLOU-2H-l-HeQPs,1452
14
14
  infrakit/core/config/converter.py,sha256=5BEr6SWU_QGtCuukO0BBRbTJyT8S0T5tMVHEtbpolMY,15450
15
15
  infrakit/core/config/exporter.py,sha256=ffuEUzUAiWNq2_xQIarXhCNAL-Y_Mt7WDeFIcldogFM,9121
16
16
  infrakit/core/config/loader.py,sha256=gfd1HXVZD8AJAVeXy9QeTeB8M0YOggXh5N0E4CJEt84,23994
@@ -46,7 +46,7 @@ infrakit/scaffolder/pipeline.py,sha256=HeBkreiso0fYIHrObkaPKRB3XewU3UgQevrrcWHY_
46
46
  infrakit/scaffolder/registry.py,sha256=TqZetmDChmXD_oW6kl10A0SbN6ADm4xi7NdK2m9GNGI,3802
47
47
  infrakit/time/__init__.py,sha256=R-o_F3XkqaC-QWtfMJ8TCUKnCqLycFl2WQHs20e8ElI,1206
48
48
  infrakit/time/profiler.py,sha256=bfM-UCFULr1cA4Y6fgBWdQ7d4tNgdY_YJowohhVH-So,16075
49
- python_infrakit_dev-0.1.4.dist-info/METADATA,sha256=RdoayVeTCtHJmwJImyLOXnq3ITFLQb85_DMznw2Srnw,11484
50
- python_infrakit_dev-0.1.4.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
51
- python_infrakit_dev-0.1.4.dist-info/entry_points.txt,sha256=9uBSvx5accKf026gAQijwUkkN_eL37RBWlCO3e_9Iz4,80
52
- python_infrakit_dev-0.1.4.dist-info/RECORD,,
49
+ python_infrakit_dev-0.1.5.dist-info/METADATA,sha256=3VPCCyEalSsmH_jIhhJjyjXEywPSkl7geuxCKyDKUnA,14106
50
+ python_infrakit_dev-0.1.5.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
51
+ python_infrakit_dev-0.1.5.dist-info/entry_points.txt,sha256=9uBSvx5accKf026gAQijwUkkN_eL37RBWlCO3e_9Iz4,80
52
+ python_infrakit_dev-0.1.5.dist-info/RECORD,,