PyArch-CLI 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.
Files changed (92) hide show
  1. {pyarch_cli-0.1.0 → pyarch_cli-0.1.2}/.gitignore +1 -1
  2. pyarch_cli-0.1.2/PKG-INFO +271 -0
  3. pyarch_cli-0.1.2/README.md +243 -0
  4. pyarch_cli-0.1.2/assets/Dockerfile.vhs +11 -0
  5. pyarch_cli-0.1.2/assets/pyarch-demo.gif +0 -0
  6. pyarch_cli-0.1.2/assets/pyarch-demo.tape +37 -0
  7. pyarch_cli-0.1.2/assets/vhs-uv +17 -0
  8. {pyarch_cli-0.1.0 → pyarch_cli-0.1.2}/pyproject.toml +23 -18
  9. pyarch_cli-0.1.2/src/pyarch/__init__.py +1 -0
  10. {pyarch_cli-0.1.0 → pyarch_cli-0.1.2/src}/pyarch/cli/add.py +3 -2
  11. pyarch_cli-0.1.2/src/pyarch/cli/app.py +29 -0
  12. {pyarch_cli-0.1.0 → pyarch_cli-0.1.2/src}/pyarch/cli/common.py +0 -1
  13. {pyarch_cli-0.1.0 → pyarch_cli-0.1.2/src}/pyarch/cli/generate.py +1 -3
  14. pyarch_cli-0.1.2/src/pyarch/cli/info.py +29 -0
  15. pyarch_cli-0.1.2/src/pyarch/cli/init.py +34 -0
  16. {pyarch_cli-0.1.0 → pyarch_cli-0.1.2/src}/pyarch/config/manifest.py +12 -9
  17. {pyarch_cli-0.1.0 → pyarch_cli-0.1.2/src}/pyarch/config/models.py +0 -1
  18. {pyarch_cli-0.1.0 → pyarch_cli-0.1.2/src}/pyarch/generators/common/gitignore.py +3 -2
  19. {pyarch_cli-0.1.0 → pyarch_cli-0.1.2/src}/pyarch/generators/common/renderer.py +0 -1
  20. {pyarch_cli-0.1.0 → pyarch_cli-0.1.2/src}/pyarch/generators/integration/auth.py +2 -3
  21. {pyarch_cli-0.1.0 → pyarch_cli-0.1.2/src}/pyarch/generators/module/layered.py +16 -34
  22. {pyarch_cli-0.1.0 → pyarch_cli-0.1.2/src}/pyarch/generators/project/base.py +24 -10
  23. {pyarch_cli-0.1.0 → pyarch_cli-0.1.2/src}/pyarch/generators/project/layered.py +28 -36
  24. {pyarch_cli-0.1.0 → pyarch_cli-0.1.2/src}/pyarch/services/add_integration.py +1 -3
  25. {pyarch_cli-0.1.0 → pyarch_cli-0.1.2/src}/pyarch/services/create_module.py +1 -3
  26. {pyarch_cli-0.1.0 → pyarch_cli-0.1.2/src}/pyarch/services/create_project.py +18 -19
  27. {pyarch_cli-0.1.0 → pyarch_cli-0.1.2/src}/pyarch/templates/layered/auth/config.py.j2 +21 -15
  28. {pyarch_cli-0.1.0 → pyarch_cli-0.1.2/src}/pyarch/templates/layered/auth/routes.py.j2 +11 -12
  29. {pyarch_cli-0.1.0 → pyarch_cli-0.1.2/src}/pyarch/templates/layered/auth/service.py.j2 +12 -8
  30. pyarch_cli-0.1.2/src/pyarch/templates/layered/auth/test_auth.py.j2 +117 -0
  31. pyarch_cli-0.1.2/src/pyarch/templates/layered/auth/test_helpers.py.j2 +47 -0
  32. {pyarch_cli-0.1.0/pyarch/templates/layered/mongodb → pyarch_cli-0.1.2/src/pyarch/templates/layered}/config.py.j2 +8 -1
  33. pyarch_cli-0.1.2/src/pyarch/templates/layered/env.example.j2 +16 -0
  34. pyarch_cli-0.1.2/src/pyarch/templates/layered/errors.py.j2 +6 -0
  35. pyarch_cli-0.1.2/src/pyarch/templates/layered/exception_handlers.py.j2 +13 -0
  36. pyarch_cli-0.1.2/src/pyarch/templates/layered/module/module_repo.py.j2 +57 -0
  37. pyarch_cli-0.1.2/src/pyarch/templates/layered/module/module_router.py.j2 +60 -0
  38. pyarch_cli-0.1.2/src/pyarch/templates/layered/module/module_router_protected.py.j2 +74 -0
  39. {pyarch_cli-0.1.0 → pyarch_cli-0.1.2/src}/pyarch/templates/layered/module/module_schema.py.j2 +3 -10
  40. pyarch_cli-0.1.2/src/pyarch/templates/layered/module/module_service.py.j2 +67 -0
  41. pyarch_cli-0.1.2/src/pyarch/templates/layered/module/module_test.py.j2 +43 -0
  42. pyarch_cli-0.1.2/src/pyarch/templates/layered/module/module_test_protected.py.j2 +71 -0
  43. pyarch_cli-0.1.2/src/pyarch/templates/layered/pagination.py.j2 +22 -0
  44. pyarch_cli-0.1.2/src/pyarch/templates/project/base/Dockerfile.j2 +16 -0
  45. pyarch_cli-0.1.2/src/pyarch/templates/project/base/README.md.j2 +13 -0
  46. {pyarch_cli-0.1.0 → pyarch_cli-0.1.2/src}/pyarch/templates/project/base/conftest.py.j2 +15 -17
  47. pyarch_cli-0.1.2/src/pyarch/templates/project/base/docker-compose.yml.j2 +55 -0
  48. {pyarch_cli-0.1.0 → pyarch_cli-0.1.2/src}/pyarch/templates/project/base/main.py.j2 +9 -6
  49. {pyarch_cli-0.1.0 → pyarch_cli-0.1.2}/uv.lock +192 -1
  50. pyarch_cli-0.1.0/PKG-INFO +0 -378
  51. pyarch_cli-0.1.0/README.md +0 -352
  52. pyarch_cli-0.1.0/pyarch/__init__.py +0 -1
  53. pyarch_cli-0.1.0/pyarch/cli/app.py +0 -83
  54. pyarch_cli-0.1.0/pyarch/templates/layered/config.py.j2 +0 -14
  55. pyarch_cli-0.1.0/pyarch/templates/layered/env.example.j2 +0 -7
  56. pyarch_cli-0.1.0/pyarch/templates/layered/module/module_repo.py.j2 +0 -49
  57. pyarch_cli-0.1.0/pyarch/templates/layered/module/module_router.py.j2 +0 -87
  58. pyarch_cli-0.1.0/pyarch/templates/layered/module/module_router_protected.py.j2 +0 -97
  59. pyarch_cli-0.1.0/pyarch/templates/layered/module/module_service.py.j2 +0 -76
  60. pyarch_cli-0.1.0/pyarch/templates/layered/mongodb/conftest.py.j2 +0 -36
  61. pyarch_cli-0.1.0/pyarch/templates/layered/mongodb/env.example.j2 +0 -2
  62. pyarch_cli-0.1.0/pyarch/templates/layered/mongodb/module/module_model.py.j2 +0 -11
  63. pyarch_cli-0.1.0/pyarch/templates/layered/mongodb/module/module_repo.py.j2 +0 -99
  64. pyarch_cli-0.1.0/pyarch/templates/layered/mongodb/module/module_router.py.j2 +0 -97
  65. pyarch_cli-0.1.0/pyarch/templates/layered/mongodb/module/module_service.py.j2 +0 -69
  66. pyarch_cli-0.1.0/pyarch/templates/layered/mongodb/session.py.j2 +0 -14
  67. pyarch_cli-0.1.0/pyarch/templates/project/base/README.md.j2 +0 -22
  68. pyarch_cli-0.1.0/script_base.py +0 -355
  69. {pyarch_cli-0.1.0 → pyarch_cli-0.1.2}/.python-version +0 -0
  70. {pyarch_cli-0.1.0 → pyarch_cli-0.1.2}/LICENSE +0 -0
  71. {pyarch_cli-0.1.0 → pyarch_cli-0.1.2/src}/pyarch/cli/__init__.py +0 -0
  72. {pyarch_cli-0.1.0 → pyarch_cli-0.1.2/src}/pyarch/config/__init__.py +0 -0
  73. {pyarch_cli-0.1.0 → pyarch_cli-0.1.2/src}/pyarch/generators/__init__.py +0 -0
  74. {pyarch_cli-0.1.0 → pyarch_cli-0.1.2/src}/pyarch/generators/common/__init__.py +0 -0
  75. {pyarch_cli-0.1.0 → pyarch_cli-0.1.2/src}/pyarch/generators/common/commands.py +0 -0
  76. {pyarch_cli-0.1.0 → pyarch_cli-0.1.2/src}/pyarch/generators/common/filesystem.py +0 -0
  77. {pyarch_cli-0.1.0 → pyarch_cli-0.1.2/src}/pyarch/generators/integration/__init__.py +0 -0
  78. {pyarch_cli-0.1.0 → pyarch_cli-0.1.2/src}/pyarch/generators/module/__init__.py +0 -0
  79. {pyarch_cli-0.1.0 → pyarch_cli-0.1.2/src}/pyarch/generators/project/__init__.py +0 -0
  80. {pyarch_cli-0.1.0 → pyarch_cli-0.1.2/src}/pyarch/main.py +0 -0
  81. {pyarch_cli-0.1.0 → pyarch_cli-0.1.2/src}/pyarch/services/__init__.py +0 -0
  82. {pyarch_cli-0.1.0 → pyarch_cli-0.1.2/src}/pyarch/templates/layered/alembic_env.py.j2 +0 -0
  83. {pyarch_cli-0.1.0 → pyarch_cli-0.1.2/src}/pyarch/templates/layered/auth/dependencies.py.j2 +0 -0
  84. {pyarch_cli-0.1.0 → pyarch_cli-0.1.2/src}/pyarch/templates/layered/auth/refresh_session_model.py.j2 +0 -0
  85. {pyarch_cli-0.1.0 → pyarch_cli-0.1.2/src}/pyarch/templates/layered/auth/schemas.py.j2 +0 -0
  86. {pyarch_cli-0.1.0 → pyarch_cli-0.1.2/src}/pyarch/templates/layered/auth/tokens.py.j2 +0 -0
  87. {pyarch_cli-0.1.0 → pyarch_cli-0.1.2/src}/pyarch/templates/layered/auth/user_model.py.j2 +0 -0
  88. {pyarch_cli-0.1.0 → pyarch_cli-0.1.2/src}/pyarch/templates/layered/auth/utils.py.j2 +0 -0
  89. {pyarch_cli-0.1.0 → pyarch_cli-0.1.2/src}/pyarch/templates/layered/models_init.py.j2 +0 -0
  90. {pyarch_cli-0.1.0 → pyarch_cli-0.1.2/src}/pyarch/templates/layered/module/module_model.py.j2 +0 -0
  91. {pyarch_cli-0.1.0 → pyarch_cli-0.1.2/src}/pyarch/templates/layered/router.py.j2 +0 -0
  92. {pyarch_cli-0.1.0 → pyarch_cli-0.1.2/src}/pyarch/templates/layered/session.py.j2 +0 -0
@@ -5,7 +5,7 @@ build/
5
5
  dist/
6
6
  wheels/
7
7
  *.egg-info
8
+ *_cache
8
9
 
9
10
  # Virtual environments
10
11
  .venv
11
- after_script.txt
@@ -0,0 +1,271 @@
1
+ Metadata-Version: 2.4
2
+ Name: PyArch-CLI
3
+ Version: 0.1.2
4
+ Summary: Stateful CLI generator for Layered FastAPI projects
5
+ Project-URL: Homepage, https://github.com/Allcode-1/PyArch
6
+ Project-URL: Repository, https://github.com/Allcode-1/PyArch
7
+ Project-URL: Issues, https://github.com/Allcode-1/PyArch/issues
8
+ License-Expression: MIT
9
+ License-File: LICENSE
10
+ Keywords: cli,fastapi,generator,jinja2,sqlalchemy,typer
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Environment :: Console
13
+ Classifier: Framework :: FastAPI
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Topic :: Software Development :: Code Generators
19
+ Requires-Python: >=3.13
20
+ Requires-Dist: cryptography>=46.0.3
21
+ Requires-Dist: jinja2>=3.1.6
22
+ Requires-Dist: mypy>=2.3.0
23
+ Requires-Dist: rich>=15.0.0
24
+ Requires-Dist: ruff>=0.16.1
25
+ Requires-Dist: tomlkit>=0.15.0
26
+ Requires-Dist: typer>=0.24.2
27
+ Description-Content-Type: text/markdown
28
+
29
+ # PyArch
30
+
31
+ [![PyPI](https://img.shields.io/pypi/v/PyArch-CLI)](https://pypi.org/project/PyArch-CLI/)
32
+ ![Python](https://img.shields.io/badge/Python-3.13%2B-blue)
33
+ ![FastAPI](https://img.shields.io/badge/FastAPI-backend-green)
34
+ ![Typer](https://img.shields.io/badge/Typer-CLI-purple)
35
+ ![Jinja2](https://img.shields.io/badge/Jinja2-templates-orange)
36
+ ![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)
37
+ ![Status](https://img.shields.io/badge/status-MVP%2B-orange)
38
+
39
+ PyArch is a CLI for creating and extending Layered FastAPI projects. It sets up
40
+ the application structure, database, tests and Alembic, then lets you add CRUD
41
+ modules and integrations without wiring every file by hand.
42
+
43
+ Unlike a one-time project template, PyArch keeps a small manifest in the
44
+ generated project. Later commands use it to understand the project and update
45
+ the right files.
46
+
47
+ <p align="center">
48
+ <img src="./assets/pyarch-demo.gif" alt="PyArch CLI demo" width="900">
49
+ </p>
50
+
51
+ ## Why PyArch?
52
+
53
+ PyArch removes repetitive setup while keeping the generated code readable and
54
+ ready to change.
55
+
56
+ - Layered FastAPI project structure
57
+ - PostgreSQL and SQLite support
58
+ - Complete CRUD modules with models, schemas, repositories, services and routes
59
+ - Automatic model and router registration
60
+ - JWT auth integration with generated RSA keys
61
+ - Protected CRUD routes
62
+ - Alembic setup for relational databases
63
+ - Tests and dependency setup through `uv`
64
+ - Project-aware generation through `pyarch.toml`
65
+
66
+ ## Quick Start
67
+
68
+ PyArch requires Python 3.13 or newer and
69
+ [`uv`](https://docs.astral.sh/uv/).
70
+
71
+ Install the latest release from PyPI:
72
+
73
+ ```bash
74
+ pip install pyarch-cli
75
+ ```
76
+
77
+ Create a project and move into it:
78
+
79
+ ```bash
80
+ pyarch init my_project --database postgres
81
+ cd my_project
82
+ ```
83
+
84
+ Copy `.env.example` to `.env` and set the database connection values. Start the services with Docker Compose:
85
+
86
+ ```bash
87
+ docker compose up -d
88
+ ```
89
+
90
+ Open `http://127.0.0.1:8000/docs` to use the generated Swagger UI.
91
+
92
+ You can now extend the project:
93
+
94
+ ```bash
95
+ pyarch generate module users
96
+ pyarch add integration auth
97
+ pyarch generate module tasks --protected
98
+ pyarch info
99
+ ```
100
+
101
+ ## What Gets Generated
102
+
103
+ A new project includes the application layers, database configuration, test
104
+ setup and the files needed to run FastAPI:
105
+
106
+ ```text
107
+ my_project/
108
+ ├── app/
109
+ │ ├── api/v1/
110
+ │ ├── core/
111
+ │ ├── db/
112
+ │ ├── dependencies/
113
+ │ ├── models/
114
+ │ ├── repositories/
115
+ │ ├── schemas/
116
+ │ ├── services/
117
+ │ └── main.py
118
+ ├── tests/
119
+ ├── alembic/ # PostgreSQL and SQLite only
120
+ ├── .env.example
121
+ ├── pyarch.toml
122
+ └── pyproject.toml
123
+ ```
124
+
125
+ Each generated CRUD module adds:
126
+
127
+ - a database model;
128
+ - create, update and response schemas;
129
+ - repository and service classes;
130
+ - list, get, create, update and delete routes;
131
+ - CRUD tests;
132
+ - model and router registration in the existing application.
133
+
134
+ ## Commands
135
+
136
+ | Command | Description |
137
+ | ------------------------------------------- | ------------------------------------------------ |
138
+ | `pyarch init <name>` | Create a Layered FastAPI project |
139
+ | `pyarch init <name> --database <engine>` | Select PostgreSQL or SQLite |
140
+ | `pyarch generate module <name>` | Add a CRUD module to the current project |
141
+ | `pyarch add integration auth` | Add JWT authentication and user management |
142
+ | `pyarch generate module <name> --protected` | Generate CRUD routes that require authentication |
143
+ | `pyarch info` | Show the current project configuration |
144
+ | `pyarch --help` | Show CLI help |
145
+
146
+ Generation commands must be run inside a project created by PyArch.
147
+
148
+ ## Databases and Current Limitations
149
+
150
+ | Database | CRUD modules | Alembic | Auth integration | Protected modules |
151
+ | ---------- | ------------ | ------- | ---------------- | ----------------- |
152
+ | PostgreSQL | Yes | Yes | Yes | Yes |
153
+ | SQLite | Yes | Yes | Yes | Yes |
154
+
155
+ Current limitations:
156
+
157
+ - only Layered Architecture is supported;
158
+ - generated applications use synchronous database access;
159
+ - generated projects are starter scaffolds and still require
160
+ application-specific configuration and code;
161
+ - the manifest format may change before a stable release.
162
+
163
+ ## Project Manifest
164
+
165
+ Every generated project contains `pyarch.toml`. It records the selected
166
+ architecture and database, generated modules, enabled integrations and known
167
+ project paths.
168
+
169
+ Commands such as `generate module`, `add integration` and `info` read this file
170
+ instead of trying to infer project state from the directory structure. PyArch
171
+ updates the manifest after a successful generation step.
172
+
173
+ ## Development
174
+
175
+ Clone the repository and install the development environment:
176
+
177
+ ```bash
178
+ git clone https://github.com/Allcode-1/PyArch.git
179
+ cd PyArch
180
+ uv sync
181
+ ```
182
+
183
+ Run the CLI from the checkout:
184
+
185
+ ```bash
186
+ uv run pyarch --help
187
+ ```
188
+
189
+ Or install the current checkout as an editable CLI tool:
190
+
191
+ ```bash
192
+ uv tool install --editable .
193
+ ```
194
+
195
+ ## Architecture and Design
196
+
197
+ <details>
198
+ <summary>How PyArch is structured</summary>
199
+
200
+ ```text
201
+ Typer CLI
202
+ ↓
203
+ Application services
204
+ ↓
205
+ Generators
206
+ ↓
207
+ Jinja2 templates
208
+ ↓
209
+ Generated FastAPI project
210
+ ↑
211
+ pyarch.toml
212
+ ```
213
+
214
+ The CLI handles user input and delegates work to application services.
215
+ Generators render Jinja2 templates and update files at explicit registration
216
+ markers. The manifest provides the project context needed by later commands.
217
+
218
+ </details>
219
+
220
+ <details>
221
+ <summary>Why use a manifest?</summary>
222
+
223
+ Scanning the filesystem shows which files exist, but not which project choices
224
+ produced them. The manifest stores those choices directly, so later commands do
225
+ not have to guess the architecture, database or enabled features.
226
+
227
+ </details>
228
+
229
+ <details>
230
+ <summary>Why marker-based registration?</summary>
231
+
232
+ PyArch modifies files it generated itself. Explicit markers provide stable and
233
+ readable insertion points for model and router imports without requiring a full
234
+ AST rewriting pipeline.
235
+
236
+ </details>
237
+
238
+ <details>
239
+ <summary>Why Jinja2?</summary>
240
+
241
+ Templates stay close to the Python code users receive and can edit. Jinja2 is
242
+ used with `StrictUndefined`, so missing template context fails during generation
243
+ instead of producing incomplete files.
244
+
245
+ </details>
246
+
247
+ ## Roadmap
248
+
249
+ ### v0.2
250
+
251
+ - safer generation and validation;
252
+ - rollback on failed generation;
253
+ - Redis integration foundation.
254
+
255
+ ### v0.3
256
+
257
+ - Redis integration;
258
+ - scheduler integration;
259
+ - dry-run mode.
260
+
261
+ ### Later
262
+
263
+ - more architectures;
264
+ - plugin system;
265
+ - asynchronous database access.
266
+
267
+ ## Status
268
+
269
+ PyArch is in early development. The main workflow is usable, but commands,
270
+ templates, generated code and the manifest may still change before a stable
271
+ release.
@@ -0,0 +1,243 @@
1
+ # PyArch
2
+
3
+ [![PyPI](https://img.shields.io/pypi/v/PyArch-CLI)](https://pypi.org/project/PyArch-CLI/)
4
+ ![Python](https://img.shields.io/badge/Python-3.13%2B-blue)
5
+ ![FastAPI](https://img.shields.io/badge/FastAPI-backend-green)
6
+ ![Typer](https://img.shields.io/badge/Typer-CLI-purple)
7
+ ![Jinja2](https://img.shields.io/badge/Jinja2-templates-orange)
8
+ ![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)
9
+ ![Status](https://img.shields.io/badge/status-MVP%2B-orange)
10
+
11
+ PyArch is a CLI for creating and extending Layered FastAPI projects. It sets up
12
+ the application structure, database, tests and Alembic, then lets you add CRUD
13
+ modules and integrations without wiring every file by hand.
14
+
15
+ Unlike a one-time project template, PyArch keeps a small manifest in the
16
+ generated project. Later commands use it to understand the project and update
17
+ the right files.
18
+
19
+ <p align="center">
20
+ <img src="./assets/pyarch-demo.gif" alt="PyArch CLI demo" width="900">
21
+ </p>
22
+
23
+ ## Why PyArch?
24
+
25
+ PyArch removes repetitive setup while keeping the generated code readable and
26
+ ready to change.
27
+
28
+ - Layered FastAPI project structure
29
+ - PostgreSQL and SQLite support
30
+ - Complete CRUD modules with models, schemas, repositories, services and routes
31
+ - Automatic model and router registration
32
+ - JWT auth integration with generated RSA keys
33
+ - Protected CRUD routes
34
+ - Alembic setup for relational databases
35
+ - Tests and dependency setup through `uv`
36
+ - Project-aware generation through `pyarch.toml`
37
+
38
+ ## Quick Start
39
+
40
+ PyArch requires Python 3.13 or newer and
41
+ [`uv`](https://docs.astral.sh/uv/).
42
+
43
+ Install the latest release from PyPI:
44
+
45
+ ```bash
46
+ pip install pyarch-cli
47
+ ```
48
+
49
+ Create a project and move into it:
50
+
51
+ ```bash
52
+ pyarch init my_project --database postgres
53
+ cd my_project
54
+ ```
55
+
56
+ Copy `.env.example` to `.env` and set the database connection values. Start the services with Docker Compose:
57
+
58
+ ```bash
59
+ docker compose up -d
60
+ ```
61
+
62
+ Open `http://127.0.0.1:8000/docs` to use the generated Swagger UI.
63
+
64
+ You can now extend the project:
65
+
66
+ ```bash
67
+ pyarch generate module users
68
+ pyarch add integration auth
69
+ pyarch generate module tasks --protected
70
+ pyarch info
71
+ ```
72
+
73
+ ## What Gets Generated
74
+
75
+ A new project includes the application layers, database configuration, test
76
+ setup and the files needed to run FastAPI:
77
+
78
+ ```text
79
+ my_project/
80
+ ├── app/
81
+ │ ├── api/v1/
82
+ │ ├── core/
83
+ │ ├── db/
84
+ │ ├── dependencies/
85
+ │ ├── models/
86
+ │ ├── repositories/
87
+ │ ├── schemas/
88
+ │ ├── services/
89
+ │ └── main.py
90
+ ├── tests/
91
+ ├── alembic/ # PostgreSQL and SQLite only
92
+ ├── .env.example
93
+ ├── pyarch.toml
94
+ └── pyproject.toml
95
+ ```
96
+
97
+ Each generated CRUD module adds:
98
+
99
+ - a database model;
100
+ - create, update and response schemas;
101
+ - repository and service classes;
102
+ - list, get, create, update and delete routes;
103
+ - CRUD tests;
104
+ - model and router registration in the existing application.
105
+
106
+ ## Commands
107
+
108
+ | Command | Description |
109
+ | ------------------------------------------- | ------------------------------------------------ |
110
+ | `pyarch init <name>` | Create a Layered FastAPI project |
111
+ | `pyarch init <name> --database <engine>` | Select PostgreSQL or SQLite |
112
+ | `pyarch generate module <name>` | Add a CRUD module to the current project |
113
+ | `pyarch add integration auth` | Add JWT authentication and user management |
114
+ | `pyarch generate module <name> --protected` | Generate CRUD routes that require authentication |
115
+ | `pyarch info` | Show the current project configuration |
116
+ | `pyarch --help` | Show CLI help |
117
+
118
+ Generation commands must be run inside a project created by PyArch.
119
+
120
+ ## Databases and Current Limitations
121
+
122
+ | Database | CRUD modules | Alembic | Auth integration | Protected modules |
123
+ | ---------- | ------------ | ------- | ---------------- | ----------------- |
124
+ | PostgreSQL | Yes | Yes | Yes | Yes |
125
+ | SQLite | Yes | Yes | Yes | Yes |
126
+
127
+ Current limitations:
128
+
129
+ - only Layered Architecture is supported;
130
+ - generated applications use synchronous database access;
131
+ - generated projects are starter scaffolds and still require
132
+ application-specific configuration and code;
133
+ - the manifest format may change before a stable release.
134
+
135
+ ## Project Manifest
136
+
137
+ Every generated project contains `pyarch.toml`. It records the selected
138
+ architecture and database, generated modules, enabled integrations and known
139
+ project paths.
140
+
141
+ Commands such as `generate module`, `add integration` and `info` read this file
142
+ instead of trying to infer project state from the directory structure. PyArch
143
+ updates the manifest after a successful generation step.
144
+
145
+ ## Development
146
+
147
+ Clone the repository and install the development environment:
148
+
149
+ ```bash
150
+ git clone https://github.com/Allcode-1/PyArch.git
151
+ cd PyArch
152
+ uv sync
153
+ ```
154
+
155
+ Run the CLI from the checkout:
156
+
157
+ ```bash
158
+ uv run pyarch --help
159
+ ```
160
+
161
+ Or install the current checkout as an editable CLI tool:
162
+
163
+ ```bash
164
+ uv tool install --editable .
165
+ ```
166
+
167
+ ## Architecture and Design
168
+
169
+ <details>
170
+ <summary>How PyArch is structured</summary>
171
+
172
+ ```text
173
+ Typer CLI
174
+ ↓
175
+ Application services
176
+ ↓
177
+ Generators
178
+ ↓
179
+ Jinja2 templates
180
+ ↓
181
+ Generated FastAPI project
182
+ ↑
183
+ pyarch.toml
184
+ ```
185
+
186
+ The CLI handles user input and delegates work to application services.
187
+ Generators render Jinja2 templates and update files at explicit registration
188
+ markers. The manifest provides the project context needed by later commands.
189
+
190
+ </details>
191
+
192
+ <details>
193
+ <summary>Why use a manifest?</summary>
194
+
195
+ Scanning the filesystem shows which files exist, but not which project choices
196
+ produced them. The manifest stores those choices directly, so later commands do
197
+ not have to guess the architecture, database or enabled features.
198
+
199
+ </details>
200
+
201
+ <details>
202
+ <summary>Why marker-based registration?</summary>
203
+
204
+ PyArch modifies files it generated itself. Explicit markers provide stable and
205
+ readable insertion points for model and router imports without requiring a full
206
+ AST rewriting pipeline.
207
+
208
+ </details>
209
+
210
+ <details>
211
+ <summary>Why Jinja2?</summary>
212
+
213
+ Templates stay close to the Python code users receive and can edit. Jinja2 is
214
+ used with `StrictUndefined`, so missing template context fails during generation
215
+ instead of producing incomplete files.
216
+
217
+ </details>
218
+
219
+ ## Roadmap
220
+
221
+ ### v0.2
222
+
223
+ - safer generation and validation;
224
+ - rollback on failed generation;
225
+ - Redis integration foundation.
226
+
227
+ ### v0.3
228
+
229
+ - Redis integration;
230
+ - scheduler integration;
231
+ - dry-run mode.
232
+
233
+ ### Later
234
+
235
+ - more architectures;
236
+ - plugin system;
237
+ - asynchronous database access.
238
+
239
+ ## Status
240
+
241
+ PyArch is in early development. The main workflow is usable, but commands,
242
+ templates, generated code and the manifest may still change before a stable
243
+ release.
@@ -0,0 +1,11 @@
1
+ FROM ghcr.io/charmbracelet/vhs:latest
2
+
3
+ RUN apt-get update \
4
+ && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
5
+ python3-pip \
6
+ && python3 -m pip install --break-system-packages uv \
7
+ && mv /usr/local/bin/uv /usr/local/bin/uv-real \
8
+ && rm -rf /var/lib/apt/lists/*
9
+
10
+ COPY assets/vhs-uv /usr/local/bin/uv
11
+ RUN chmod +x /usr/local/bin/uv
Binary file
@@ -0,0 +1,37 @@
1
+ Output assets/pyarch-demo.gif
2
+
3
+ Set Shell "bash"
4
+ Set Width 1100
5
+ Set Height 650
6
+ Set FontSize 22
7
+ Set TypingSpeed 35ms
8
+ Set CursorBlink false
9
+ Set Theme { "name": "PyArch", "black": "#1e1e2e", "red": "#f38ba8", "green": "#a6e3a1", "yellow": "#f9e2af", "blue": "#89b4fa", "magenta": "#cba6f7", "cyan": "#94e2d5", "white": "#cdd6f4", "brightBlack": "#585b70", "brightRed": "#f38ba8", "brightGreen": "#a6e3a1", "brightYellow": "#f9e2af", "brightBlue": "#89b4fa", "brightMagenta": "#cba6f7", "brightCyan": "#94e2d5", "brightWhite": "#ffffff", "background": "#1e1e2e", "foreground": "#cdd6f4" }
10
+
11
+ Hide
12
+ Type "rm -rf pyarch_vhs_demo"
13
+ Enter
14
+ Type "clear"
15
+ Enter
16
+ Show
17
+
18
+ Type "pyarch init pyarch_vhs_demo --database sqlite"
19
+ Enter
20
+ Hide
21
+ Wait+Screen@5m /Project created:/
22
+ Show
23
+ Sleep 2s
24
+
25
+ Type "cd pyarch_vhs_demo"
26
+ Enter
27
+ Sleep 1s
28
+
29
+ Type "pyarch generate module users"
30
+ Enter
31
+ Wait+Screen@2m /Created module/
32
+ Sleep 2s
33
+
34
+ Type "pyarch info"
35
+ Enter
36
+ Wait+Screen@1m /PyArch project/
37
+ Sleep 4s
@@ -0,0 +1,17 @@
1
+ #!/bin/sh
2
+
3
+ if [ "$1" = "init" ]; then
4
+ exec /usr/local/bin/uv-real "$@" --no-workspace
5
+ fi
6
+
7
+ if [ "$1" = "add" ]; then
8
+ exit 0
9
+ fi
10
+
11
+ if [ "$1" = "run" ] && [ "$2" = "alembic" ] && [ "$3" = "init" ]; then
12
+ mkdir -p "$4"
13
+ touch "$4/env.py"
14
+ exit 0
15
+ fi
16
+
17
+ exec /usr/local/bin/uv-real "$@"
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "PyArch-CLI"
3
- version = "0.1.0"
3
+ version = "0.1.2"
4
4
  description = "Stateful CLI generator for Layered FastAPI projects"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.13"
@@ -18,24 +18,29 @@ classifiers = [
18
18
  "Topic :: Software Development :: Code Generators",
19
19
  ]
20
20
  dependencies = [
21
- "cryptography>=46.0.3",
22
- "jinja2>=3.1.6",
23
- "rich>=15.0.0",
24
- "tomlkit>=0.15.0",
25
- "typer>=0.24.2",
26
- ]
27
-
21
+ "cryptography>=46.0.3",
22
+ "jinja2>=3.1.6",
23
+ "mypy>=2.3.0",
24
+ "rich>=15.0.0",
25
+ "ruff>=0.16.1",
26
+ "tomlkit>=0.15.0",
27
+ "typer>=0.24.2",
28
+ ]
29
+
28
30
  [project.scripts]
29
31
  pyarch = "pyarch.cli.app:app"
30
32
 
31
33
  [project.urls]
32
- Homepage = "https://github.com/Allcode-1/fastapi-skeleton-generator"
33
- Repository = "https://github.com/Allcode-1/fastapi-skeleton-generator"
34
- Issues = "https://github.com/Allcode-1/fastapi-skeleton-generator/issues"
35
-
36
- [build-system]
37
- requires = ["hatchling"]
38
- build-backend = "hatchling.build"
39
-
40
- [tool.hatch.build.targets.wheel]
41
- packages = ["pyarch"]
34
+ Homepage = "https://github.com/Allcode-1/PyArch"
35
+ Repository = "https://github.com/Allcode-1/PyArch"
36
+ Issues = "https://github.com/Allcode-1/PyArch/issues"
37
+
38
+ [build-system]
39
+ requires = ["hatchling"]
40
+ build-backend = "hatchling.build"
41
+
42
+ [tool.hatch.build.targets.wheel]
43
+ packages = ["src/pyarch"]
44
+
45
+ [dependency-groups]
46
+ dev = []
@@ -0,0 +1 @@
1
+ __version__ = "0.1.2"
@@ -5,7 +5,6 @@ import typer
5
5
  from pyarch.cli.common import console, execute_or_exit
6
6
  from pyarch.services.add_integration import add_integration
7
7
 
8
-
9
8
  app = typer.Typer(no_args_is_help=True)
10
9
 
11
10
 
@@ -18,7 +17,9 @@ def add_integration_command(
18
17
  ) -> None:
19
18
  """Add a supported integration to the current project."""
20
19
 
21
- project_root, created_files = execute_or_exit(lambda: add_integration(integration_name))
20
+ project_root, created_files = execute_or_exit(
21
+ lambda: add_integration(integration_name)
22
+ )
22
23
  console.print(
23
24
  f"[green]Added integration[/green] [bold]{integration_name}[/bold]"
24
25
  f" in {project_root}"
@@ -0,0 +1,29 @@
1
+ import typer
2
+
3
+ from pyarch.cli.add import app as add_app
4
+ from pyarch.cli.generate import app as generate_app
5
+ from pyarch.cli.info import show_info
6
+ from pyarch.cli.init import init_project
7
+
8
+ app = typer.Typer(
9
+ name="pyarch",
10
+ help="Generate and extend Layered FastAPI projects.",
11
+ no_args_is_help=True,
12
+ )
13
+
14
+ app.command("init", help="Create a new Layered FastAPI project.")(init_project)
15
+ app.command("info", help="Show information from the current project's manifest.")(
16
+ show_info
17
+ )
18
+
19
+ app.add_typer(
20
+ generate_app,
21
+ name="generate",
22
+ help="Generate project components.",
23
+ )
24
+
25
+ app.add_typer(
26
+ add_app,
27
+ name="add",
28
+ help="Add project integrations.",
29
+ )