shafikul-cli 2.0.1__tar.gz → 2.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 (27) hide show
  1. {shafikul_cli-2.0.1/shafikul_cli.egg-info → shafikul_cli-2.1.2}/PKG-INFO +1 -1
  2. {shafikul_cli-2.0.1 → shafikul_cli-2.1.2}/pyproject.toml +1 -1
  3. shafikul_cli-2.1.2/shafikul_cli/main.py +178 -0
  4. shafikul_cli-2.1.2/shafikul_cli/utility/create_file_content.py +77 -0
  5. shafikul_cli-2.1.2/shafikul_cli/utility/helper_function.py +1858 -0
  6. {shafikul_cli-2.0.1 → shafikul_cli-2.1.2/shafikul_cli.egg-info}/PKG-INFO +1 -1
  7. shafikul_cli-2.0.1/shafikul_cli/main.py +0 -395
  8. shafikul_cli-2.0.1/shafikul_cli/utility/create_file_content.py +0 -46
  9. shafikul_cli-2.0.1/shafikul_cli/utility/helper_function.py +0 -1531
  10. {shafikul_cli-2.0.1 → shafikul_cli-2.1.2}/LICENSE +0 -0
  11. {shafikul_cli-2.0.1 → shafikul_cli-2.1.2}/README.md +0 -0
  12. {shafikul_cli-2.0.1 → shafikul_cli-2.1.2}/setup.cfg +0 -0
  13. {shafikul_cli-2.0.1 → shafikul_cli-2.1.2}/shafikul_cli/__init__.py +0 -0
  14. {shafikul_cli-2.0.1 → shafikul_cli-2.1.2}/shafikul_cli/asset/__init__.py +0 -0
  15. {shafikul_cli-2.0.1 → shafikul_cli-2.1.2}/shafikul_cli/asset/logo.png +0 -0
  16. {shafikul_cli-2.0.1 → shafikul_cli-2.1.2}/shafikul_cli/utility/__init__.py +0 -0
  17. {shafikul_cli-2.0.1 → shafikul_cli-2.1.2}/shafikul_cli/utility/create_file_structure.py +0 -0
  18. {shafikul_cli-2.0.1 → shafikul_cli-2.1.2}/shafikul_cli/utility/create_html_file.py +0 -0
  19. {shafikul_cli-2.0.1 → shafikul_cli-2.1.2}/shafikul_cli/utility/ensure_db.py +0 -0
  20. {shafikul_cli-2.0.1 → shafikul_cli-2.1.2}/shafikul_cli/utility/ensure_main.py +0 -0
  21. {shafikul_cli-2.0.1 → shafikul_cli-2.1.2}/shafikul_cli/utility/env_generate.py +0 -0
  22. {shafikul_cli-2.0.1 → shafikul_cli-2.1.2}/shafikul_cli/utility/install_dependicy.py +0 -0
  23. {shafikul_cli-2.0.1 → shafikul_cli-2.1.2}/shafikul_cli.egg-info/SOURCES.txt +0 -0
  24. {shafikul_cli-2.0.1 → shafikul_cli-2.1.2}/shafikul_cli.egg-info/dependency_links.txt +0 -0
  25. {shafikul_cli-2.0.1 → shafikul_cli-2.1.2}/shafikul_cli.egg-info/entry_points.txt +0 -0
  26. {shafikul_cli-2.0.1 → shafikul_cli-2.1.2}/shafikul_cli.egg-info/requires.txt +0 -0
  27. {shafikul_cli-2.0.1 → shafikul_cli-2.1.2}/shafikul_cli.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: shafikul_cli
3
- Version: 2.0.1
3
+ Version: 2.1.2
4
4
  Summary: CLI tool for FastAPI scaffolding with router, models, database, and templates.
5
5
  Author-email: Md Shafikul Islam <buildwithshafikul@gmail.com>
6
6
  Project-URL: Homepage, https://github.com/build-with-shafikul/shafikul_cli
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "shafikul_cli"
7
- version = "2.0.1"
7
+ version = "2.1.2"
8
8
  description = "CLI tool for FastAPI scaffolding with router, models, database, and templates."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.9"
@@ -0,0 +1,178 @@
1
+ import os
2
+ import typer
3
+ import sys
4
+ from typing import Optional
5
+ from rich.console import Console
6
+ from rich.panel import Panel
7
+ from rich.text import Text
8
+ from importlib.metadata import version as project_version
9
+ from shafikul_cli.utility.install_dependicy import install_dependencies, alembic_init, user_table_autogenerate
10
+ from shafikul_cli.utility.ensure_db import ensure_db_in_main
11
+ from shafikul_cli.utility.ensure_main import ensure_main_py
12
+ from shafikul_cli.utility.env_generate import ensure_env_file
13
+ from shafikul_cli.utility.create_html_file import create_html_file
14
+ from shafikul_cli.utility.create_file_structure import create_file_structure
15
+ from shafikul_cli.utility.create_file_content import file_inside_content
16
+ from shafikul_cli.utility.helper_function import edit_migration_env
17
+
18
+
19
+ app = typer.Typer(help="Shafikul CLI for FastAPI")
20
+ create_app_cli = typer.Typer(help="Create resources")
21
+ app.add_typer(create_app_cli, name="create")
22
+ console = Console()
23
+
24
+ # =========================================================
25
+ # 🎨 COLORED BANNER
26
+ # =========================================================
27
+ def show_banner():
28
+ banner = Text("Shafikul CLI", style="bold cyan")
29
+ subtitle = Text(f"Version v{project_version('shafikul-cli')} • FastAPI Toolkit", style="green")
30
+
31
+ panel = Panel.fit(
32
+ Text.assemble(banner, "\n", subtitle),
33
+ border_style="bright_blue",
34
+ )
35
+
36
+ console.print(panel)
37
+
38
+
39
+ # =========================================================
40
+ # 📘 ABOUT & (--version) COMMAND
41
+ # =========================================================
42
+ @app.callback(invoke_without_command=True)
43
+ def show_option_command(
44
+ ctx: typer.Context,
45
+ version: bool = typer.Option(
46
+ False, "--version", "-V", "-v",
47
+ help="Show CLI version",
48
+ is_eager=True,
49
+ ),
50
+ about: bool = typer.Option(
51
+ False, "--about", "-A", "-a",
52
+ help="Show information about Shafikul CLI",
53
+ is_eager=True,
54
+ ),
55
+ ):
56
+ if version:
57
+ console.print(f"[bold green]Shafikul CLI v{project_version("shafikul-cli")}[/]")
58
+ raise typer.Exit()
59
+
60
+ if about:
61
+ show_banner()
62
+ console.print("\n[bold]Author:[/] MD: Shafikul Islam")
63
+ console.print("[bold]Purpose:[/] FastAPI project scaffolding")
64
+ console.print("[bold]GitHub:[/] https://github.com/build-with-shafikul/shafikul_cli")
65
+ console.print("[bold]License:[/] MIT License\n")
66
+ raise typer.Exit()
67
+
68
+ # 👉 যদি কোনো command না দেয়
69
+ if ctx.invoked_subcommand is None:
70
+ typer.echo(ctx.get_help())
71
+ raise typer.Exit()
72
+
73
+
74
+ # =========================================================
75
+ # 🛠 CREATE APP
76
+ # =========================================================
77
+ @create_app_cli.command("app")
78
+ def create_app():
79
+ # target: Optional[str] = typer.Argument(None, help="structure")
80
+
81
+ show_banner()
82
+
83
+ folders = [
84
+ "app",
85
+ "config",
86
+ "asset/css",
87
+ "asset/images",
88
+ "asset/js",
89
+ "static/images",
90
+ "router/web",
91
+ "router/api",
92
+ "templates/layouts",
93
+ "templates/pages/auth",
94
+ "templates/pages/authenticated",
95
+ "templates/pages/error",
96
+ "templates/pages/public",
97
+ "utility"
98
+ ]
99
+
100
+ files = [
101
+ ".env",
102
+ ".env.example",
103
+ ".gitignore",
104
+ "requirements.txt",
105
+ "README.md",
106
+ "main.py",
107
+ "config/app.py",
108
+ "app/database.py",
109
+ "app/models.py",
110
+ "asset/css/style.css",
111
+ "asset/images/icon.png",
112
+ "static/images/logo.png",
113
+ "asset/js/script.js",
114
+ "router/api/users.py",
115
+ "router/web/auth.py",
116
+ "router/web/error.py",
117
+ "router/web/public.py",
118
+ "utility/helper_function.py",
119
+ "templates/layouts/main.html",
120
+ "templates/layouts/auth.html",
121
+ "templates/pages/public/index.html",
122
+ "templates/pages/error/notfound.html",
123
+ "templates/pages/authenticated/dashboard.html",
124
+ "templates/pages/auth/login.html",
125
+ "templates/pages/auth/registater.html",
126
+ ]
127
+
128
+ for folder in folders:
129
+ console.print("[bold green]Creating Folder: [/] " + folder )
130
+ os.makedirs(folder, exist_ok=True)
131
+
132
+ for file in files:
133
+ file_inside_content(file)
134
+
135
+ console.print("\n[green]Project structure created successfully![/]")
136
+
137
+ # ==========================================
138
+ # Install Dependices
139
+ # ==========================================
140
+ install_dependencies([
141
+ "python-dotenv",
142
+ "fastapi",
143
+ "uvicorn[standard]",
144
+ "jinja2",
145
+ "sqlalchemy",
146
+ "itsdangerous",
147
+ "passlib[bcrypt]",
148
+ "argon2-cffi",
149
+ "python-multipart",
150
+ ])
151
+
152
+ # ==========================================
153
+ # sqlalchemy alembic initionalize
154
+ # ==========================================
155
+ alembic_init()
156
+
157
+ # ==========================================
158
+ # sqlalchemy Migration Env add .env file database url
159
+ # ==========================================
160
+ edit_migration_env()
161
+
162
+ # ==========================================
163
+ # User Table Create
164
+ # ==========================================
165
+ user_table_autogenerate()
166
+
167
+ console.print(
168
+
169
+ Panel(
170
+ "[bold underline cyan]uvicorn main:app --reload[/]",
171
+ title="🌐 Running Server",
172
+ border_style="green"
173
+ )
174
+ )
175
+
176
+
177
+ if __name__ == "__main__":
178
+ app()
@@ -0,0 +1,77 @@
1
+ from rich.console import Console
2
+ from . import helper_function as Hfn
3
+
4
+ console = Console()
5
+
6
+ def file_inside_content(file_name: str):
7
+ console.print("[bold magenta]Creating File: [/] " + file_name )
8
+ if file_name == '.env':
9
+ Hfn.env(file_name)
10
+
11
+ if file_name == '.env.example':
12
+ Hfn.env_example(file_name)
13
+
14
+ if file_name == '.gitignore':
15
+ Hfn.gitignore(file_name)
16
+
17
+ if file_name == 'requirements.txt':
18
+ Hfn.requirements(file_name)
19
+
20
+ if file_name == 'README.md':
21
+ Hfn.readme(file_name)
22
+
23
+ if file_name == 'main.py':
24
+ Hfn.mainfile(file_name)
25
+
26
+ if file_name == 'config/app.py':
27
+ Hfn.config_app(file_name)
28
+
29
+ if file_name == 'app/database.py':
30
+ Hfn.database(file_name)
31
+
32
+ if file_name == 'app/models.py':
33
+ Hfn.models(file_name)
34
+
35
+ if file_name == 'router/api/users.py':
36
+ Hfn.api_user_route(file_name)
37
+
38
+ if file_name == 'router/web/auth.py':
39
+ Hfn.web_auth_route(file_name)
40
+
41
+ if file_name == 'router/web/error.py':
42
+ Hfn.web_error_route(file_name)
43
+
44
+ if file_name == 'router/web/public.py':
45
+ Hfn.web_public_route(file_name)
46
+
47
+ if file_name == 'utility/helper_function.py':
48
+ Hfn.helper_function(file_name)
49
+
50
+ if file_name == 'templates/layouts/main.html':
51
+ Hfn.main_layout(file_name)
52
+
53
+ if file_name == 'templates/layouts/auth.html':
54
+ Hfn.auth_layout(file_name)
55
+
56
+ if file_name == 'templates/pages/public/index.html':
57
+ Hfn.index(file_name)
58
+
59
+ if file_name == 'templates/pages/error/notfound.html':
60
+ Hfn.notfound(file_name)
61
+
62
+ if file_name == 'templates/pages/authenticated/dashboard.html':
63
+ Hfn.dashboard(file_name)
64
+
65
+ if file_name == 'templates/pages/auth/login.html':
66
+ Hfn.login(file_name)
67
+
68
+ if file_name == 'templates/pages/auth/registater.html':
69
+ Hfn.registater(file_name)
70
+
71
+
72
+ if file_name == 'static/images/logo.png':
73
+ Hfn.static_logo(file_name)
74
+
75
+ # if file_name == 'main':
76
+ # pass
77
+