python-infrakit-dev 0.1.0__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 (72) hide show
  1. python_infrakit_dev-0.1.0/.gitignore +21 -0
  2. python_infrakit_dev-0.1.0/.python-version +1 -0
  3. python_infrakit_dev-0.1.0/PKG-INFO +124 -0
  4. python_infrakit_dev-0.1.0/README.md +107 -0
  5. python_infrakit_dev-0.1.0/infrakit/__init__.py +0 -0
  6. python_infrakit_dev-0.1.0/infrakit/cli/__init__.py +1 -0
  7. python_infrakit_dev-0.1.0/infrakit/cli/commands/__init__.py +1 -0
  8. python_infrakit_dev-0.1.0/infrakit/cli/commands/deps.py +530 -0
  9. python_infrakit_dev-0.1.0/infrakit/cli/commands/init.py +129 -0
  10. python_infrakit_dev-0.1.0/infrakit/cli/commands/llm.py +295 -0
  11. python_infrakit_dev-0.1.0/infrakit/cli/commands/logger.py +160 -0
  12. python_infrakit_dev-0.1.0/infrakit/cli/commands/module.py +342 -0
  13. python_infrakit_dev-0.1.0/infrakit/cli/commands/time.py +81 -0
  14. python_infrakit_dev-0.1.0/infrakit/cli/main.py +65 -0
  15. python_infrakit_dev-0.1.0/infrakit/core/__init__.py +0 -0
  16. python_infrakit_dev-0.1.0/infrakit/core/config/__init__.py +0 -0
  17. python_infrakit_dev-0.1.0/infrakit/core/config/converter.py +480 -0
  18. python_infrakit_dev-0.1.0/infrakit/core/config/exporter.py +304 -0
  19. python_infrakit_dev-0.1.0/infrakit/core/config/loader.py +713 -0
  20. python_infrakit_dev-0.1.0/infrakit/core/config/validator.py +389 -0
  21. python_infrakit_dev-0.1.0/infrakit/core/logger/__init__.py +21 -0
  22. python_infrakit_dev-0.1.0/infrakit/core/logger/formatters.py +143 -0
  23. python_infrakit_dev-0.1.0/infrakit/core/logger/handlers.py +322 -0
  24. python_infrakit_dev-0.1.0/infrakit/core/logger/retention.py +176 -0
  25. python_infrakit_dev-0.1.0/infrakit/core/logger/setup.py +314 -0
  26. python_infrakit_dev-0.1.0/infrakit/deps/__init__.py +239 -0
  27. python_infrakit_dev-0.1.0/infrakit/deps/clean.py +141 -0
  28. python_infrakit_dev-0.1.0/infrakit/deps/depfile.py +405 -0
  29. python_infrakit_dev-0.1.0/infrakit/deps/health.py +357 -0
  30. python_infrakit_dev-0.1.0/infrakit/deps/optimizer.py +642 -0
  31. python_infrakit_dev-0.1.0/infrakit/deps/scanner.py +550 -0
  32. python_infrakit_dev-0.1.0/infrakit/llm/__init__.py +35 -0
  33. python_infrakit_dev-0.1.0/infrakit/llm/batch.py +165 -0
  34. python_infrakit_dev-0.1.0/infrakit/llm/client.py +575 -0
  35. python_infrakit_dev-0.1.0/infrakit/llm/key_manager.py +728 -0
  36. python_infrakit_dev-0.1.0/infrakit/llm/llm_readme.md +306 -0
  37. python_infrakit_dev-0.1.0/infrakit/llm/models.py +148 -0
  38. python_infrakit_dev-0.1.0/infrakit/llm/providers/__init__.py +5 -0
  39. python_infrakit_dev-0.1.0/infrakit/llm/providers/base.py +112 -0
  40. python_infrakit_dev-0.1.0/infrakit/llm/providers/gemini.py +164 -0
  41. python_infrakit_dev-0.1.0/infrakit/llm/providers/openai.py +168 -0
  42. python_infrakit_dev-0.1.0/infrakit/llm/rate_limiter.py +54 -0
  43. python_infrakit_dev-0.1.0/infrakit/scaffolder/__init__.py +31 -0
  44. python_infrakit_dev-0.1.0/infrakit/scaffolder/ai.py +508 -0
  45. python_infrakit_dev-0.1.0/infrakit/scaffolder/backend.py +555 -0
  46. python_infrakit_dev-0.1.0/infrakit/scaffolder/cli_tool.py +386 -0
  47. python_infrakit_dev-0.1.0/infrakit/scaffolder/generator.py +338 -0
  48. python_infrakit_dev-0.1.0/infrakit/scaffolder/pipeline.py +562 -0
  49. python_infrakit_dev-0.1.0/infrakit/scaffolder/registry.py +121 -0
  50. python_infrakit_dev-0.1.0/infrakit/time/__init__.py +60 -0
  51. python_infrakit_dev-0.1.0/infrakit/time/profiler.py +511 -0
  52. python_infrakit_dev-0.1.0/pyproject.toml +39 -0
  53. python_infrakit_dev-0.1.0/tests/__init__.py +0 -0
  54. python_infrakit_dev-0.1.0/tests/cli/__init__.py +1 -0
  55. python_infrakit_dev-0.1.0/tests/cli/conftest.py +68 -0
  56. python_infrakit_dev-0.1.0/tests/cli/test_config.py +161 -0
  57. python_infrakit_dev-0.1.0/tests/cli/test_init.py +226 -0
  58. python_infrakit_dev-0.1.0/tests/cli/test_logger.py +150 -0
  59. python_infrakit_dev-0.1.0/tests/cli/test_module.py +380 -0
  60. python_infrakit_dev-0.1.0/tests/core/__init__.py +0 -0
  61. python_infrakit_dev-0.1.0/tests/core/config/__init__.py +0 -0
  62. python_infrakit_dev-0.1.0/tests/core/config/test_converter.py +148 -0
  63. python_infrakit_dev-0.1.0/tests/core/config/test_exporter.py +292 -0
  64. python_infrakit_dev-0.1.0/tests/core/config/test_loader.py +644 -0
  65. python_infrakit_dev-0.1.0/tests/core/config/test_validator.py +198 -0
  66. python_infrakit_dev-0.1.0/tests/core/logger/__init__.py +0 -0
  67. python_infrakit_dev-0.1.0/tests/core/logger/test_formatters.py +170 -0
  68. python_infrakit_dev-0.1.0/tests/core/logger/test_handler.py +158 -0
  69. python_infrakit_dev-0.1.0/tests/core/logger/test_retention.py +98 -0
  70. python_infrakit_dev-0.1.0/tests/core/logger/test_setup.py +184 -0
  71. python_infrakit_dev-0.1.0/tests/test_llm.py +416 -0
  72. python_infrakit_dev-0.1.0/tests/test_time.py +588 -0
@@ -0,0 +1,21 @@
1
+ # Python-generated files
2
+ __pycache__/
3
+ *.py[oc]
4
+ build/
5
+ dist/
6
+ wheels/
7
+ *.egg-info
8
+
9
+ # Virtual environments
10
+ .venv
11
+
12
+ **/sample_usage.py
13
+ **/.pytest_cache/
14
+ test_time_cli.py
15
+ test_deps.py
16
+ uv.lock
17
+ new_requirements.txt
18
+ .env
19
+ config.*
20
+ testing.ipynb
21
+ api_key_dir
@@ -0,0 +1 @@
1
+ 3.13
@@ -0,0 +1,124 @@
1
+ Metadata-Version: 2.4
2
+ Name: python-infrakit-dev
3
+ Version: 0.1.0
4
+ Summary: A comprehensive Python developer infrastructure toolkit
5
+ Project-URL: Homepage, https://github.com/chiragg21/infrakit
6
+ Project-URL: Repository, https://github.com/chiragg21/infrakit
7
+ Requires-Python: >=3.13
8
+ Requires-Dist: google-genai>=1.69.0
9
+ Requires-Dist: isort>=8.0.1
10
+ Requires-Dist: openai>=2.30.0
11
+ Requires-Dist: pydantic>=2.12.5
12
+ Requires-Dist: python-dotenv>=1.2.2
13
+ Requires-Dist: pyyaml>=6.0.3
14
+ Requires-Dist: tqdm>=4.67.3
15
+ Requires-Dist: typer>=0.24.1
16
+ Description-Content-Type: text/markdown
17
+
18
+ # Infrakit
19
+
20
+ Infrakit is a comprehensive, modular developer infrastructure toolkit for Python projects. It provides CLI utilities, rich project scaffolding, a robust multi-provider LLM client, dependency management, profiling, and core utilities for logging and configuration.
21
+
22
+ ## Installation
23
+
24
+ Install via pip:
25
+
26
+ ```bash
27
+ pip install infrakit
28
+ # or if using uv
29
+ uv pip install infrakit
30
+ ```
31
+
32
+ The CLI is exposed as `infrakit` and conveniently aliased as `ik`.
33
+
34
+ ## Key Features
35
+
36
+ ### 1. Project Scaffolding (`ik init`)
37
+
38
+ Quickly bootstrap new Python projects with standardized layouts, ready-to-use boilerplate, and optional LLM integration. Existing files are safely skipped if you re-run over a directory.
39
+
40
+ ```bash
41
+ ik init my-project -t basic
42
+ ik init my-fastapi-app -t backend -v 0.1.0
43
+ ik init my-ai-tool -t ai --include-llm
44
+ ```
45
+
46
+ **Available Templates**:
47
+ - **`basic`**: Minimal template (src, utils, tests).
48
+ - **`backend`**: FastAPI service (app, routes, middleware, Dockerfile, docker-compose).
49
+ - **`cli_tool`**: Distributable CLI application using Typer.
50
+ - **`pipeline`**: Data pipeline / ETL template (extract, transform, load, enrich).
51
+ - **`ai`**: AI/ML project optimized for notebooks and pipelines.
52
+
53
+ ### 2. Multi-provider LLM Client (`infrakit.llm`)
54
+
55
+ A unified LLM client interface supporting **OpenAI** and **Gemini**. Built natively for robust production use cases, particularly when navigating free-tier API quotas.
56
+
57
+ **Features:**
58
+ - Seamless key rotation and persistent storage tracking.
59
+ - Local rate limiting (RPM/TPM gates).
60
+ - Async and multi-threaded batch generation.
61
+ - Structured output parsing and schema validation using `pydantic.BaseModel`.
62
+
63
+ **Quick Start:**
64
+ ```python
65
+ from infrakit.llm import LLMClient, Prompt
66
+
67
+ client = LLMClient(keys={"openai_keys": ["sk-..."], "gemini_keys": ["AIza..."]}, storage_dir="./logs")
68
+ response = client.generate(Prompt(user="What is the capital of France?"), provider="openai")
69
+ print(response.content)
70
+ ```
71
+
72
+ **LLM CLI tools:**
73
+ Monitor and control limits right from the CLI.
74
+ - `ik llm status --storage-dir ./logs`
75
+ - `ik llm quota set --provider openai --key sk-abc --rpm 60 --storage-dir ./logs`
76
+
77
+ ### 3. Dependency Management (`infrakit.deps`)
78
+
79
+ In-depth Python dependency tools available under `ik deps` (or programmatically via `infrakit.deps`) to clean, health-check, scan, and optimize dependencies.
80
+
81
+ **Features:**
82
+ - `scan(root)`: Scan your project for actual Python dependencies used in code.
83
+ - `export()`: Export used dependencies to update `requirements.txt` or `pyproject.toml` automatically.
84
+ - `check(packages)`: Run health, security, and outdated checks on packages.
85
+ - `clean()`: Find and remove unused packages from the virtual environment.
86
+ - `optimise()`: Optimize and format imports across the project (integrates with `isort`).
87
+
88
+ ### 4. Code Profiling (`infrakit.time`)
89
+
90
+ Lightweight timing and execution profiling for your Python projects.
91
+
92
+ **CLI Usage:**
93
+ Profile any script instantly to detect performance bottlenecks.
94
+ ```bash
95
+ ik time run script.py --max-functions 30 --min-time 1.0
96
+ ```
97
+
98
+ **Decorator Usage:**
99
+ Track specific pipeline steps inside your code:
100
+ ```python
101
+ from infrakit.time import pipeline_profiler, track
102
+
103
+ @pipeline_profiler("Data Processing Pipeline")
104
+ def main():
105
+ load_data()
106
+ transform_data()
107
+
108
+ @track(name="Load Step")
109
+ def load_data(): pass
110
+ ```
111
+
112
+ ### 5. Core Utilities (`infrakit.core`)
113
+
114
+ Convenient implementations for common application needs.
115
+
116
+ - **Config Loader** (`infrakit.core.config.loader`): Multi-format configuration loader supporting JSON, YAML, INI, and `.env`. Automatically resolves variables using `python-dotenv` and converts types properly natively.
117
+ - **Logger** (`infrakit.core.logger`): Unified logging setups for consistent output across applications.
118
+ ```python
119
+ from infrakit.core.logger import setup, get_logger
120
+
121
+ setup(level="INFO", strategy="date_level", stream="stdout")
122
+ log = get_logger(__name__)
123
+ log.info("Ready")
124
+ ```
@@ -0,0 +1,107 @@
1
+ # Infrakit
2
+
3
+ Infrakit is a comprehensive, modular developer infrastructure toolkit for Python projects. It provides CLI utilities, rich project scaffolding, a robust multi-provider LLM client, dependency management, profiling, and core utilities for logging and configuration.
4
+
5
+ ## Installation
6
+
7
+ Install via pip:
8
+
9
+ ```bash
10
+ pip install infrakit
11
+ # or if using uv
12
+ uv pip install infrakit
13
+ ```
14
+
15
+ The CLI is exposed as `infrakit` and conveniently aliased as `ik`.
16
+
17
+ ## Key Features
18
+
19
+ ### 1. Project Scaffolding (`ik init`)
20
+
21
+ Quickly bootstrap new Python projects with standardized layouts, ready-to-use boilerplate, and optional LLM integration. Existing files are safely skipped if you re-run over a directory.
22
+
23
+ ```bash
24
+ ik init my-project -t basic
25
+ ik init my-fastapi-app -t backend -v 0.1.0
26
+ ik init my-ai-tool -t ai --include-llm
27
+ ```
28
+
29
+ **Available Templates**:
30
+ - **`basic`**: Minimal template (src, utils, tests).
31
+ - **`backend`**: FastAPI service (app, routes, middleware, Dockerfile, docker-compose).
32
+ - **`cli_tool`**: Distributable CLI application using Typer.
33
+ - **`pipeline`**: Data pipeline / ETL template (extract, transform, load, enrich).
34
+ - **`ai`**: AI/ML project optimized for notebooks and pipelines.
35
+
36
+ ### 2. Multi-provider LLM Client (`infrakit.llm`)
37
+
38
+ A unified LLM client interface supporting **OpenAI** and **Gemini**. Built natively for robust production use cases, particularly when navigating free-tier API quotas.
39
+
40
+ **Features:**
41
+ - Seamless key rotation and persistent storage tracking.
42
+ - Local rate limiting (RPM/TPM gates).
43
+ - Async and multi-threaded batch generation.
44
+ - Structured output parsing and schema validation using `pydantic.BaseModel`.
45
+
46
+ **Quick Start:**
47
+ ```python
48
+ from infrakit.llm import LLMClient, Prompt
49
+
50
+ client = LLMClient(keys={"openai_keys": ["sk-..."], "gemini_keys": ["AIza..."]}, storage_dir="./logs")
51
+ response = client.generate(Prompt(user="What is the capital of France?"), provider="openai")
52
+ print(response.content)
53
+ ```
54
+
55
+ **LLM CLI tools:**
56
+ Monitor and control limits right from the CLI.
57
+ - `ik llm status --storage-dir ./logs`
58
+ - `ik llm quota set --provider openai --key sk-abc --rpm 60 --storage-dir ./logs`
59
+
60
+ ### 3. Dependency Management (`infrakit.deps`)
61
+
62
+ In-depth Python dependency tools available under `ik deps` (or programmatically via `infrakit.deps`) to clean, health-check, scan, and optimize dependencies.
63
+
64
+ **Features:**
65
+ - `scan(root)`: Scan your project for actual Python dependencies used in code.
66
+ - `export()`: Export used dependencies to update `requirements.txt` or `pyproject.toml` automatically.
67
+ - `check(packages)`: Run health, security, and outdated checks on packages.
68
+ - `clean()`: Find and remove unused packages from the virtual environment.
69
+ - `optimise()`: Optimize and format imports across the project (integrates with `isort`).
70
+
71
+ ### 4. Code Profiling (`infrakit.time`)
72
+
73
+ Lightweight timing and execution profiling for your Python projects.
74
+
75
+ **CLI Usage:**
76
+ Profile any script instantly to detect performance bottlenecks.
77
+ ```bash
78
+ ik time run script.py --max-functions 30 --min-time 1.0
79
+ ```
80
+
81
+ **Decorator Usage:**
82
+ Track specific pipeline steps inside your code:
83
+ ```python
84
+ from infrakit.time import pipeline_profiler, track
85
+
86
+ @pipeline_profiler("Data Processing Pipeline")
87
+ def main():
88
+ load_data()
89
+ transform_data()
90
+
91
+ @track(name="Load Step")
92
+ def load_data(): pass
93
+ ```
94
+
95
+ ### 5. Core Utilities (`infrakit.core`)
96
+
97
+ Convenient implementations for common application needs.
98
+
99
+ - **Config Loader** (`infrakit.core.config.loader`): Multi-format configuration loader supporting JSON, YAML, INI, and `.env`. Automatically resolves variables using `python-dotenv` and converts types properly natively.
100
+ - **Logger** (`infrakit.core.logger`): Unified logging setups for consistent output across applications.
101
+ ```python
102
+ from infrakit.core.logger import setup, get_logger
103
+
104
+ setup(level="INFO", strategy="date_level", stream="stdout")
105
+ log = get_logger(__name__)
106
+ log.info("Ready")
107
+ ```
File without changes
@@ -0,0 +1 @@
1
+ """infrakit.cli — command-line interface for infrakit."""
@@ -0,0 +1 @@
1
+ """infrakit.cli.commands — subcommand groups."""