create-pywire-app 0.1.1__tar.gz → 0.1.3__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.
- {create_pywire_app-0.1.1 → create_pywire_app-0.1.3}/PKG-INFO +18 -2
- {create_pywire_app-0.1.1 → create_pywire_app-0.1.3}/README.md +17 -1
- {create_pywire_app-0.1.1 → create_pywire_app-0.1.3}/pyproject.toml +1 -1
- {create_pywire_app-0.1.1 → create_pywire_app-0.1.3}/src/create_pywire_app/main.py +119 -21
- create_pywire_app-0.1.3/src/create_pywire_app/templates/common/extensions.json +5 -0
- {create_pywire_app-0.1.1 → create_pywire_app-0.1.3}/src/create_pywire_app/templates/common/main-explicit.py.j2 +1 -1
- {create_pywire_app-0.1.1 → create_pywire_app-0.1.3}/src/create_pywire_app/templates/common/main-path.py.j2 +1 -1
- {create_pywire_app-0.1.1 → create_pywire_app-0.1.3}/.gitignore +0 -0
- {create_pywire_app-0.1.1 → create_pywire_app-0.1.3}/LICENSE +0 -0
- {create_pywire_app-0.1.1 → create_pywire_app-0.1.3}/src/create_pywire_app/__init__.py +0 -0
- {create_pywire_app-0.1.1 → create_pywire_app-0.1.3}/src/create_pywire_app/templates/blog/explicit/about.wire +0 -0
- {create_pywire_app-0.1.1 → create_pywire_app-0.1.3}/src/create_pywire_app/templates/blog/explicit/blog-posts.wire +0 -0
- {create_pywire_app-0.1.1 → create_pywire_app-0.1.3}/src/create_pywire_app/templates/blog/explicit/home.wire +0 -0
- {create_pywire_app-0.1.1 → create_pywire_app-0.1.3}/src/create_pywire_app/templates/blog/explicit/layout.wire.j2 +0 -0
- {create_pywire_app-0.1.1 → create_pywire_app-0.1.3}/src/create_pywire_app/templates/blog/path-based/__layout__.wire.j2 +0 -0
- {create_pywire_app-0.1.1 → create_pywire_app-0.1.3}/src/create_pywire_app/templates/blog/path-based/index.wire +0 -0
- {create_pywire_app-0.1.1 → create_pywire_app-0.1.3}/src/create_pywire_app/templates/blog/path-based/posts__layout__.wire.j2 +0 -0
- {create_pywire_app-0.1.1 → create_pywire_app-0.1.3}/src/create_pywire_app/templates/blog/path-based/posts_index.wire +0 -0
- {create_pywire_app-0.1.1 → create_pywire_app-0.1.3}/src/create_pywire_app/templates/blog/path-based/posts_slug.wire +0 -0
- {create_pywire_app-0.1.1 → create_pywire_app-0.1.3}/src/create_pywire_app/templates/common/.gitignore +0 -0
- {create_pywire_app-0.1.1 → create_pywire_app-0.1.3}/src/create_pywire_app/templates/common/Dockerfile +0 -0
- {create_pywire_app-0.1.1 → create_pywire_app-0.1.3}/src/create_pywire_app/templates/common/README.md.j2 +0 -0
- {create_pywire_app-0.1.1 → create_pywire_app-0.1.3}/src/create_pywire_app/templates/common/__error__.wire +0 -0
- {create_pywire_app-0.1.1 → create_pywire_app-0.1.3}/src/create_pywire_app/templates/common/pyproject.toml.j2 +0 -0
- {create_pywire_app-0.1.1 → create_pywire_app-0.1.3}/src/create_pywire_app/templates/common/render.yaml.j2 +0 -0
- {create_pywire_app-0.1.1 → create_pywire_app-0.1.3}/src/create_pywire_app/templates/counter/explicit/home.wire +0 -0
- {create_pywire_app-0.1.1 → create_pywire_app-0.1.3}/src/create_pywire_app/templates/counter/explicit/layout.wire.j2 +0 -0
- {create_pywire_app-0.1.1 → create_pywire_app-0.1.3}/src/create_pywire_app/templates/counter/path-based/__layout__.wire.j2 +0 -0
- {create_pywire_app-0.1.1 → create_pywire_app-0.1.3}/src/create_pywire_app/templates/counter/path-based/index.wire +0 -0
- {create_pywire_app-0.1.1 → create_pywire_app-0.1.3}/src/create_pywire_app/templates/saas/explicit/auth-layout.wire.j2 +0 -0
- {create_pywire_app-0.1.1 → create_pywire_app-0.1.3}/src/create_pywire_app/templates/saas/explicit/dashboard-pages.wire +0 -0
- {create_pywire_app-0.1.1 → create_pywire_app-0.1.3}/src/create_pywire_app/templates/saas/explicit/landing.wire +0 -0
- {create_pywire_app-0.1.1 → create_pywire_app-0.1.3}/src/create_pywire_app/templates/saas/explicit/login.wire +0 -0
- {create_pywire_app-0.1.1 → create_pywire_app-0.1.3}/src/create_pywire_app/templates/saas/explicit/pricing.wire +0 -0
- {create_pywire_app-0.1.1 → create_pywire_app-0.1.3}/src/create_pywire_app/templates/saas/explicit/public-layout.wire.j2 +0 -0
- {create_pywire_app-0.1.1 → create_pywire_app-0.1.3}/src/create_pywire_app/templates/saas/models.py +0 -0
- {create_pywire_app-0.1.1 → create_pywire_app-0.1.3}/src/create_pywire_app/templates/saas/path-based/__layout__.wire.j2 +0 -0
- {create_pywire_app-0.1.1 → create_pywire_app-0.1.3}/src/create_pywire_app/templates/saas/path-based/dashboard__layout__.wire.j2 +0 -0
- {create_pywire_app-0.1.1 → create_pywire_app-0.1.3}/src/create_pywire_app/templates/saas/path-based/dashboard_index.wire +0 -0
- {create_pywire_app-0.1.1 → create_pywire_app-0.1.3}/src/create_pywire_app/templates/saas/path-based/dashboard_settings.wire +0 -0
- {create_pywire_app-0.1.1 → create_pywire_app-0.1.3}/src/create_pywire_app/templates/saas/path-based/index.wire +0 -0
- {create_pywire_app-0.1.1 → create_pywire_app-0.1.3}/src/create_pywire_app/templates/saas/path-based/login.wire +0 -0
- {create_pywire_app-0.1.1 → create_pywire_app-0.1.3}/src/create_pywire_app/templates/saas/path-based/pricing.wire +0 -0
- {create_pywire_app-0.1.1 → create_pywire_app-0.1.3}/tests/test_smoke.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: create-pywire-app
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.3
|
|
4
4
|
Summary: Init wizard for new pywire projects
|
|
5
5
|
License-File: LICENSE
|
|
6
6
|
Requires-Python: >=3.11
|
|
@@ -17,12 +17,28 @@ Description-Content-Type: text/markdown
|
|
|
17
17
|
|
|
18
18
|
Quick start wizard for new pywire projects.
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
<!-- INSTALL_MESSAGE_TEMPLATE_START -->
|
|
21
|
+
## 🚀 Quick Start
|
|
22
|
+
|
|
23
|
+
If you already have [uv](https://docs.astral.sh/uv/) installed, you can get started instantly:
|
|
21
24
|
|
|
22
25
|
```bash
|
|
23
26
|
uvx create-pywire-app
|
|
24
27
|
```
|
|
25
28
|
|
|
29
|
+
If you don't have `uv` installed or aren't sure, use our installer script which handles the setup for you:
|
|
30
|
+
|
|
31
|
+
### macOS / Linux
|
|
32
|
+
```bash
|
|
33
|
+
curl -fsSL pywire.dev/install | sh
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Windows (PowerShell)
|
|
37
|
+
```powershell
|
|
38
|
+
irm pywire.dev/install.ps1 | iex
|
|
39
|
+
```
|
|
40
|
+
<!-- INSTALL_MESSAGE_TEMPLATE_END -->
|
|
41
|
+
|
|
26
42
|
<!-- SUPPORT_MESSAGE_TEMPLATE_START -->
|
|
27
43
|
## ❤️ Support pywire
|
|
28
44
|
|
|
@@ -2,12 +2,28 @@
|
|
|
2
2
|
|
|
3
3
|
Quick start wizard for new pywire projects.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
<!-- INSTALL_MESSAGE_TEMPLATE_START -->
|
|
6
|
+
## 🚀 Quick Start
|
|
7
|
+
|
|
8
|
+
If you already have [uv](https://docs.astral.sh/uv/) installed, you can get started instantly:
|
|
6
9
|
|
|
7
10
|
```bash
|
|
8
11
|
uvx create-pywire-app
|
|
9
12
|
```
|
|
10
13
|
|
|
14
|
+
If you don't have `uv` installed or aren't sure, use our installer script which handles the setup for you:
|
|
15
|
+
|
|
16
|
+
### macOS / Linux
|
|
17
|
+
```bash
|
|
18
|
+
curl -fsSL pywire.dev/install | sh
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### Windows (PowerShell)
|
|
22
|
+
```powershell
|
|
23
|
+
irm pywire.dev/install.ps1 | iex
|
|
24
|
+
```
|
|
25
|
+
<!-- INSTALL_MESSAGE_TEMPLATE_END -->
|
|
26
|
+
|
|
11
27
|
<!-- SUPPORT_MESSAGE_TEMPLATE_START -->
|
|
12
28
|
## ❤️ Support pywire
|
|
13
29
|
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import argparse
|
|
2
|
+
import importlib.metadata
|
|
1
3
|
import os
|
|
2
4
|
import subprocess
|
|
3
5
|
import sys
|
|
@@ -25,6 +27,13 @@ LOGO = r"""
|
|
|
25
27
|
"""
|
|
26
28
|
|
|
27
29
|
|
|
30
|
+
def get_version() -> str:
|
|
31
|
+
try:
|
|
32
|
+
return importlib.metadata.version("create-pywire-app")
|
|
33
|
+
except importlib.metadata.PackageNotFoundError:
|
|
34
|
+
return "0.0.0"
|
|
35
|
+
|
|
36
|
+
|
|
28
37
|
class TemplateRenderer:
|
|
29
38
|
"""Handles template loading and rendering using Jinja2."""
|
|
30
39
|
|
|
@@ -113,6 +122,7 @@ class ProjectGenerator:
|
|
|
113
122
|
self._generate_gitignore()
|
|
114
123
|
self._generate_main()
|
|
115
124
|
self._generate_error_page()
|
|
125
|
+
self._generate_vscode_settings()
|
|
116
126
|
|
|
117
127
|
# Generate template-specific files
|
|
118
128
|
if self.template == "counter":
|
|
@@ -150,10 +160,19 @@ class ProjectGenerator:
|
|
|
150
160
|
"""Generate .gitignore."""
|
|
151
161
|
self.renderer.copy_static("common/.gitignore", self.project_path / ".gitignore")
|
|
152
162
|
|
|
163
|
+
def _generate_vscode_settings(self) -> None:
|
|
164
|
+
"""Generate VS Code settings."""
|
|
165
|
+
vscode_dir = self.project_path / ".vscode"
|
|
166
|
+
vscode_dir.mkdir(exist_ok=True)
|
|
167
|
+
self.renderer.copy_static("common/extensions.json", vscode_dir / "extensions.json")
|
|
168
|
+
|
|
153
169
|
def _generate_main(self) -> None:
|
|
154
170
|
"""Generate main.py."""
|
|
155
171
|
template_name = "main-path.py.j2" if self.routing_strategy == "path" else "main-explicit.py.j2"
|
|
156
|
-
|
|
172
|
+
context = {
|
|
173
|
+
"pages_dir": "src/pages" if self.use_src else "pages",
|
|
174
|
+
}
|
|
175
|
+
content = self.renderer.render(f"common/{template_name}", context)
|
|
157
176
|
(self.app_root / "main.py").write_text(content)
|
|
158
177
|
|
|
159
178
|
def _generate_error_page(self) -> None:
|
|
@@ -260,15 +279,31 @@ class ProjectGenerator:
|
|
|
260
279
|
def main():
|
|
261
280
|
console.clear()
|
|
262
281
|
|
|
263
|
-
#
|
|
282
|
+
# Parse arguments
|
|
283
|
+
parser = argparse.ArgumentParser(description="Create a new PyWire application")
|
|
284
|
+
parser.add_argument(
|
|
285
|
+
"--pywire-version", help="Specify a specific version of pywire to install"
|
|
286
|
+
)
|
|
287
|
+
args = parser.parse_args()
|
|
288
|
+
|
|
289
|
+
# Check for local override for testing (highest priority)
|
|
264
290
|
use_local = os.environ.get("USE_LOCAL_PYWIRE") == "1"
|
|
265
|
-
|
|
291
|
+
|
|
266
292
|
if use_local:
|
|
267
293
|
pywire_dep = "pywire @ /Users/rholmdahl/projects/pywire-workspace/pywire"
|
|
268
|
-
|
|
294
|
+
# We don't warn yet, wait until after LOGO
|
|
295
|
+
elif args.pywire_version:
|
|
296
|
+
pywire_dep = f"pywire=={args.pywire_version}"
|
|
297
|
+
else:
|
|
298
|
+
pywire_dep = "pywire" # Latest
|
|
299
|
+
|
|
300
|
+
tool_version = get_version()
|
|
269
301
|
|
|
270
302
|
console.print(LOGO)
|
|
271
|
-
console.print("[dim]
|
|
303
|
+
console.print(f"[dim]v{tool_version} • The Python Web Framework[/dim]\n")
|
|
304
|
+
|
|
305
|
+
if use_local:
|
|
306
|
+
console.print("[yellow]WARNING: Using local pywire dependency[/yellow]")
|
|
272
307
|
|
|
273
308
|
try:
|
|
274
309
|
# Project Location
|
|
@@ -341,6 +376,7 @@ def main():
|
|
|
341
376
|
generator.generate()
|
|
342
377
|
|
|
343
378
|
# Initialize git repo
|
|
379
|
+
git_initialized = False
|
|
344
380
|
try:
|
|
345
381
|
subprocess.run(
|
|
346
382
|
["git", "init"],
|
|
@@ -349,8 +385,33 @@ def main():
|
|
|
349
385
|
capture_output=True,
|
|
350
386
|
text=True,
|
|
351
387
|
)
|
|
388
|
+
git_initialized = True
|
|
352
389
|
except (FileNotFoundError, subprocess.CalledProcessError):
|
|
353
390
|
pass # Silently skip if git is not available
|
|
391
|
+
if git_initialized:
|
|
392
|
+
try:
|
|
393
|
+
subprocess.run(
|
|
394
|
+
["git", "add", "."],
|
|
395
|
+
cwd=project_path,
|
|
396
|
+
check=True,
|
|
397
|
+
capture_output=True,
|
|
398
|
+
text=True,
|
|
399
|
+
)
|
|
400
|
+
subprocess.run(
|
|
401
|
+
["git", "commit", "-m", "feat: initial project structure"],
|
|
402
|
+
cwd=project_path,
|
|
403
|
+
check=True,
|
|
404
|
+
capture_output=True,
|
|
405
|
+
text=True,
|
|
406
|
+
)
|
|
407
|
+
except subprocess.CalledProcessError as e:
|
|
408
|
+
console.print(
|
|
409
|
+
"[yellow]![/yellow] Git commit skipped (configure user.name/email to enable)."
|
|
410
|
+
)
|
|
411
|
+
if e.stderr:
|
|
412
|
+
console.print(e.stderr)
|
|
413
|
+
except FileNotFoundError:
|
|
414
|
+
console.print("[yellow]![/yellow] Git not found, skipping commit")
|
|
354
415
|
|
|
355
416
|
console.print("[green]✓[/green] Project structure created")
|
|
356
417
|
|
|
@@ -377,32 +438,69 @@ def main():
|
|
|
377
438
|
except FileNotFoundError:
|
|
378
439
|
console.print("[yellow]![/yellow] uv not found, skipping sync")
|
|
379
440
|
|
|
380
|
-
|
|
381
|
-
|
|
441
|
+
next_action = questionary.select(
|
|
442
|
+
"What would you like to do next?",
|
|
443
|
+
choices=[
|
|
444
|
+
questionary.Choice("Start development server", value="start"),
|
|
445
|
+
questionary.Choice("Show instructions and exit", value="instructions"),
|
|
446
|
+
],
|
|
447
|
+
pointer=">",
|
|
448
|
+
).unsafe_ask()
|
|
382
449
|
|
|
383
|
-
|
|
384
|
-
if
|
|
385
|
-
|
|
386
|
-
|
|
450
|
+
should_show_instructions = next_action == "instructions"
|
|
451
|
+
if next_action == "start":
|
|
452
|
+
try:
|
|
453
|
+
subprocess.run(
|
|
454
|
+
["uv", "run", "pywire", "dev"],
|
|
455
|
+
cwd=project_path,
|
|
456
|
+
check=True,
|
|
457
|
+
)
|
|
458
|
+
return
|
|
459
|
+
except subprocess.CalledProcessError:
|
|
460
|
+
console.print("[red]✗[/red] Failed to start the dev server")
|
|
461
|
+
should_show_instructions = True
|
|
462
|
+
except FileNotFoundError:
|
|
463
|
+
console.print("[yellow]![/yellow] uv not found, cannot start server")
|
|
464
|
+
should_show_instructions = True
|
|
465
|
+
|
|
466
|
+
if should_show_instructions:
|
|
467
|
+
console.print()
|
|
468
|
+
|
|
469
|
+
is_windows = os.name == "nt"
|
|
470
|
+
commands = [f"cd {project_location}"]
|
|
471
|
+
if not sync_success:
|
|
472
|
+
commands.append("uv sync")
|
|
473
|
+
if is_windows:
|
|
474
|
+
activate_cmd = r".venv\Scripts\activate"
|
|
475
|
+
else:
|
|
476
|
+
activate_cmd = "source .venv/bin/activate"
|
|
477
|
+
commands.extend(
|
|
478
|
+
[
|
|
479
|
+
activate_cmd,
|
|
480
|
+
"pywire dev",
|
|
481
|
+
]
|
|
482
|
+
)
|
|
387
483
|
|
|
388
|
-
|
|
484
|
+
cmd_text = "\n ".join(commands)
|
|
389
485
|
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
486
|
+
console.print(
|
|
487
|
+
Panel(
|
|
488
|
+
Markdown(
|
|
489
|
+
f"""
|
|
394
490
|
# System Online 🟢
|
|
395
491
|
|
|
396
492
|
Run the following commands to enter the environment:
|
|
397
493
|
|
|
398
494
|
{cmd_text}
|
|
495
|
+
|
|
496
|
+
> **Tip:** Install the **PyWire** extension (id: `pywire.pywire`) in VS Code for syntax highlighting and snippets.
|
|
399
497
|
"""
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
498
|
+
),
|
|
499
|
+
border_style="cyan",
|
|
500
|
+
title="Initialization Complete",
|
|
501
|
+
title_align="left",
|
|
502
|
+
)
|
|
404
503
|
)
|
|
405
|
-
)
|
|
406
504
|
except KeyboardInterrupt:
|
|
407
505
|
console.print("\n[bold red]System Aborted.[/bold red]")
|
|
408
506
|
sys.exit(1)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{create_pywire_app-0.1.1 → create_pywire_app-0.1.3}/src/create_pywire_app/templates/saas/models.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|