create-awesome-python-app 0.2.9__tar.gz → 0.2.10__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_awesome_python_app-0.2.9 → create_awesome_python_app-0.2.10}/PKG-INFO +2 -2
- {create_awesome_python_app-0.2.9 → create_awesome_python_app-0.2.10}/pyproject.toml +2 -2
- {create_awesome_python_app-0.2.9 → create_awesome_python_app-0.2.10}/src/create_awesome_python_app/__init__.py +1 -1
- {create_awesome_python_app-0.2.9 → create_awesome_python_app-0.2.10}/src/create_awesome_python_app/cli.py +38 -18
- {create_awesome_python_app-0.2.9 → create_awesome_python_app-0.2.10}/tests/test_cli.py +88 -0
- {create_awesome_python_app-0.2.9 → create_awesome_python_app-0.2.10}/.gitignore +0 -0
- {create_awesome_python_app-0.2.9 → create_awesome_python_app-0.2.10}/README.md +0 -0
- {create_awesome_python_app-0.2.9 → create_awesome_python_app-0.2.10}/assets/hero.svg +0 -0
- {create_awesome_python_app-0.2.9 → create_awesome_python_app-0.2.10}/src/create_awesome_python_app/cache.py +0 -0
- {create_awesome_python_app-0.2.9 → create_awesome_python_app-0.2.10}/src/create_awesome_python_app/catalog.py +0 -0
- {create_awesome_python_app-0.2.9 → create_awesome_python_app-0.2.10}/src/create_awesome_python_app/prompt_style.py +0 -0
- {create_awesome_python_app-0.2.9 → create_awesome_python_app-0.2.10}/tests/conftest.py +0 -0
- {create_awesome_python_app-0.2.9 → create_awesome_python_app-0.2.10}/tests/test_cache_cmds.py +0 -0
- {create_awesome_python_app-0.2.9 → create_awesome_python_app-0.2.10}/tests/test_cache_env.py +0 -0
- {create_awesome_python_app-0.2.9 → create_awesome_python_app-0.2.10}/tests/test_catalog.py +0 -0
- {create_awesome_python_app-0.2.9 → create_awesome_python_app-0.2.10}/tests/test_catalog_fetch.py +0 -0
- {create_awesome_python_app-0.2.9 → create_awesome_python_app-0.2.10}/tests/test_catalog_resolve.py +0 -0
- {create_awesome_python_app-0.2.9 → create_awesome_python_app-0.2.10}/tests/test_cpa_templates_integration.py +0 -0
- {create_awesome_python_app-0.2.9 → create_awesome_python_app-0.2.10}/tests/test_flags.py +0 -0
- {create_awesome_python_app-0.2.9 → create_awesome_python_app-0.2.10}/tests/test_interactive.py +0 -0
- {create_awesome_python_app-0.2.9 → create_awesome_python_app-0.2.10}/tests/test_smoke.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: create-awesome-python-app
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.10
|
|
4
4
|
Summary: Composable scaffolding CLI for production-ready Python apps
|
|
5
5
|
Project-URL: Homepage, https://github.com/Create-Python-App/create-python-app
|
|
6
6
|
Project-URL: Repository, https://github.com/Create-Python-App/create-python-app
|
|
@@ -8,7 +8,7 @@ Project-URL: Issues, https://github.com/Create-Python-App/create-python-app/issu
|
|
|
8
8
|
Project-URL: Changelog, https://github.com/Create-Python-App/create-python-app/blob/main/CHANGELOG.md
|
|
9
9
|
License-Expression: MIT
|
|
10
10
|
Requires-Python: >=3.12
|
|
11
|
-
Requires-Dist: create-python-app-core>=0.2.
|
|
11
|
+
Requires-Dist: create-python-app-core>=0.2.10
|
|
12
12
|
Requires-Dist: questionary>=2.1.1
|
|
13
13
|
Requires-Dist: rich>=15.0.0
|
|
14
14
|
Requires-Dist: typer>=0.27.0
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "create-awesome-python-app"
|
|
3
|
-
version = "0.2.
|
|
3
|
+
version = "0.2.10"
|
|
4
4
|
description = "Composable scaffolding CLI for production-ready Python apps"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.12"
|
|
7
7
|
license = "MIT"
|
|
8
8
|
dependencies = [
|
|
9
|
-
"create-python-app-core>=0.2.
|
|
9
|
+
"create-python-app-core>=0.2.10",
|
|
10
10
|
"questionary>=2.1.1",
|
|
11
11
|
"rich>=15.0.0",
|
|
12
12
|
"typer>=0.27.0",
|
|
@@ -12,6 +12,8 @@ import typer
|
|
|
12
12
|
from create_python_app_core import (
|
|
13
13
|
ConfigParseError,
|
|
14
14
|
CpaCustomOption,
|
|
15
|
+
NonEmptyTargetDirectoryError,
|
|
16
|
+
assert_directory_is_empty,
|
|
15
17
|
check_for_latest_version,
|
|
16
18
|
check_python_version,
|
|
17
19
|
create_python_app,
|
|
@@ -323,6 +325,18 @@ def scaffold(
|
|
|
323
325
|
la(template)
|
|
324
326
|
raise typer.Exit(0)
|
|
325
327
|
|
|
328
|
+
target_directory = project_directory or "my-project"
|
|
329
|
+
# Fail before the interactive wizard so a leftover `my-project/` does not
|
|
330
|
+
# waste a full prompt session (and so we exit cleanly, not with a traceback).
|
|
331
|
+
if not force:
|
|
332
|
+
try:
|
|
333
|
+
assert_directory_is_empty(
|
|
334
|
+
Path(target_directory).expanduser().resolve(), force=False
|
|
335
|
+
)
|
|
336
|
+
except NonEmptyTargetDirectoryError as err:
|
|
337
|
+
console.print(f"[red]{err}[/red]")
|
|
338
|
+
raise typer.Exit(1) from err
|
|
339
|
+
|
|
326
340
|
effective_refresh = _normalize_refresh(refresh)
|
|
327
341
|
if refresh and effective_refresh is None:
|
|
328
342
|
console.print(
|
|
@@ -540,25 +554,31 @@ def scaffold(
|
|
|
540
554
|
raise typer.Exit(1)
|
|
541
555
|
console.print(f"[yellow]{msg}[/yellow]")
|
|
542
556
|
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
557
|
+
try:
|
|
558
|
+
asyncio.run(
|
|
559
|
+
create_python_app(
|
|
560
|
+
target_directory,
|
|
561
|
+
{
|
|
562
|
+
"template": template,
|
|
563
|
+
"addons": addons or [],
|
|
564
|
+
"extend": extend or [],
|
|
565
|
+
"install": not no_install,
|
|
566
|
+
"force": force,
|
|
567
|
+
"verbose": verbose,
|
|
568
|
+
"offline": offline,
|
|
569
|
+
"refresh": effective_refresh,
|
|
570
|
+
"keep_on_failure": keep_on_failure,
|
|
571
|
+
"cache_dir": str(cache_dir) if cache_dir else None,
|
|
572
|
+
"set": set_map,
|
|
573
|
+
},
|
|
574
|
+
)
|
|
559
575
|
)
|
|
560
|
-
|
|
561
|
-
|
|
576
|
+
except NonEmptyTargetDirectoryError as err:
|
|
577
|
+
# Safety net if the target fills up after the early check (e.g. during
|
|
578
|
+
# a long interactive session).
|
|
579
|
+
console.print(f"[red]{err}[/red]")
|
|
580
|
+
raise typer.Exit(1) from err
|
|
581
|
+
console.print(f"[green]Created[/green] {target_directory}")
|
|
562
582
|
|
|
563
583
|
|
|
564
584
|
@cache_app.command("dir")
|
|
@@ -541,3 +541,91 @@ def test_list_templates_with_fixture_dir(
|
|
|
541
541
|
assert result.exit_code == 0, text
|
|
542
542
|
assert "fixture-only" in text
|
|
543
543
|
assert os.environ.get("CPA_CATALOG_FIXTURE") == "1"
|
|
544
|
+
|
|
545
|
+
|
|
546
|
+
def test_non_empty_target_fails_before_scaffold(
|
|
547
|
+
tmp_path: Path, monkeypatch: pytest.MonkeyPatch
|
|
548
|
+
) -> None:
|
|
549
|
+
"""Leftover target dir must fail immediately — not after interactive work."""
|
|
550
|
+
target = tmp_path / "existing"
|
|
551
|
+
target.mkdir()
|
|
552
|
+
(target / "leftover.txt").write_text("already here", encoding="utf-8")
|
|
553
|
+
tpl = tmp_path / "tpl"
|
|
554
|
+
tpl.mkdir()
|
|
555
|
+
called: dict[str, bool] = {"create": False}
|
|
556
|
+
|
|
557
|
+
async def fake_check_for_latest_version(_package_name):
|
|
558
|
+
return None
|
|
559
|
+
|
|
560
|
+
async def fake_create_python_app(*_args, **_kwargs):
|
|
561
|
+
called["create"] = True
|
|
562
|
+
|
|
563
|
+
monkeypatch.setattr(
|
|
564
|
+
"create_awesome_python_app.cli.check_for_latest_version",
|
|
565
|
+
fake_check_for_latest_version,
|
|
566
|
+
)
|
|
567
|
+
monkeypatch.setattr(
|
|
568
|
+
"create_awesome_python_app.cli.create_python_app",
|
|
569
|
+
fake_create_python_app,
|
|
570
|
+
)
|
|
571
|
+
|
|
572
|
+
result = runner.invoke(
|
|
573
|
+
app,
|
|
574
|
+
[
|
|
575
|
+
"--template",
|
|
576
|
+
f"file://{tpl}",
|
|
577
|
+
"--no-install",
|
|
578
|
+
"--no-interactive",
|
|
579
|
+
str(target),
|
|
580
|
+
],
|
|
581
|
+
)
|
|
582
|
+
text = (result.stdout or "") + (result.stderr or "")
|
|
583
|
+
assert result.exit_code == 1, text
|
|
584
|
+
assert "not empty" in text.lower()
|
|
585
|
+
assert "--force" in text
|
|
586
|
+
assert called["create"] is False
|
|
587
|
+
|
|
588
|
+
|
|
589
|
+
def test_non_empty_target_allows_force(
|
|
590
|
+
tmp_path: Path, monkeypatch: pytest.MonkeyPatch
|
|
591
|
+
) -> None:
|
|
592
|
+
target = tmp_path / "existing"
|
|
593
|
+
target.mkdir()
|
|
594
|
+
(target / "leftover.txt").write_text("already here", encoding="utf-8")
|
|
595
|
+
tpl = tmp_path / "tpl"
|
|
596
|
+
tpl.mkdir()
|
|
597
|
+
captured: dict[str, object] = {}
|
|
598
|
+
|
|
599
|
+
async def fake_check_for_latest_version(_package_name):
|
|
600
|
+
return None
|
|
601
|
+
|
|
602
|
+
async def fake_create_python_app(project_directory, options, *_args, **_kwargs):
|
|
603
|
+
captured["project_directory"] = project_directory
|
|
604
|
+
captured["options"] = options
|
|
605
|
+
|
|
606
|
+
monkeypatch.setattr(
|
|
607
|
+
"create_awesome_python_app.cli.check_for_latest_version",
|
|
608
|
+
fake_check_for_latest_version,
|
|
609
|
+
)
|
|
610
|
+
monkeypatch.setattr(
|
|
611
|
+
"create_awesome_python_app.cli.create_python_app",
|
|
612
|
+
fake_create_python_app,
|
|
613
|
+
)
|
|
614
|
+
|
|
615
|
+
result = runner.invoke(
|
|
616
|
+
app,
|
|
617
|
+
[
|
|
618
|
+
"--template",
|
|
619
|
+
f"file://{tpl}",
|
|
620
|
+
"--force",
|
|
621
|
+
"--no-install",
|
|
622
|
+
"--no-interactive",
|
|
623
|
+
str(target),
|
|
624
|
+
],
|
|
625
|
+
)
|
|
626
|
+
text = (result.stdout or "") + (result.stderr or "")
|
|
627
|
+
assert result.exit_code == 0, text
|
|
628
|
+
assert captured["project_directory"] == str(target)
|
|
629
|
+
options = captured["options"]
|
|
630
|
+
assert isinstance(options, dict)
|
|
631
|
+
assert options["force"] is True
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{create_awesome_python_app-0.2.9 → create_awesome_python_app-0.2.10}/tests/test_cache_cmds.py
RENAMED
|
File without changes
|
{create_awesome_python_app-0.2.9 → create_awesome_python_app-0.2.10}/tests/test_cache_env.py
RENAMED
|
File without changes
|
|
File without changes
|
{create_awesome_python_app-0.2.9 → create_awesome_python_app-0.2.10}/tests/test_catalog_fetch.py
RENAMED
|
File without changes
|
{create_awesome_python_app-0.2.9 → create_awesome_python_app-0.2.10}/tests/test_catalog_resolve.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{create_awesome_python_app-0.2.9 → create_awesome_python_app-0.2.10}/tests/test_interactive.py
RENAMED
|
File without changes
|
|
File without changes
|