aipostify 1.0.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.
Potentially problematic release.
This version of aipostify might be problematic. Click here for more details.
- aipostify-1.0.0/.env.example +23 -0
- aipostify-1.0.0/LICENSE +21 -0
- aipostify-1.0.0/MANIFEST.in +20 -0
- aipostify-1.0.0/PKG-INFO +162 -0
- aipostify-1.0.0/README.md +124 -0
- aipostify-1.0.0/aipostify/__init__.py +22 -0
- aipostify-1.0.0/aipostify/cli.py +165 -0
- aipostify-1.0.0/aipostify.egg-info/PKG-INFO +162 -0
- aipostify-1.0.0/aipostify.egg-info/SOURCES.txt +128 -0
- aipostify-1.0.0/aipostify.egg-info/dependency_links.txt +1 -0
- aipostify-1.0.0/aipostify.egg-info/entry_points.txt +4 -0
- aipostify-1.0.0/aipostify.egg-info/requires.txt +10 -0
- aipostify-1.0.0/aipostify.egg-info/top_level.txt +2 -0
- aipostify-1.0.0/artisan +22 -0
- aipostify-1.0.0/database/migrations/0001_initial.py +29 -0
- aipostify-1.0.0/database/migrations/__init__.py +1 -0
- aipostify-1.0.0/framework/__init__.py +10 -0
- aipostify-1.0.0/framework/apps.py +6 -0
- aipostify-1.0.0/framework/auto_discovery.py +46 -0
- aipostify-1.0.0/framework/console/__init__.py +4 -0
- aipostify-1.0.0/framework/console/artisan.py +213 -0
- aipostify-1.0.0/framework/console/command.py +59 -0
- aipostify-1.0.0/framework/console/commands/cache_clear.py +35 -0
- aipostify-1.0.0/framework/console/commands/config_cache.py +36 -0
- aipostify-1.0.0/framework/console/commands/db_check.py +61 -0
- aipostify-1.0.0/framework/console/commands/db_create.py +36 -0
- aipostify-1.0.0/framework/console/commands/db_seed.py +34 -0
- aipostify-1.0.0/framework/console/commands/db_show.py +52 -0
- aipostify-1.0.0/framework/console/commands/db_transfer.py +37 -0
- aipostify-1.0.0/framework/console/commands/key_generate.py +36 -0
- aipostify-1.0.0/framework/console/commands/make_auth.py +268 -0
- aipostify-1.0.0/framework/console/commands/make_command.py +45 -0
- aipostify-1.0.0/framework/console/commands/make_component.py +39 -0
- aipostify-1.0.0/framework/console/commands/make_controller.py +77 -0
- aipostify-1.0.0/framework/console/commands/make_crud.py +236 -0
- aipostify-1.0.0/framework/console/commands/make_job.py +42 -0
- aipostify-1.0.0/framework/console/commands/make_layout.py +38 -0
- aipostify-1.0.0/framework/console/commands/make_middleware.py +39 -0
- aipostify-1.0.0/framework/console/commands/make_migration.py +32 -0
- aipostify-1.0.0/framework/console/commands/make_model.py +57 -0
- aipostify-1.0.0/framework/console/commands/make_request.py +39 -0
- aipostify-1.0.0/framework/console/commands/make_seeder.py +42 -0
- aipostify-1.0.0/framework/console/commands/make_service.py +39 -0
- aipostify-1.0.0/framework/console/commands/make_view.py +42 -0
- aipostify-1.0.0/framework/console/commands/migrate.py +30 -0
- aipostify-1.0.0/framework/console/commands/migrate_fresh.py +48 -0
- aipostify-1.0.0/framework/console/commands/migrate_refresh.py +19 -0
- aipostify-1.0.0/framework/console/commands/migrate_rollback.py +20 -0
- aipostify-1.0.0/framework/console/commands/migrate_status.py +33 -0
- aipostify-1.0.0/framework/console/commands/ptl_format.py +146 -0
- aipostify-1.0.0/framework/console/commands/ptl_install_vscode.py +106 -0
- aipostify-1.0.0/framework/console/commands/pypi_publish.py +93 -0
- aipostify-1.0.0/framework/console/commands/queue_work.py +38 -0
- aipostify-1.0.0/framework/console/commands/route_list.py +38 -0
- aipostify-1.0.0/framework/console/commands/schedule_run.py +38 -0
- aipostify-1.0.0/framework/console/commands/serve.py +39 -0
- aipostify-1.0.0/framework/console/commands/storage_link.py +41 -0
- aipostify-1.0.0/framework/console/commands/test_command.py +20 -0
- aipostify-1.0.0/framework/console/commands/tinker.py +48 -0
- aipostify-1.0.0/framework/console/commands/view_cache.py +33 -0
- aipostify-1.0.0/framework/console/commands/view_check.py +26 -0
- aipostify-1.0.0/framework/console/commands/view_clear.py +16 -0
- aipostify-1.0.0/framework/database/__init__.py +13 -0
- aipostify-1.0.0/framework/database/connector.py +90 -0
- aipostify-1.0.0/framework/database/fields.py +51 -0
- aipostify-1.0.0/framework/database/model.py +93 -0
- aipostify-1.0.0/framework/database/seeder.py +20 -0
- aipostify-1.0.0/framework/http/__init__.py +17 -0
- aipostify-1.0.0/framework/http/controller.py +39 -0
- aipostify-1.0.0/framework/http/middleware.py +50 -0
- aipostify-1.0.0/framework/http/request.py +61 -0
- aipostify-1.0.0/framework/http/response.py +76 -0
- aipostify-1.0.0/framework/http/validator.py +253 -0
- aipostify-1.0.0/framework/kernel.py +71 -0
- aipostify-1.0.0/framework/queue/__init__.py +3 -0
- aipostify-1.0.0/framework/queue/queue.py +111 -0
- aipostify-1.0.0/framework/routing/__init__.py +4 -0
- aipostify-1.0.0/framework/routing/resolver.py +149 -0
- aipostify-1.0.0/framework/routing/route.py +172 -0
- aipostify-1.0.0/framework/routing/templatetags/__init__.py +1 -0
- aipostify-1.0.0/framework/routing/templatetags/aipostify.py +69 -0
- aipostify-1.0.0/framework/routing/urls.py +45 -0
- aipostify-1.0.0/framework/schedule/__init__.py +3 -0
- aipostify-1.0.0/framework/schedule/schedule.py +101 -0
- aipostify-1.0.0/framework/settings.py +139 -0
- aipostify-1.0.0/framework/stubs/command.stub +8 -0
- aipostify-1.0.0/framework/stubs/component.stub +4 -0
- aipostify-1.0.0/framework/stubs/controller.resource.stub +40 -0
- aipostify-1.0.0/framework/stubs/controller.stub +5 -0
- aipostify-1.0.0/framework/stubs/job.stub +12 -0
- aipostify-1.0.0/framework/stubs/layout.stub +15 -0
- aipostify-1.0.0/framework/stubs/middleware.stub +7 -0
- aipostify-1.0.0/framework/stubs/model.stub +10 -0
- aipostify-1.0.0/framework/stubs/request.stub +12 -0
- aipostify-1.0.0/framework/stubs/seeder.stub +6 -0
- aipostify-1.0.0/framework/stubs/service.stub +5 -0
- aipostify-1.0.0/framework/stubs/view.stub +10 -0
- aipostify-1.0.0/framework/view/__init__.py +28 -0
- aipostify-1.0.0/framework/view/compiler.py +738 -0
- aipostify-1.0.0/framework/view/engine.py +403 -0
- aipostify-1.0.0/framework/view/exceptions.py +35 -0
- aipostify-1.0.0/framework/view/filters.py +145 -0
- aipostify-1.0.0/framework/view/formatter.py +222 -0
- aipostify-1.0.0/framework/view/helpers.py +114 -0
- aipostify-1.0.0/framework/view/sandbox.py +136 -0
- aipostify-1.0.0/pyproject.toml +74 -0
- aipostify-1.0.0/pytest.ini +3 -0
- aipostify-1.0.0/requirements.txt +6 -0
- aipostify-1.0.0/resources/views/components/alert.ptl +8 -0
- aipostify-1.0.0/resources/views/layouts/app.ptl +57 -0
- aipostify-1.0.0/resources/views/welcome.ptl +708 -0
- aipostify-1.0.0/setup.cfg +4 -0
- aipostify-1.0.0/setup.py +11 -0
- aipostify-1.0.0/tests/test_artisan.py +32 -0
- aipostify-1.0.0/tests/test_models.py +25 -0
- aipostify-1.0.0/tests/test_p0_fixes_regression.py +469 -0
- aipostify-1.0.0/tests/test_ptl.py +243 -0
- aipostify-1.0.0/tests/test_ptl_formatter.py +91 -0
- aipostify-1.0.0/tests/test_ptl_intellisense.py +91 -0
- aipostify-1.0.0/tests/test_pypi_package.py +50 -0
- aipostify-1.0.0/tests/test_routing.py +18 -0
- aipostify-1.0.0/tests/test_validator.py +29 -0
- aipostify-1.0.0/tools/vscode-postify/README.md +46 -0
- aipostify-1.0.0/tools/vscode-postify/extension.js +1171 -0
- aipostify-1.0.0/tools/vscode-postify/icons/icon-theme.json +13 -0
- aipostify-1.0.0/tools/vscode-postify/icons/ptl.svg +18 -0
- aipostify-1.0.0/tools/vscode-postify/language-configuration.json +26 -0
- aipostify-1.0.0/tools/vscode-postify/package.json +78 -0
- aipostify-1.0.0/tools/vscode-postify/snippets/postify.code-snippets +314 -0
- aipostify-1.0.0/tools/vscode-postify/syntaxes/postify.tmLanguage.json +54 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
APP_NAME=aipostify
|
|
2
|
+
APP_ENV=local
|
|
3
|
+
APP_DEBUG=true
|
|
4
|
+
APP_KEY=
|
|
5
|
+
APP_URL=http://127.0.0.1:8000
|
|
6
|
+
APP_LOCALE=en
|
|
7
|
+
|
|
8
|
+
# Database Connection: sqlite | mysql
|
|
9
|
+
DB_CONNECTION=sqlite
|
|
10
|
+
|
|
11
|
+
# --- SQLite (default) ---
|
|
12
|
+
DB_SQLITE_PATH=database/database.sqlite
|
|
13
|
+
|
|
14
|
+
# --- MySQL (Set DB_CONNECTION=mysql to use) ---
|
|
15
|
+
DB_HOST=127.0.0.1
|
|
16
|
+
DB_PORT=3306
|
|
17
|
+
DB_DATABASE=aipostify
|
|
18
|
+
DB_USERNAME=root
|
|
19
|
+
DB_PASSWORD=
|
|
20
|
+
|
|
21
|
+
QUEUE_CONNECTION=database
|
|
22
|
+
CACHE_DRIVER=file
|
|
23
|
+
SESSION_DRIVER=file
|
aipostify-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 AIPostify Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
include LICENSE
|
|
2
|
+
include README.md
|
|
3
|
+
include requirements.txt
|
|
4
|
+
include pyproject.toml
|
|
5
|
+
include setup.py
|
|
6
|
+
include artisan
|
|
7
|
+
include .env.example
|
|
8
|
+
include pytest.ini
|
|
9
|
+
|
|
10
|
+
recursive-include framework/stubs *.stub
|
|
11
|
+
recursive-include framework/routing/templatetags *.py
|
|
12
|
+
recursive-include tools/vscode-postify *
|
|
13
|
+
recursive-include aipostify *
|
|
14
|
+
recursive-include resources/views *.ptl
|
|
15
|
+
recursive-include database/migrations *.py
|
|
16
|
+
|
|
17
|
+
global-exclude __pycache__
|
|
18
|
+
global-exclude *.py[cod]
|
|
19
|
+
global-exclude *.sqlite
|
|
20
|
+
global-exclude .DS_Store
|
aipostify-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: aipostify
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Laravel-Style Python MVC Framework with PTL (Postify Template Language)
|
|
5
|
+
Author: AIPostify Contributors
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/aipostify/aipostify
|
|
8
|
+
Project-URL: Documentation, https://github.com/aipostify/aipostify#readme
|
|
9
|
+
Project-URL: Repository, https://github.com/aipostify/aipostify.git
|
|
10
|
+
Project-URL: Issues, https://github.com/aipostify/aipostify/issues
|
|
11
|
+
Keywords: laravel,python,mvc,django,ptl,blade,artisan,template-engine,web-framework
|
|
12
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Topic :: Software Development :: Build Tools
|
|
15
|
+
Classifier: Topic :: Internet :: WWW/HTTP
|
|
16
|
+
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
|
|
17
|
+
Classifier: Topic :: Internet :: WWW/HTTP :: WSGI
|
|
18
|
+
Classifier: Framework :: Django
|
|
19
|
+
Classifier: Programming Language :: Python :: 3
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
+
Classifier: Operating System :: OS Independent
|
|
24
|
+
Classifier: Environment :: Web Environment
|
|
25
|
+
Requires-Python: >=3.10
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
License-File: LICENSE
|
|
28
|
+
Requires-Dist: Django<6.2,>=5.0
|
|
29
|
+
Requires-Dist: PyMySQL>=1.1.0
|
|
30
|
+
Requires-Dist: python-dotenv>=1.0.0
|
|
31
|
+
Requires-Dist: rich>=13.0.0
|
|
32
|
+
Requires-Dist: requests>=2.31.0
|
|
33
|
+
Provides-Extra: dev
|
|
34
|
+
Requires-Dist: pytest>=8.0.0; extra == "dev"
|
|
35
|
+
Requires-Dist: build>=1.0.0; extra == "dev"
|
|
36
|
+
Requires-Dist: twine>=5.0.0; extra == "dev"
|
|
37
|
+
Dynamic: license-file
|
|
38
|
+
|
|
39
|
+
# AIPostify – Laravel-Style Python MVC Framework
|
|
40
|
+
|
|
41
|
+
> Brings the elegant, productive developer experience of **Laravel** (`artisan`, `.env`, `routes/web.py`, Controllers, Models, Migrations, Seeders) to **Python and Django**, powered by **PTL (Postify Template Language)**.
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## 🚀 Key Features
|
|
46
|
+
|
|
47
|
+
- **PTL (Postify Template Language):** Native `.ptl` view engine with Blade-like `@if`, `@foreach`, `@extends`, `<x-components>`, pipe filters (`| upper`), and auto-escaped security.
|
|
48
|
+
- **Zero Django Boilerplate:** Never edit `settings.py`, `INSTALLED_APPS`, or `urls.py`. Core configuration is completely abstracted.
|
|
49
|
+
- **Artisan CLI Engine:** Run `python artisan make:...`, `python artisan migrate`, `python artisan db:...`, and `python artisan serve`.
|
|
50
|
+
- **Instant SQLite ↔ MySQL Switching:** Switch databases effortlessly by changing `DB_CONNECTION=sqlite` to `DB_CONNECTION=mysql` in `.env`.
|
|
51
|
+
- **Docker-Free & Dependency-Light:** Runs locally on SQLite with zero external services required.
|
|
52
|
+
- **Auto-Discovery Engine:** Automatically scans and connects models in `app/models/`, controllers in `app/http/controllers/`, commands in `app/console/commands/`, and views in `resources/views/`.
|
|
53
|
+
- **Database Queue & Task Scheduler:** Integrated database queue worker (`python artisan queue:work`) and cron task runner (`python artisan schedule:run`).
|
|
54
|
+
- **Automatic VS Code Tooling:** Automatic syntax highlighting, `{ P }` file icon, and snippet setup on first run/clone.
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## 📁 Directory Structure
|
|
59
|
+
|
|
60
|
+
```text
|
|
61
|
+
aipostify/
|
|
62
|
+
├── artisan # CLI entry point (python artisan ...)
|
|
63
|
+
├── .env # Environment configuration
|
|
64
|
+
├── .env.example
|
|
65
|
+
├── .gitattributes # GitHub language syntax detection
|
|
66
|
+
├── .vscode/ # VS Code settings & extensions
|
|
67
|
+
├── requirements.txt
|
|
68
|
+
├── app/ # User Application Code
|
|
69
|
+
│ ├── http/
|
|
70
|
+
│ │ ├── controllers/ # Controller, WelcomeController
|
|
71
|
+
│ │ ├── middleware/ # Custom HTTP Middlewares
|
|
72
|
+
│ │ └── requests/ # Form validation classes
|
|
73
|
+
│ ├── models/ # User model
|
|
74
|
+
│ ├── services/ # Application services
|
|
75
|
+
│ ├── jobs/ # Queueable background jobs
|
|
76
|
+
│ └── console/commands/ # Custom Artisan CLI commands
|
|
77
|
+
├── config/ # app.py, database.py, queue.py, mail.py
|
|
78
|
+
├── database/
|
|
79
|
+
│ ├── migrations/ # Database migrations (0001_initial.py)
|
|
80
|
+
│ ├── seeders/ # DatabaseSeeder, UserSeeder
|
|
81
|
+
│ └── database.sqlite # Default SQLite database file
|
|
82
|
+
├── resources/
|
|
83
|
+
│ ├── views/ # PTL Templates (.ptl)
|
|
84
|
+
│ │ ├── components/ # Reusable <x-component> templates
|
|
85
|
+
│ │ ├── layouts/app.ptl # Base layout template
|
|
86
|
+
│ │ └── welcome.ptl # Welcome landing page
|
|
87
|
+
│ └── lang/ # en.json, gu.json, hi.json
|
|
88
|
+
├── routes/
|
|
89
|
+
│ ├── web.py # Web routes (Route.get, Route.resource)
|
|
90
|
+
│ ├── api.py # API routes (prefixed with /api)
|
|
91
|
+
│ └── console.py # Scheduled tasks
|
|
92
|
+
├── public/ # Static assets (css, js)
|
|
93
|
+
├── storage/ # App logs, sessions, and view cache
|
|
94
|
+
├── tools/
|
|
95
|
+
│ └── vscode-postify/ # PTL VS Code Extension (Icon + Grammar)
|
|
96
|
+
└── tests/ # Pytest test suite
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## ⚡ Quick Start
|
|
102
|
+
|
|
103
|
+
### 1. Installation
|
|
104
|
+
```bash
|
|
105
|
+
# Clone the repository
|
|
106
|
+
git clone <repo-url> myapp && cd myapp
|
|
107
|
+
|
|
108
|
+
# Install dependencies
|
|
109
|
+
pip install -r requirements.txt
|
|
110
|
+
|
|
111
|
+
# Setup environment key and database
|
|
112
|
+
cp .env.example .env
|
|
113
|
+
python artisan key:generate
|
|
114
|
+
python artisan migrate
|
|
115
|
+
python artisan db:seed
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### 2. Start Development Server
|
|
119
|
+
```bash
|
|
120
|
+
python artisan serve
|
|
121
|
+
```
|
|
122
|
+
Open [http://127.0.0.1:8000](http://127.0.0.1:8000) in your browser.
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
## 🛠️ Artisan CLI Commands
|
|
127
|
+
|
|
128
|
+
| Command | Description |
|
|
129
|
+
|---|---|
|
|
130
|
+
| `python artisan list` | Display all available commands |
|
|
131
|
+
| `python artisan serve [--host --port]` | Start development server with live reload |
|
|
132
|
+
| `python artisan route:list` | Show all registered routes in a formatted table |
|
|
133
|
+
| `python artisan make:view <name>` | Generate new `.ptl` template view |
|
|
134
|
+
| `python artisan make:component <name>`| Generate new `.ptl` component |
|
|
135
|
+
| `python artisan make:layout <name>` | Generate new `.ptl` layout |
|
|
136
|
+
| `python artisan view:cache` | Compile and cache all PTL templates |
|
|
137
|
+
| `python artisan view:clear` | Clear compiled template cache |
|
|
138
|
+
| `python artisan view:check` | Validate syntax of all PTL templates |
|
|
139
|
+
| `python artisan ptl:install-vscode` | Install PTL VS Code extension (Icon + Grammar) |
|
|
140
|
+
| `python artisan make:model <Model>` | Create new Eloquent-style model |
|
|
141
|
+
| `python artisan make:controller <Name>`| Create standard or resource controller |
|
|
142
|
+
| `python artisan make:crud <Model>` | Scaffold full CRUD resource in 1 command |
|
|
143
|
+
| `python artisan make:migration <name>` | Generate database migration |
|
|
144
|
+
| `python artisan make:auth` | Scaffold complete authentication system |
|
|
145
|
+
| `python artisan migrate` | Run pending database migrations |
|
|
146
|
+
| `python artisan migrate:fresh [--seed]` | Drop all tables and re-run all migrations |
|
|
147
|
+
| `python artisan db:check` | Diagnose database connection and health |
|
|
148
|
+
| `python artisan db:seed` | Run seeders |
|
|
149
|
+
| `python artisan queue:work` | Start background queue worker daemon |
|
|
150
|
+
| `python artisan schedule:run` | Execute scheduled cron tasks |
|
|
151
|
+
| `python artisan tinker` | Interactive Python REPL with models preloaded |
|
|
152
|
+
| `python artisan test` | Run pytest test suite |
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
## 🧪 Running Tests
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
python artisan test
|
|
160
|
+
# or
|
|
161
|
+
pytest
|
|
162
|
+
```
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
# AIPostify – Laravel-Style Python MVC Framework
|
|
2
|
+
|
|
3
|
+
> Brings the elegant, productive developer experience of **Laravel** (`artisan`, `.env`, `routes/web.py`, Controllers, Models, Migrations, Seeders) to **Python and Django**, powered by **PTL (Postify Template Language)**.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 🚀 Key Features
|
|
8
|
+
|
|
9
|
+
- **PTL (Postify Template Language):** Native `.ptl` view engine with Blade-like `@if`, `@foreach`, `@extends`, `<x-components>`, pipe filters (`| upper`), and auto-escaped security.
|
|
10
|
+
- **Zero Django Boilerplate:** Never edit `settings.py`, `INSTALLED_APPS`, or `urls.py`. Core configuration is completely abstracted.
|
|
11
|
+
- **Artisan CLI Engine:** Run `python artisan make:...`, `python artisan migrate`, `python artisan db:...`, and `python artisan serve`.
|
|
12
|
+
- **Instant SQLite ↔ MySQL Switching:** Switch databases effortlessly by changing `DB_CONNECTION=sqlite` to `DB_CONNECTION=mysql` in `.env`.
|
|
13
|
+
- **Docker-Free & Dependency-Light:** Runs locally on SQLite with zero external services required.
|
|
14
|
+
- **Auto-Discovery Engine:** Automatically scans and connects models in `app/models/`, controllers in `app/http/controllers/`, commands in `app/console/commands/`, and views in `resources/views/`.
|
|
15
|
+
- **Database Queue & Task Scheduler:** Integrated database queue worker (`python artisan queue:work`) and cron task runner (`python artisan schedule:run`).
|
|
16
|
+
- **Automatic VS Code Tooling:** Automatic syntax highlighting, `{ P }` file icon, and snippet setup on first run/clone.
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## 📁 Directory Structure
|
|
21
|
+
|
|
22
|
+
```text
|
|
23
|
+
aipostify/
|
|
24
|
+
├── artisan # CLI entry point (python artisan ...)
|
|
25
|
+
├── .env # Environment configuration
|
|
26
|
+
├── .env.example
|
|
27
|
+
├── .gitattributes # GitHub language syntax detection
|
|
28
|
+
├── .vscode/ # VS Code settings & extensions
|
|
29
|
+
├── requirements.txt
|
|
30
|
+
├── app/ # User Application Code
|
|
31
|
+
│ ├── http/
|
|
32
|
+
│ │ ├── controllers/ # Controller, WelcomeController
|
|
33
|
+
│ │ ├── middleware/ # Custom HTTP Middlewares
|
|
34
|
+
│ │ └── requests/ # Form validation classes
|
|
35
|
+
│ ├── models/ # User model
|
|
36
|
+
│ ├── services/ # Application services
|
|
37
|
+
│ ├── jobs/ # Queueable background jobs
|
|
38
|
+
│ └── console/commands/ # Custom Artisan CLI commands
|
|
39
|
+
├── config/ # app.py, database.py, queue.py, mail.py
|
|
40
|
+
├── database/
|
|
41
|
+
│ ├── migrations/ # Database migrations (0001_initial.py)
|
|
42
|
+
│ ├── seeders/ # DatabaseSeeder, UserSeeder
|
|
43
|
+
│ └── database.sqlite # Default SQLite database file
|
|
44
|
+
├── resources/
|
|
45
|
+
│ ├── views/ # PTL Templates (.ptl)
|
|
46
|
+
│ │ ├── components/ # Reusable <x-component> templates
|
|
47
|
+
│ │ ├── layouts/app.ptl # Base layout template
|
|
48
|
+
│ │ └── welcome.ptl # Welcome landing page
|
|
49
|
+
│ └── lang/ # en.json, gu.json, hi.json
|
|
50
|
+
├── routes/
|
|
51
|
+
│ ├── web.py # Web routes (Route.get, Route.resource)
|
|
52
|
+
│ ├── api.py # API routes (prefixed with /api)
|
|
53
|
+
│ └── console.py # Scheduled tasks
|
|
54
|
+
├── public/ # Static assets (css, js)
|
|
55
|
+
├── storage/ # App logs, sessions, and view cache
|
|
56
|
+
├── tools/
|
|
57
|
+
│ └── vscode-postify/ # PTL VS Code Extension (Icon + Grammar)
|
|
58
|
+
└── tests/ # Pytest test suite
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## ⚡ Quick Start
|
|
64
|
+
|
|
65
|
+
### 1. Installation
|
|
66
|
+
```bash
|
|
67
|
+
# Clone the repository
|
|
68
|
+
git clone <repo-url> myapp && cd myapp
|
|
69
|
+
|
|
70
|
+
# Install dependencies
|
|
71
|
+
pip install -r requirements.txt
|
|
72
|
+
|
|
73
|
+
# Setup environment key and database
|
|
74
|
+
cp .env.example .env
|
|
75
|
+
python artisan key:generate
|
|
76
|
+
python artisan migrate
|
|
77
|
+
python artisan db:seed
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### 2. Start Development Server
|
|
81
|
+
```bash
|
|
82
|
+
python artisan serve
|
|
83
|
+
```
|
|
84
|
+
Open [http://127.0.0.1:8000](http://127.0.0.1:8000) in your browser.
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## 🛠️ Artisan CLI Commands
|
|
89
|
+
|
|
90
|
+
| Command | Description |
|
|
91
|
+
|---|---|
|
|
92
|
+
| `python artisan list` | Display all available commands |
|
|
93
|
+
| `python artisan serve [--host --port]` | Start development server with live reload |
|
|
94
|
+
| `python artisan route:list` | Show all registered routes in a formatted table |
|
|
95
|
+
| `python artisan make:view <name>` | Generate new `.ptl` template view |
|
|
96
|
+
| `python artisan make:component <name>`| Generate new `.ptl` component |
|
|
97
|
+
| `python artisan make:layout <name>` | Generate new `.ptl` layout |
|
|
98
|
+
| `python artisan view:cache` | Compile and cache all PTL templates |
|
|
99
|
+
| `python artisan view:clear` | Clear compiled template cache |
|
|
100
|
+
| `python artisan view:check` | Validate syntax of all PTL templates |
|
|
101
|
+
| `python artisan ptl:install-vscode` | Install PTL VS Code extension (Icon + Grammar) |
|
|
102
|
+
| `python artisan make:model <Model>` | Create new Eloquent-style model |
|
|
103
|
+
| `python artisan make:controller <Name>`| Create standard or resource controller |
|
|
104
|
+
| `python artisan make:crud <Model>` | Scaffold full CRUD resource in 1 command |
|
|
105
|
+
| `python artisan make:migration <name>` | Generate database migration |
|
|
106
|
+
| `python artisan make:auth` | Scaffold complete authentication system |
|
|
107
|
+
| `python artisan migrate` | Run pending database migrations |
|
|
108
|
+
| `python artisan migrate:fresh [--seed]` | Drop all tables and re-run all migrations |
|
|
109
|
+
| `python artisan db:check` | Diagnose database connection and health |
|
|
110
|
+
| `python artisan db:seed` | Run seeders |
|
|
111
|
+
| `python artisan queue:work` | Start background queue worker daemon |
|
|
112
|
+
| `python artisan schedule:run` | Execute scheduled cron tasks |
|
|
113
|
+
| `python artisan tinker` | Interactive Python REPL with models preloaded |
|
|
114
|
+
| `python artisan test` | Run pytest test suite |
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## 🧪 Running Tests
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
python artisan test
|
|
122
|
+
# or
|
|
123
|
+
pytest
|
|
124
|
+
```
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""
|
|
3
|
+
AIPostify
|
|
4
|
+
Laravel-Style Python MVC Framework with PTL (Postify Template Language).
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
__title__ = "aipostify"
|
|
8
|
+
__version__ = "1.0.0"
|
|
9
|
+
__author__ = "AIPostify Contributors"
|
|
10
|
+
__license__ = "MIT"
|
|
11
|
+
__description__ = "Laravel-Style Python MVC Starter Framework with PTL Template Engine"
|
|
12
|
+
|
|
13
|
+
from framework.kernel import bootstrap, get_wsgi_application, get_asgi_application
|
|
14
|
+
|
|
15
|
+
__all__ = [
|
|
16
|
+
"bootstrap",
|
|
17
|
+
"get_wsgi_application",
|
|
18
|
+
"get_asgi_application",
|
|
19
|
+
"__version__",
|
|
20
|
+
"__author__",
|
|
21
|
+
"__license__",
|
|
22
|
+
]
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""
|
|
3
|
+
AIPostify CLI Entry Point
|
|
4
|
+
Provides global 'aipostify' and 'artisan' command-line tools.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
import sys
|
|
8
|
+
import os
|
|
9
|
+
import shutil
|
|
10
|
+
from pathlib import Path
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
BANNER = r"""
|
|
14
|
+
___ ____ ___ __ _ ____
|
|
15
|
+
/ | / _/ / _ \___ ___ / /_ (_)/ __/__ __
|
|
16
|
+
/ /| | / / / ___/ _ \ (_-< / __// // _/ / / / /
|
|
17
|
+
/_/ |_|_/___//_/ \___//___//_/ /_//_/ \__, /
|
|
18
|
+
/____/
|
|
19
|
+
Laravel-Style Python MVC Framework • v1.0.0
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def _find_project_root():
|
|
24
|
+
"""Look up directory tree for an artisan file to identify AIPostify project root."""
|
|
25
|
+
current = Path.cwd().resolve()
|
|
26
|
+
while current != current.parent:
|
|
27
|
+
if (current / "artisan").exists() and (current / "framework").exists():
|
|
28
|
+
return current
|
|
29
|
+
current = current.parent
|
|
30
|
+
return None
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def _create_new_project(project_name: str):
|
|
34
|
+
"""Scaffold a brand new AIPostify project in the specified directory."""
|
|
35
|
+
target_dir = Path.cwd() / project_name
|
|
36
|
+
if target_dir.exists() and any(target_dir.iterdir()):
|
|
37
|
+
print(f"\033[91m[Error]\033[0m Directory [{project_name}] already exists and is not empty.")
|
|
38
|
+
return 1
|
|
39
|
+
|
|
40
|
+
print(f"\033[95m{BANNER}\033[0m")
|
|
41
|
+
print(f"\033[96mCreating a new AIPostify application in:\033[0m {target_dir}\n")
|
|
42
|
+
|
|
43
|
+
# Locate package template / source directory
|
|
44
|
+
pkg_root = Path(__file__).resolve().parent.parent
|
|
45
|
+
|
|
46
|
+
# Folders and files to scaffold into new project
|
|
47
|
+
copy_dirs = [
|
|
48
|
+
"app",
|
|
49
|
+
"config",
|
|
50
|
+
"database",
|
|
51
|
+
"public",
|
|
52
|
+
"resources",
|
|
53
|
+
"routes",
|
|
54
|
+
"storage",
|
|
55
|
+
"tools",
|
|
56
|
+
]
|
|
57
|
+
copy_files = [
|
|
58
|
+
"artisan",
|
|
59
|
+
".env.example",
|
|
60
|
+
".gitignore",
|
|
61
|
+
".gitattributes",
|
|
62
|
+
"requirements.txt",
|
|
63
|
+
"pytest.ini",
|
|
64
|
+
]
|
|
65
|
+
|
|
66
|
+
target_dir.mkdir(parents=True, exist_ok=True)
|
|
67
|
+
|
|
68
|
+
# Copy directories
|
|
69
|
+
for d in copy_dirs:
|
|
70
|
+
src = pkg_root / d
|
|
71
|
+
if src.exists():
|
|
72
|
+
shutil.copytree(src, target_dir / d, dirs_exist_ok=True)
|
|
73
|
+
print(f" \033[92m+\033[0m Created directory {d}/")
|
|
74
|
+
|
|
75
|
+
# Copy files
|
|
76
|
+
for f in copy_files:
|
|
77
|
+
src = pkg_root / f
|
|
78
|
+
if src.exists():
|
|
79
|
+
shutil.copy2(src, target_dir / f)
|
|
80
|
+
print(f" \033[92m+\033[0m Created file {f}")
|
|
81
|
+
|
|
82
|
+
# Create .env from .env.example
|
|
83
|
+
env_example = target_dir / ".env.example"
|
|
84
|
+
env_file = target_dir / ".env"
|
|
85
|
+
if env_example.exists() and not env_file.exists():
|
|
86
|
+
shutil.copy2(env_example, env_file)
|
|
87
|
+
print(f" \033[92m+\033[0m Generated .env configuration")
|
|
88
|
+
|
|
89
|
+
# Ensure storage subdirectories exist
|
|
90
|
+
for sub in ["logs", "framework/cache", "framework/sessions", "framework/views"]:
|
|
91
|
+
(target_dir / "storage" / sub).mkdir(parents=True, exist_ok=True)
|
|
92
|
+
|
|
93
|
+
print("\n\033[92m[Success] AIPostify application created successfully!\033[0m")
|
|
94
|
+
print("\n\033[93mNext Steps:\033[0m")
|
|
95
|
+
print(f" cd {project_name}")
|
|
96
|
+
print(" python artisan key:generate")
|
|
97
|
+
print(" python artisan migrate")
|
|
98
|
+
print(" python artisan serve\n")
|
|
99
|
+
return 0
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
def main():
|
|
103
|
+
"""Main CLI handler for 'aipostify' command."""
|
|
104
|
+
args = sys.argv[1:]
|
|
105
|
+
|
|
106
|
+
if not args or args[0] in ["-h", "--help", "help"]:
|
|
107
|
+
print(f"\033[95m{BANNER}\033[0m")
|
|
108
|
+
print("Usage:")
|
|
109
|
+
print(" aipostify new <project_name> Create a new AIPostify project")
|
|
110
|
+
print(" aipostify --version, -v Display AIPostify version")
|
|
111
|
+
print(" aipostify <command> Run artisan command in current project")
|
|
112
|
+
print("\nExamples:")
|
|
113
|
+
print(" aipostify new myapp")
|
|
114
|
+
print(" aipostify serve")
|
|
115
|
+
print(" aipostify route:list")
|
|
116
|
+
return 0
|
|
117
|
+
|
|
118
|
+
if args[0] in ["-v", "--version", "version"]:
|
|
119
|
+
from . import __version__
|
|
120
|
+
print(f"AIPostify Framework v{__version__}")
|
|
121
|
+
return 0
|
|
122
|
+
|
|
123
|
+
if args[0] == "new":
|
|
124
|
+
if len(args) < 2:
|
|
125
|
+
print("\033[91m[Error]\033[0m Please provide a project name:")
|
|
126
|
+
print(" aipostify new <project_name>")
|
|
127
|
+
return 1
|
|
128
|
+
return _create_new_project(args[1])
|
|
129
|
+
|
|
130
|
+
# Check if we are inside an AIPostify project
|
|
131
|
+
project_root = _find_project_root()
|
|
132
|
+
if project_root:
|
|
133
|
+
artisan_path = project_root / "artisan"
|
|
134
|
+
cmd = [sys.executable, str(artisan_path)] + args
|
|
135
|
+
import subprocess
|
|
136
|
+
return subprocess.run(cmd).returncode
|
|
137
|
+
else:
|
|
138
|
+
print(f"\033[91m[Error]\033[0m Could not find an AIPostify project with an 'artisan' file.")
|
|
139
|
+
print("Run \033[96maipostify new <project_name>\033[0m to create a new application.")
|
|
140
|
+
return 1
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
def artisan_main():
|
|
144
|
+
"""Entry point for standalone 'artisan' command."""
|
|
145
|
+
project_root = _find_project_root()
|
|
146
|
+
if not project_root:
|
|
147
|
+
# Fall back to current working directory
|
|
148
|
+
project_root = Path.cwd().resolve()
|
|
149
|
+
|
|
150
|
+
if str(project_root) not in sys.path:
|
|
151
|
+
sys.path.insert(0, str(project_root))
|
|
152
|
+
|
|
153
|
+
try:
|
|
154
|
+
from framework.kernel import bootstrap
|
|
155
|
+
bootstrap(project_root)
|
|
156
|
+
from framework.console import Artisan
|
|
157
|
+
exit_code = Artisan.handle(sys.argv[1:])
|
|
158
|
+
return exit_code or 0
|
|
159
|
+
except Exception as e:
|
|
160
|
+
print(f"\033[91m[Artisan Error]\033[0m {e}")
|
|
161
|
+
return 1
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
if __name__ == "__main__":
|
|
165
|
+
sys.exit(main())
|