djboost 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.
djboost-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 munjurdev
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.
djboost-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,203 @@
1
+ Metadata-Version: 2.4
2
+ Name: djboost
3
+ Version: 0.1.0
4
+ Summary: Django project generator CLI — production-ready Django projects in one command
5
+ Author: Munjur Alom
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/munjurdev/djboost
8
+ Project-URL: Repository, https://github.com/munjurdev/djboost
9
+ Project-URL: Bug Tracker, https://github.com/munjurdev/djboost/issues
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3.10
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Environment :: Console
17
+ Classifier: Intended Audience :: Developers
18
+ Classifier: Topic :: Software Development :: Code Generators
19
+ Requires-Python: >=3.10
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE
22
+ Requires-Dist: typer>=0.9.0
23
+ Requires-Dist: rich>=13.0.0
24
+ Dynamic: license-file
25
+
26
+ # djboost 🚀
27
+
28
+ `djboost` is a CLI tool that generates a fully-configured, production-ready Django project in one command. No more repetitive boilerplate setup.
29
+
30
+ With a single command you get Django REST Framework, JWT Authentication, Celery, Redis, WebSockets (Channels), Docker, Swagger docs, and more — all pre-wired and ready to go.
31
+
32
+ ## ✨ Features
33
+
34
+ - **API Ready** — Django REST Framework + Simple JWT pre-configured
35
+ - **API Docs** — Auto-generated Swagger UI and ReDoc via `drf-spectacular`
36
+ - **Async Tasks** — Celery + Redis integrated out of the box
37
+ - **WebSockets** — Django Channels with Daphne and Redis channel layers
38
+ - **Environment Variables** — `python-decouple` with a generated `.env` file
39
+ - **Database** — Pre-configured for PostgreSQL (SQLite default for dev)
40
+ - **CORS & Security** — `django-cors-headers` + standard security headers
41
+ - **Docker** — Ready-to-use `Dockerfile` and `docker-compose.yml`
42
+ - **Static Files** — Whitenoise configured for efficient static file serving
43
+ - **Code Quality** — `pre-commit` with `black`, `flake8`, and `isort`
44
+ - **Testing** — `pytest` + `pytest-django` with coverage pre-configured
45
+ - **CI/CD** — Modular GitHub Actions and GitLab CI pipelines
46
+ - **Custom Exception Handling** — Global DRF exception handler included
47
+
48
+ ---
49
+
50
+ ## � Installation
51
+
52
+ ```bash
53
+ pip install djboost
54
+ ```
55
+
56
+ ---
57
+
58
+ ## 🚀 Quick Start
59
+
60
+ ### Step 1 — Create a virtual environment and activate it
61
+
62
+ ```bash
63
+ python -m venv env
64
+
65
+ # Windows
66
+ env\Scripts\activate
67
+
68
+ # Mac / Linux
69
+ source env/bin/activate
70
+ ```
71
+
72
+ ### Step 2 — Install djboost
73
+
74
+ ```bash
75
+ pip install djboost
76
+ ```
77
+
78
+ ### Step 3 — Navigate to an empty folder and create your project
79
+
80
+ ```bash
81
+ # Create a project with a custom name
82
+ djboost create project myproject
83
+
84
+ # Or use the default name 'core'
85
+ djboost create project
86
+ ```
87
+
88
+ This single command will automatically:
89
+
90
+ 1. Install Django and run `startproject`
91
+ 2. Update `settings.py` with all advanced configurations
92
+ 3. Generate `.env`, `Dockerfile`, `docker-compose.yml`, and `.gitignore`
93
+ 4. Generate `pytest.ini` and `.pre-commit-config.yaml`
94
+ 5. Create `/apps`, `/static`, and `/media` directories
95
+ 6. Install all required dependencies
96
+ 7. Initialize a `git` repository and set up `pre-commit` hooks
97
+ 8. Freeze dependencies into `requirements.txt`
98
+
99
+ ---
100
+
101
+ ## 🧱 Creating Apps
102
+
103
+ Apps are created inside the `apps/` directory to keep your project root clean. Settings and URLs are auto-configured.
104
+
105
+ ```bash
106
+ # Navigate to your project root first
107
+ cd myproject
108
+
109
+ # Create a new app
110
+ djboost create app users
111
+ ```
112
+
113
+ This will:
114
+ - Create `apps/users/` with standard Django app structure
115
+ - Auto-add `'apps.users'` to `INSTALLED_APPS`
116
+ - Auto-map `api/users/` in `urls.py`
117
+ - Create a starter `urls.py` inside the app
118
+
119
+ ---
120
+
121
+ ## � Managing CI/CD Pipelines
122
+
123
+ CI/CD is modular — add or remove it any time after project creation.
124
+
125
+ ### Add a pipeline
126
+
127
+ ```bash
128
+ djboost add cicd github # GitHub Actions
129
+ djboost add cicd gitlab # GitLab CI
130
+ ```
131
+
132
+ ### Remove a pipeline
133
+
134
+ ```bash
135
+ djboost remove cicd github
136
+ djboost remove cicd gitlab
137
+ ```
138
+
139
+ ---
140
+
141
+ ## 🏃 Running Your Project
142
+
143
+ ### Locally
144
+
145
+ ```bash
146
+ # Apply migrations
147
+ python manage.py migrate
148
+
149
+ # Start the dev server
150
+ python manage.py runserver
151
+ ```
152
+
153
+ ### API Documentation
154
+
155
+ Once your server is running:
156
+
157
+ | Interface | URL |
158
+ |---|---|
159
+ | Swagger UI | `http://127.0.0.1:8000/api/schema/swagger-ui/` |
160
+ | ReDoc | `http://127.0.0.1:8000/api/schema/redoc/` |
161
+ | OpenAPI Schema | `http://127.0.0.1:8000/api/schema/` |
162
+
163
+ ### Testing
164
+
165
+ ```bash
166
+ pytest
167
+ ```
168
+
169
+ ### With Docker
170
+
171
+ ```bash
172
+ docker-compose up --build
173
+ ```
174
+
175
+ This spins up PostgreSQL, Redis, Celery worker, and a Daphne ASGI server together.
176
+
177
+ ---
178
+
179
+ ## ⚙️ CLI Reference
180
+
181
+ ```
182
+ djboost --help
183
+ djboost --version
184
+
185
+ djboost create project [NAME] Create a new Django project
186
+ djboost create app NAME Create a new app inside apps/
187
+
188
+ djboost add cicd github|gitlab Add a CI/CD pipeline
189
+ djboost remove cicd github|gitlab Remove a CI/CD pipeline
190
+ ```
191
+
192
+ ---
193
+
194
+ ## 🐍 Requirements
195
+
196
+ - Python 3.10+
197
+ - Virtual environment (required — djboost will warn you if not activated)
198
+
199
+ ---
200
+
201
+ ## 📄 License
202
+
203
+ MIT
@@ -0,0 +1,178 @@
1
+ # djboost 🚀
2
+
3
+ `djboost` is a CLI tool that generates a fully-configured, production-ready Django project in one command. No more repetitive boilerplate setup.
4
+
5
+ With a single command you get Django REST Framework, JWT Authentication, Celery, Redis, WebSockets (Channels), Docker, Swagger docs, and more — all pre-wired and ready to go.
6
+
7
+ ## ✨ Features
8
+
9
+ - **API Ready** — Django REST Framework + Simple JWT pre-configured
10
+ - **API Docs** — Auto-generated Swagger UI and ReDoc via `drf-spectacular`
11
+ - **Async Tasks** — Celery + Redis integrated out of the box
12
+ - **WebSockets** — Django Channels with Daphne and Redis channel layers
13
+ - **Environment Variables** — `python-decouple` with a generated `.env` file
14
+ - **Database** — Pre-configured for PostgreSQL (SQLite default for dev)
15
+ - **CORS & Security** — `django-cors-headers` + standard security headers
16
+ - **Docker** — Ready-to-use `Dockerfile` and `docker-compose.yml`
17
+ - **Static Files** — Whitenoise configured for efficient static file serving
18
+ - **Code Quality** — `pre-commit` with `black`, `flake8`, and `isort`
19
+ - **Testing** — `pytest` + `pytest-django` with coverage pre-configured
20
+ - **CI/CD** — Modular GitHub Actions and GitLab CI pipelines
21
+ - **Custom Exception Handling** — Global DRF exception handler included
22
+
23
+ ---
24
+
25
+ ## � Installation
26
+
27
+ ```bash
28
+ pip install djboost
29
+ ```
30
+
31
+ ---
32
+
33
+ ## 🚀 Quick Start
34
+
35
+ ### Step 1 — Create a virtual environment and activate it
36
+
37
+ ```bash
38
+ python -m venv env
39
+
40
+ # Windows
41
+ env\Scripts\activate
42
+
43
+ # Mac / Linux
44
+ source env/bin/activate
45
+ ```
46
+
47
+ ### Step 2 — Install djboost
48
+
49
+ ```bash
50
+ pip install djboost
51
+ ```
52
+
53
+ ### Step 3 — Navigate to an empty folder and create your project
54
+
55
+ ```bash
56
+ # Create a project with a custom name
57
+ djboost create project myproject
58
+
59
+ # Or use the default name 'core'
60
+ djboost create project
61
+ ```
62
+
63
+ This single command will automatically:
64
+
65
+ 1. Install Django and run `startproject`
66
+ 2. Update `settings.py` with all advanced configurations
67
+ 3. Generate `.env`, `Dockerfile`, `docker-compose.yml`, and `.gitignore`
68
+ 4. Generate `pytest.ini` and `.pre-commit-config.yaml`
69
+ 5. Create `/apps`, `/static`, and `/media` directories
70
+ 6. Install all required dependencies
71
+ 7. Initialize a `git` repository and set up `pre-commit` hooks
72
+ 8. Freeze dependencies into `requirements.txt`
73
+
74
+ ---
75
+
76
+ ## 🧱 Creating Apps
77
+
78
+ Apps are created inside the `apps/` directory to keep your project root clean. Settings and URLs are auto-configured.
79
+
80
+ ```bash
81
+ # Navigate to your project root first
82
+ cd myproject
83
+
84
+ # Create a new app
85
+ djboost create app users
86
+ ```
87
+
88
+ This will:
89
+ - Create `apps/users/` with standard Django app structure
90
+ - Auto-add `'apps.users'` to `INSTALLED_APPS`
91
+ - Auto-map `api/users/` in `urls.py`
92
+ - Create a starter `urls.py` inside the app
93
+
94
+ ---
95
+
96
+ ## � Managing CI/CD Pipelines
97
+
98
+ CI/CD is modular — add or remove it any time after project creation.
99
+
100
+ ### Add a pipeline
101
+
102
+ ```bash
103
+ djboost add cicd github # GitHub Actions
104
+ djboost add cicd gitlab # GitLab CI
105
+ ```
106
+
107
+ ### Remove a pipeline
108
+
109
+ ```bash
110
+ djboost remove cicd github
111
+ djboost remove cicd gitlab
112
+ ```
113
+
114
+ ---
115
+
116
+ ## 🏃 Running Your Project
117
+
118
+ ### Locally
119
+
120
+ ```bash
121
+ # Apply migrations
122
+ python manage.py migrate
123
+
124
+ # Start the dev server
125
+ python manage.py runserver
126
+ ```
127
+
128
+ ### API Documentation
129
+
130
+ Once your server is running:
131
+
132
+ | Interface | URL |
133
+ |---|---|
134
+ | Swagger UI | `http://127.0.0.1:8000/api/schema/swagger-ui/` |
135
+ | ReDoc | `http://127.0.0.1:8000/api/schema/redoc/` |
136
+ | OpenAPI Schema | `http://127.0.0.1:8000/api/schema/` |
137
+
138
+ ### Testing
139
+
140
+ ```bash
141
+ pytest
142
+ ```
143
+
144
+ ### With Docker
145
+
146
+ ```bash
147
+ docker-compose up --build
148
+ ```
149
+
150
+ This spins up PostgreSQL, Redis, Celery worker, and a Daphne ASGI server together.
151
+
152
+ ---
153
+
154
+ ## ⚙️ CLI Reference
155
+
156
+ ```
157
+ djboost --help
158
+ djboost --version
159
+
160
+ djboost create project [NAME] Create a new Django project
161
+ djboost create app NAME Create a new app inside apps/
162
+
163
+ djboost add cicd github|gitlab Add a CI/CD pipeline
164
+ djboost remove cicd github|gitlab Remove a CI/CD pipeline
165
+ ```
166
+
167
+ ---
168
+
169
+ ## 🐍 Requirements
170
+
171
+ - Python 3.10+
172
+ - Virtual environment (required — djboost will warn you if not activated)
173
+
174
+ ---
175
+
176
+ ## 📄 License
177
+
178
+ MIT
@@ -0,0 +1 @@
1
+ # init
@@ -0,0 +1,37 @@
1
+ import typer
2
+ from djboost.commands.create_project import create_project_command
3
+ from djboost.commands.create_app import create_app_command
4
+ from djboost.commands.add_cicd import add_cicd_command
5
+ from djboost.commands.remove_cicd import remove_cicd_command
6
+
7
+ app = typer.Typer(help="djboost — Django project generator CLI")
8
+ create = typer.Typer(help="Create a new project or app")
9
+ add = typer.Typer(help="Add integrations to your project")
10
+ remove = typer.Typer(help="Remove integrations from your project")
11
+
12
+ app.add_typer(create, name="create")
13
+ app.add_typer(add, name="add")
14
+ app.add_typer(remove, name="remove")
15
+
16
+ create.command("project")(create_project_command)
17
+ create.command("app")(create_app_command)
18
+ add.command("cicd")(add_cicd_command)
19
+ remove.command("cicd")(remove_cicd_command)
20
+
21
+
22
+ def version_callback(value: bool):
23
+ if value:
24
+ typer.echo("djboost version 0.1.0")
25
+ raise typer.Exit()
26
+
27
+
28
+ @app.callback()
29
+ def main(
30
+ version: bool = typer.Option(
31
+ None, "--version", "-v",
32
+ callback=version_callback,
33
+ is_eager=True,
34
+ help="Show the version and exit."
35
+ )
36
+ ):
37
+ pass
@@ -0,0 +1 @@
1
+ # init
@@ -0,0 +1,16 @@
1
+ import typer
2
+ from rich import print
3
+ from djboost.generator import generate_github_actions, generate_gitlab_ci, check_virtual_environment
4
+
5
+ def add_cicd_command(provider: str = typer.Argument(..., help="The CI/CD provider to add (github or gitlab)")):
6
+ check_virtual_environment()
7
+ provider = provider.lower()
8
+ if provider == "github":
9
+ generate_github_actions()
10
+ print("[green]GitHub Actions workflow created successfully![/green]")
11
+ elif provider == "gitlab":
12
+ generate_gitlab_ci()
13
+ print("[green]GitLab CI pipeline created successfully![/green]")
14
+ else:
15
+ print(f"[red]Error: Unsupported provider '{provider}'. Supported providers are: github, gitlab.[/red]")
16
+ raise typer.Exit(code=1)
@@ -0,0 +1,130 @@
1
+ import re
2
+ import sys
3
+ import subprocess
4
+ from pathlib import Path
5
+ import typer
6
+ from rich import print
7
+ from djboost.generator import check_virtual_environment, validate_name
8
+
9
+
10
+ def get_project_name():
11
+ if not Path("manage.py").exists():
12
+ print("[red]Error: manage.py not found. Are you in the project root?[/red]")
13
+ raise typer.Exit(1)
14
+
15
+ content = Path("manage.py").read_text(encoding="utf-8")
16
+ match = re.search(r"['\"]DJANGO_SETTINGS_MODULE['\"],\s*['\"]([^.]+)\.settings['\"]", content)
17
+ if match:
18
+ return match.group(1)
19
+
20
+ print("[red]Error: Could not determine project name from manage.py[/red]")
21
+ raise typer.Exit(1)
22
+
23
+
24
+ def update_settings(project_name: str, app_name: str):
25
+ settings_path = Path(project_name) / "settings.py"
26
+ if not settings_path.exists():
27
+ print(f"[yellow]Warning: Could not find settings.py at {settings_path}. Skipping.[/yellow]")
28
+ return
29
+
30
+ content = settings_path.read_text(encoding="utf-8")
31
+ app_string = f"'apps.{app_name}',"
32
+
33
+ if app_string in content or f'"apps.{app_name}",' in content:
34
+ print(f"[yellow]App '{app_name}' is already in INSTALLED_APPS[/yellow]")
35
+ return
36
+
37
+ if "INSTALLED_APPS = [" in content:
38
+ content = re.sub(
39
+ r"(INSTALLED_APPS\s*=\s*\[.*?)(\n?\])",
40
+ rf"\1\n {app_string}\2",
41
+ content,
42
+ flags=re.DOTALL
43
+ )
44
+ settings_path.write_text(content, encoding="utf-8")
45
+ print(f"[green]✔ Added '{app_string}' to INSTALLED_APPS[/green]")
46
+ else:
47
+ print("[yellow]Warning: Could not find INSTALLED_APPS in settings.py[/yellow]")
48
+
49
+
50
+ def update_urls(project_name: str, app_name: str):
51
+ urls_path = Path(project_name) / "urls.py"
52
+ if not urls_path.exists():
53
+ print(f"[yellow]Warning: Could not find urls.py at {urls_path}. Skipping.[/yellow]")
54
+ return
55
+
56
+ content = urls_path.read_text(encoding="utf-8")
57
+
58
+ if f"apps.{app_name}.urls" in content:
59
+ print(f"[yellow]App '{app_name}' is already mapped in urls.py[/yellow]")
60
+ return
61
+
62
+ if "include" not in content:
63
+ content = re.sub(r"(from django\.urls import.*?path)", r"\1, include", content)
64
+
65
+ if "urlpatterns = [" in content:
66
+ content = content.replace(
67
+ "urlpatterns = [",
68
+ f"urlpatterns = [\n path('api/{app_name}/', include('apps.{app_name}.urls')),"
69
+ )
70
+ urls_path.write_text(content, encoding="utf-8")
71
+ print(f"[green]✔ Mapped /api/{app_name}/ in {project_name}/urls.py[/green]")
72
+ else:
73
+ print("[yellow]Warning: Could not find urlpatterns in urls.py[/yellow]")
74
+
75
+
76
+ def create_app_urls(app_name: str):
77
+ urls_path = Path("apps") / app_name / "urls.py"
78
+ content = f"""from django.urls import path
79
+ from . import views
80
+
81
+ app_name = '{app_name}'
82
+
83
+ urlpatterns = [
84
+ # path('', views.MyView.as_view(), name='my-view'),
85
+ ]
86
+ """
87
+ urls_path.write_text(content, encoding="utf-8")
88
+
89
+
90
+ def create_app_command(name: str = typer.Argument(..., help="The name of the Django app to create")):
91
+ check_virtual_environment()
92
+ validate_name(name, "app name")
93
+
94
+ if not Path("manage.py").exists():
95
+ print("[red]Error: manage.py not found. Run this command from your Django project root.[/red]")
96
+ raise typer.Exit(1)
97
+
98
+ app_path = Path("apps") / name
99
+ if app_path.exists():
100
+ print(f"[red]Error: App '{name}' already exists at apps/{name}.[/red]")
101
+ raise typer.Exit(1)
102
+
103
+ Path("apps").mkdir(exist_ok=True)
104
+
105
+ print(f"[cyan]Creating app '{name}'...[/cyan]")
106
+ result = subprocess.run(
107
+ [sys.executable, "manage.py", "startapp", name, f"apps/{name}"],
108
+ capture_output=True, text=True
109
+ )
110
+ if result.returncode != 0:
111
+ print(f"[red]Error creating app:\n{result.stderr}[/red]")
112
+ raise typer.Exit(1)
113
+
114
+ (Path(f"apps/{name}") / "__init__.py").touch()
115
+
116
+ # Fix apps.py name
117
+ apps_py_path = Path(f"apps/{name}/apps.py")
118
+ if apps_py_path.exists():
119
+ apps_content = apps_py_path.read_text(encoding="utf-8")
120
+ apps_content = re.sub(rf"name\s*=\s*['\"]{name}['\"]", f"name = 'apps.{name}'", apps_content)
121
+ apps_py_path.write_text(apps_content, encoding="utf-8")
122
+
123
+ try:
124
+ project_name = get_project_name()
125
+ update_settings(project_name, name)
126
+ update_urls(project_name, name)
127
+ create_app_urls(name)
128
+ print(f"[bold green]✅ App '{name}' created and configured successfully![/bold green]")
129
+ except Exception as e:
130
+ print(f"[red]Error during auto-configuration: {str(e)}[/red]")
@@ -0,0 +1,6 @@
1
+ import typer
2
+ from djboost.generator import create_project
3
+
4
+
5
+ def create_project_command(name: str = typer.Argument("core", help="The name of the Django project")):
6
+ create_project(name)
@@ -0,0 +1,34 @@
1
+ import os
2
+ import shutil
3
+ import typer
4
+ from rich import print
5
+ from djboost.generator import check_virtual_environment
6
+
7
+ def remove_cicd_command(provider: str = typer.Argument(..., help="The CI/CD provider to remove (github or gitlab)")):
8
+ check_virtual_environment()
9
+ provider = provider.lower()
10
+ if provider == "github":
11
+ github_dir = ".github"
12
+ if os.path.exists(github_dir):
13
+ try:
14
+ shutil.rmtree(github_dir)
15
+ print("[green]GitHub Actions workflow removed successfully![/green]")
16
+ except Exception as e:
17
+ print(f"[red]Failed to remove GitHub Actions workflow: {e}[/red]")
18
+ else:
19
+ print("[yellow]GitHub Actions workflow is not present in this project.[/yellow]")
20
+
21
+ elif provider == "gitlab":
22
+ gitlab_file = ".gitlab-ci.yml"
23
+ if os.path.exists(gitlab_file):
24
+ try:
25
+ os.remove(gitlab_file)
26
+ print("[green]GitLab CI pipeline removed successfully![/green]")
27
+ except Exception as e:
28
+ print(f"[red]Failed to remove GitLab CI pipeline: {e}[/red]")
29
+ else:
30
+ print("[yellow]GitLab CI pipeline is not present in this project.[/yellow]")
31
+
32
+ else:
33
+ print(f"[red]Error: Unsupported provider '{provider}'. Supported providers are: github, gitlab.[/red]")
34
+ raise typer.Exit(code=1)