archapi 0.3.0__tar.gz → 0.3.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.
Files changed (42) hide show
  1. archapi-0.3.2/PKG-INFO +251 -0
  2. archapi-0.3.2/README.md +227 -0
  3. archapi-0.3.2/archapi.egg-info/PKG-INFO +251 -0
  4. {archapi-0.3.0 → archapi-0.3.2}/pyproject.toml +3 -3
  5. archapi-0.3.2/tests/test_archapi_suite.py +248 -0
  6. archapi-0.3.0/PKG-INFO +0 -79
  7. archapi-0.3.0/README.md +0 -56
  8. archapi-0.3.0/archapi.egg-info/PKG-INFO +0 -79
  9. archapi-0.3.0/tests/test_archapi_suite.py +0 -118
  10. {archapi-0.3.0 → archapi-0.3.2}/LICENSE +0 -0
  11. {archapi-0.3.0 → archapi-0.3.2}/archapi/__init__.py +0 -0
  12. {archapi-0.3.0 → archapi-0.3.2}/archapi/core.py +0 -0
  13. {archapi-0.3.0 → archapi-0.3.2}/archapi/frameworks/__init__.py +0 -0
  14. {archapi-0.3.0 → archapi-0.3.2}/archapi/frameworks/base.py +0 -0
  15. {archapi-0.3.0 → archapi-0.3.2}/archapi/frameworks/detector.py +0 -0
  16. {archapi-0.3.0 → archapi-0.3.2}/archapi/frameworks/express_ts/__init__.py +0 -0
  17. {archapi-0.3.0 → archapi-0.3.2}/archapi/frameworks/express_ts/adapter.py +0 -0
  18. {archapi-0.3.0 → archapi-0.3.2}/archapi/frameworks/fastapi_adapter.py +0 -0
  19. {archapi-0.3.0 → archapi-0.3.2}/archapi/frameworks/generic.py +0 -0
  20. {archapi-0.3.0 → archapi-0.3.2}/archapi/frameworks/registry.py +0 -0
  21. {archapi-0.3.0 → archapi-0.3.2}/archapi/generation/__init__.py +0 -0
  22. {archapi-0.3.0 → archapi-0.3.2}/archapi/genome/__init__.py +0 -0
  23. {archapi-0.3.0 → archapi-0.3.2}/archapi/indexing/__init__.py +0 -0
  24. {archapi-0.3.0 → archapi-0.3.2}/archapi/indexing/cache.py +0 -0
  25. {archapi-0.3.0 → archapi-0.3.2}/archapi/mapping/__init__.py +0 -0
  26. {archapi-0.3.0 → archapi-0.3.2}/archapi/planning/__init__.py +0 -0
  27. {archapi-0.3.0 → archapi-0.3.2}/archapi/planning/intent_planner.py +0 -0
  28. {archapi-0.3.0 → archapi-0.3.2}/archapi/planning/task_dag.py +0 -0
  29. {archapi-0.3.0 → archapi-0.3.2}/archapi/scanner/__init__.py +0 -0
  30. {archapi-0.3.0 → archapi-0.3.2}/archapi/security/__init__.py +0 -0
  31. {archapi-0.3.0 → archapi-0.3.2}/archapi/security/context_redactor.py +0 -0
  32. {archapi-0.3.0 → archapi-0.3.2}/archapi/security/policy_gate.py +0 -0
  33. {archapi-0.3.0 → archapi-0.3.2}/archapi/security/secret_scanner.py +0 -0
  34. {archapi-0.3.0 → archapi-0.3.2}/archapi/types.py +0 -0
  35. {archapi-0.3.0 → archapi-0.3.2}/archapi/validation/__init__.py +0 -0
  36. {archapi-0.3.0 → archapi-0.3.2}/archapi/validation/architecture_score.py +0 -0
  37. {archapi-0.3.0 → archapi-0.3.2}/archapi/validation/basic_validators.py +0 -0
  38. {archapi-0.3.0 → archapi-0.3.2}/archapi/validation/command_validator.py +0 -0
  39. {archapi-0.3.0 → archapi-0.3.2}/archapi.egg-info/SOURCES.txt +0 -0
  40. {archapi-0.3.0 → archapi-0.3.2}/archapi.egg-info/dependency_links.txt +0 -0
  41. {archapi-0.3.0 → archapi-0.3.2}/archapi.egg-info/top_level.txt +0 -0
  42. {archapi-0.3.0 → archapi-0.3.2}/setup.cfg +0 -0
archapi-0.3.2/PKG-INFO ADDED
@@ -0,0 +1,251 @@
1
+ Metadata-Version: 2.4
2
+ Name: archapi
3
+ Version: 0.3.2
4
+ Summary: Architecture-preserving REST API synthesis library
5
+ Author: Rohith Chikkala
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/rohith5005/archapi
8
+ Project-URL: Repository, https://github.com/rohith5005/archapi
9
+ Project-URL: Issues, https://github.com/rohith5005/archapi/issues
10
+ Project-URL: PyPI, https://pypi.org/project/archapi/
11
+ Keywords: rest-api,code-generation,architecture,express,fastapi
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.9
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Topic :: Software Development :: Code Generators
20
+ Requires-Python: >=3.9
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+ Dynamic: license-file
24
+
25
+ # ArchAPI
26
+
27
+ ArchAPI is a Python library for architecture-preserving REST API generation.
28
+
29
+ It scans an existing backend project, detects the framework, understands the project structure, plans a REST API, generates framework-specific files, validates the output, and writes files only when explicitly requested.
30
+
31
+ ## Current Status
32
+
33
+ Current checkpoint: **0.3.1**
34
+
35
+ ArchAPI currently supports:
36
+
37
+ - Express TypeScript
38
+ - FastAPI
39
+ - Generic fallback detection for unsupported projects
40
+
41
+ Core features:
42
+
43
+ - Framework detection
44
+ - Project scanning
45
+ - API architecture modeling
46
+ - Confidence scoring
47
+ - Low-confidence blocking
48
+ - Strict config mode
49
+ - REST intent planning
50
+ - Dry-run code generation
51
+ - Safe apply behavior
52
+ - Overwrite protection
53
+ - Cache and changed-file detection
54
+ - Secret scanning helpers
55
+ - Context redaction
56
+ - Policy gate
57
+ - Architecture consistency scoring
58
+ - Unified regression test suite
59
+
60
+ ## Installation from PyPI
61
+
62
+ ```bash
63
+ python -m pip install archapi
64
+ ```
65
+
66
+ Verify:
67
+
68
+ ```bash
69
+ python -c "from archapi import ArchAPI; print('ArchAPI import works')"
70
+ ```
71
+
72
+ ## Run from GitHub Source
73
+
74
+ ```bash
75
+ git clone https://github.com/rohith5005/archapi.git
76
+ cd archapi
77
+
78
+ python3 -m venv .venv
79
+ source .venv/bin/activate
80
+
81
+ python -m pip install --upgrade pip setuptools wheel
82
+ python -m pip install -e .
83
+ ```
84
+
85
+ Verify:
86
+
87
+ ```bash
88
+ python -c "from archapi import ArchAPI; print('GitHub source install worked')"
89
+ ```
90
+
91
+ ## Run Tests
92
+
93
+ ```bash
94
+ python -m compileall archapi
95
+ python -m unittest tests.test_archapi_suite -v
96
+ ```
97
+
98
+ Or:
99
+
100
+ ```bash
101
+ ./scripts/run_tests.sh
102
+ ```
103
+
104
+ Expected result:
105
+
106
+ ```text
107
+ Ran 7 tests
108
+
109
+ OK
110
+ ```
111
+
112
+ ## Basic Usage
113
+
114
+ ```python
115
+ from archapi import ArchAPI
116
+
117
+ engine = ArchAPI("./sample_projects/express_basic")
118
+
119
+ result = engine.generate_api(
120
+ "Create GET API for user order history",
121
+ dry_run=True,
122
+ )
123
+
124
+ print(result.plan)
125
+ print(result.validation_report)
126
+ print(result.diff)
127
+ ```
128
+
129
+ ## Express TypeScript Example
130
+
131
+ ```python
132
+ from pathlib import Path
133
+ from archapi import ArchAPI
134
+
135
+ project = Path("express_basic")
136
+
137
+ (project / "src/routes").mkdir(parents=True, exist_ok=True)
138
+ (project / "src/controllers").mkdir(parents=True, exist_ok=True)
139
+ (project / "src/services").mkdir(parents=True, exist_ok=True)
140
+ (project / "src/schemas").mkdir(parents=True, exist_ok=True)
141
+ (project / "tests").mkdir(parents=True, exist_ok=True)
142
+
143
+ (project / "package.json").write_text(
144
+ '{"dependencies": {"express": "^4.18.0", "zod": "^3.0.0"}}'
145
+ )
146
+
147
+ (project / "src/routes/user.routes.ts").write_text(
148
+ 'import { Router } from "express";\n'
149
+ 'const router = Router();\n'
150
+ 'export default router;\n'
151
+ )
152
+
153
+ (project / "src/controllers/user.controller.ts").write_text(
154
+ 'export const userController = {};\n'
155
+ )
156
+
157
+ (project / "src/services/user.service.ts").write_text(
158
+ 'export const userService = {};\n'
159
+ )
160
+
161
+ (project / "src/schemas/user.schema.ts").write_text(
162
+ 'import { z } from "zod";\n'
163
+ )
164
+
165
+ (project / "tests/user.test.ts").write_text(
166
+ 'describe("user", () => { it("works", () => expect(true).toBe(true)); });\n'
167
+ )
168
+
169
+ engine = ArchAPI(str(project))
170
+ result = engine.generate_api("Create GET API for user order history", dry_run=True)
171
+
172
+ print("Detected framework:", engine.detect_framework().framework)
173
+ print("Generated method:", result.plan.method)
174
+ print("Generated path:", result.plan.path)
175
+ print("Generated files:", [str(file.path) for file in result.files])
176
+ ```
177
+
178
+ Expected output includes:
179
+
180
+ ```text
181
+ Detected framework: express-typescript
182
+ Generated method: GET
183
+ Generated path: /users/{user_id}/orders
184
+ ```
185
+
186
+ ## FastAPI Example
187
+
188
+ ```python
189
+ from pathlib import Path
190
+ from archapi import ArchAPI
191
+
192
+ project = Path("fastapi_basic")
193
+
194
+ (project / "app/routers").mkdir(parents=True, exist_ok=True)
195
+ (project / "app/services").mkdir(parents=True, exist_ok=True)
196
+ (project / "app/schemas").mkdir(parents=True, exist_ok=True)
197
+ (project / "tests").mkdir(parents=True, exist_ok=True)
198
+
199
+ (project / "requirements.txt").write_text("fastapi\npydantic\npytest\n")
200
+
201
+ (project / "app/routers/user_router.py").write_text(
202
+ "from fastapi import APIRouter\n"
203
+ "router = APIRouter()\n"
204
+ )
205
+
206
+ (project / "app/services/user_service.py").write_text(
207
+ "class UserService:\n"
208
+ " pass\n\n"
209
+ "user_service = UserService()\n"
210
+ )
211
+
212
+ (project / "app/schemas/user_schema.py").write_text(
213
+ "from pydantic import BaseModel\n\n"
214
+ "class UserResponse(BaseModel):\n"
215
+ " id: str\n"
216
+ )
217
+
218
+ (project / "tests/test_user.py").write_text(
219
+ "def test_user_placeholder():\n"
220
+ " assert True\n"
221
+ )
222
+
223
+ engine = ArchAPI(str(project))
224
+ result = engine.generate_api("Create POST API for product review", dry_run=True)
225
+
226
+ print("Detected framework:", engine.detect_framework().framework)
227
+ print("Generated method:", result.plan.method)
228
+ print("Generated path:", result.plan.path)
229
+ print("Generated files:", [str(file.path) for file in result.files])
230
+ ```
231
+
232
+ Expected output includes:
233
+
234
+ ```text
235
+ Detected framework: fastapi
236
+ Generated method: POST
237
+ Generated path: /products/{product_id}/reviews
238
+ ```
239
+
240
+ ## Documentation
241
+
242
+ - [How to Run](docs/HOW_TO_RUN.md)
243
+ - [Architecture](docs/ARCHITECTURE.md)
244
+ - [File Guide](docs/FILE_GUIDE.md)
245
+ - [Security Measures](docs/SECURITY_MEASURES.md)
246
+ - [Development Status](docs/DEVELOPMENT_STATUS.md)
247
+
248
+ ## Links
249
+
250
+ - GitHub: https://github.com/rohith5005/archapi
251
+ - PyPI: https://pypi.org/project/archapi/
@@ -0,0 +1,227 @@
1
+ # ArchAPI
2
+
3
+ ArchAPI is a Python library for architecture-preserving REST API generation.
4
+
5
+ It scans an existing backend project, detects the framework, understands the project structure, plans a REST API, generates framework-specific files, validates the output, and writes files only when explicitly requested.
6
+
7
+ ## Current Status
8
+
9
+ Current checkpoint: **0.3.1**
10
+
11
+ ArchAPI currently supports:
12
+
13
+ - Express TypeScript
14
+ - FastAPI
15
+ - Generic fallback detection for unsupported projects
16
+
17
+ Core features:
18
+
19
+ - Framework detection
20
+ - Project scanning
21
+ - API architecture modeling
22
+ - Confidence scoring
23
+ - Low-confidence blocking
24
+ - Strict config mode
25
+ - REST intent planning
26
+ - Dry-run code generation
27
+ - Safe apply behavior
28
+ - Overwrite protection
29
+ - Cache and changed-file detection
30
+ - Secret scanning helpers
31
+ - Context redaction
32
+ - Policy gate
33
+ - Architecture consistency scoring
34
+ - Unified regression test suite
35
+
36
+ ## Installation from PyPI
37
+
38
+ ```bash
39
+ python -m pip install archapi
40
+ ```
41
+
42
+ Verify:
43
+
44
+ ```bash
45
+ python -c "from archapi import ArchAPI; print('ArchAPI import works')"
46
+ ```
47
+
48
+ ## Run from GitHub Source
49
+
50
+ ```bash
51
+ git clone https://github.com/rohith5005/archapi.git
52
+ cd archapi
53
+
54
+ python3 -m venv .venv
55
+ source .venv/bin/activate
56
+
57
+ python -m pip install --upgrade pip setuptools wheel
58
+ python -m pip install -e .
59
+ ```
60
+
61
+ Verify:
62
+
63
+ ```bash
64
+ python -c "from archapi import ArchAPI; print('GitHub source install worked')"
65
+ ```
66
+
67
+ ## Run Tests
68
+
69
+ ```bash
70
+ python -m compileall archapi
71
+ python -m unittest tests.test_archapi_suite -v
72
+ ```
73
+
74
+ Or:
75
+
76
+ ```bash
77
+ ./scripts/run_tests.sh
78
+ ```
79
+
80
+ Expected result:
81
+
82
+ ```text
83
+ Ran 7 tests
84
+
85
+ OK
86
+ ```
87
+
88
+ ## Basic Usage
89
+
90
+ ```python
91
+ from archapi import ArchAPI
92
+
93
+ engine = ArchAPI("./sample_projects/express_basic")
94
+
95
+ result = engine.generate_api(
96
+ "Create GET API for user order history",
97
+ dry_run=True,
98
+ )
99
+
100
+ print(result.plan)
101
+ print(result.validation_report)
102
+ print(result.diff)
103
+ ```
104
+
105
+ ## Express TypeScript Example
106
+
107
+ ```python
108
+ from pathlib import Path
109
+ from archapi import ArchAPI
110
+
111
+ project = Path("express_basic")
112
+
113
+ (project / "src/routes").mkdir(parents=True, exist_ok=True)
114
+ (project / "src/controllers").mkdir(parents=True, exist_ok=True)
115
+ (project / "src/services").mkdir(parents=True, exist_ok=True)
116
+ (project / "src/schemas").mkdir(parents=True, exist_ok=True)
117
+ (project / "tests").mkdir(parents=True, exist_ok=True)
118
+
119
+ (project / "package.json").write_text(
120
+ '{"dependencies": {"express": "^4.18.0", "zod": "^3.0.0"}}'
121
+ )
122
+
123
+ (project / "src/routes/user.routes.ts").write_text(
124
+ 'import { Router } from "express";\n'
125
+ 'const router = Router();\n'
126
+ 'export default router;\n'
127
+ )
128
+
129
+ (project / "src/controllers/user.controller.ts").write_text(
130
+ 'export const userController = {};\n'
131
+ )
132
+
133
+ (project / "src/services/user.service.ts").write_text(
134
+ 'export const userService = {};\n'
135
+ )
136
+
137
+ (project / "src/schemas/user.schema.ts").write_text(
138
+ 'import { z } from "zod";\n'
139
+ )
140
+
141
+ (project / "tests/user.test.ts").write_text(
142
+ 'describe("user", () => { it("works", () => expect(true).toBe(true)); });\n'
143
+ )
144
+
145
+ engine = ArchAPI(str(project))
146
+ result = engine.generate_api("Create GET API for user order history", dry_run=True)
147
+
148
+ print("Detected framework:", engine.detect_framework().framework)
149
+ print("Generated method:", result.plan.method)
150
+ print("Generated path:", result.plan.path)
151
+ print("Generated files:", [str(file.path) for file in result.files])
152
+ ```
153
+
154
+ Expected output includes:
155
+
156
+ ```text
157
+ Detected framework: express-typescript
158
+ Generated method: GET
159
+ Generated path: /users/{user_id}/orders
160
+ ```
161
+
162
+ ## FastAPI Example
163
+
164
+ ```python
165
+ from pathlib import Path
166
+ from archapi import ArchAPI
167
+
168
+ project = Path("fastapi_basic")
169
+
170
+ (project / "app/routers").mkdir(parents=True, exist_ok=True)
171
+ (project / "app/services").mkdir(parents=True, exist_ok=True)
172
+ (project / "app/schemas").mkdir(parents=True, exist_ok=True)
173
+ (project / "tests").mkdir(parents=True, exist_ok=True)
174
+
175
+ (project / "requirements.txt").write_text("fastapi\npydantic\npytest\n")
176
+
177
+ (project / "app/routers/user_router.py").write_text(
178
+ "from fastapi import APIRouter\n"
179
+ "router = APIRouter()\n"
180
+ )
181
+
182
+ (project / "app/services/user_service.py").write_text(
183
+ "class UserService:\n"
184
+ " pass\n\n"
185
+ "user_service = UserService()\n"
186
+ )
187
+
188
+ (project / "app/schemas/user_schema.py").write_text(
189
+ "from pydantic import BaseModel\n\n"
190
+ "class UserResponse(BaseModel):\n"
191
+ " id: str\n"
192
+ )
193
+
194
+ (project / "tests/test_user.py").write_text(
195
+ "def test_user_placeholder():\n"
196
+ " assert True\n"
197
+ )
198
+
199
+ engine = ArchAPI(str(project))
200
+ result = engine.generate_api("Create POST API for product review", dry_run=True)
201
+
202
+ print("Detected framework:", engine.detect_framework().framework)
203
+ print("Generated method:", result.plan.method)
204
+ print("Generated path:", result.plan.path)
205
+ print("Generated files:", [str(file.path) for file in result.files])
206
+ ```
207
+
208
+ Expected output includes:
209
+
210
+ ```text
211
+ Detected framework: fastapi
212
+ Generated method: POST
213
+ Generated path: /products/{product_id}/reviews
214
+ ```
215
+
216
+ ## Documentation
217
+
218
+ - [How to Run](docs/HOW_TO_RUN.md)
219
+ - [Architecture](docs/ARCHITECTURE.md)
220
+ - [File Guide](docs/FILE_GUIDE.md)
221
+ - [Security Measures](docs/SECURITY_MEASURES.md)
222
+ - [Development Status](docs/DEVELOPMENT_STATUS.md)
223
+
224
+ ## Links
225
+
226
+ - GitHub: https://github.com/rohith5005/archapi
227
+ - PyPI: https://pypi.org/project/archapi/