fastpluggy-cli 0.1.1__tar.gz → 0.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.
- {fastpluggy_cli-0.1.1 → fastpluggy_cli-0.1.2}/PKG-INFO +5 -5
- {fastpluggy_cli-0.1.1 → fastpluggy_cli-0.1.2}/fastpluggy_cli/cli.py +24 -1
- {fastpluggy_cli-0.1.1 → fastpluggy_cli-0.1.2}/fastpluggy_cli.egg-info/PKG-INFO +5 -5
- {fastpluggy_cli-0.1.1 → fastpluggy_cli-0.1.2}/fastpluggy_cli.egg-info/SOURCES.txt +1 -0
- {fastpluggy_cli-0.1.1 → fastpluggy_cli-0.1.2}/fastpluggy_cli.egg-info/requires.txt +4 -4
- {fastpluggy_cli-0.1.1 → fastpluggy_cli-0.1.2}/pyproject.toml +5 -5
- fastpluggy_cli-0.1.2/tests/test_start_dev_server.py +98 -0
- {fastpluggy_cli-0.1.1 → fastpluggy_cli-0.1.2}/MANIFEST.in +0 -0
- {fastpluggy_cli-0.1.1 → fastpluggy_cli-0.1.2}/README.md +0 -0
- {fastpluggy_cli-0.1.1 → fastpluggy_cli-0.1.2}/fastpluggy_cli/__init__.py +0 -0
- {fastpluggy_cli-0.1.1 → fastpluggy_cli-0.1.2}/fastpluggy_cli/scaffold_templates/main.py.j2 +0 -0
- {fastpluggy_cli-0.1.1 → fastpluggy_cli-0.1.2}/fastpluggy_cli/scaffold_templates/plugin/config.py.j2 +0 -0
- {fastpluggy_cli-0.1.1 → fastpluggy_cli-0.1.2}/fastpluggy_cli/scaffold_templates/plugin/index.html.j2 +0 -0
- {fastpluggy_cli-0.1.1 → fastpluggy_cli-0.1.2}/fastpluggy_cli/scaffold_templates/plugin/models/__init__.py.j2 +0 -0
- {fastpluggy_cli-0.1.1 → fastpluggy_cli-0.1.2}/fastpluggy_cli/scaffold_templates/plugin/models/context.py.j2 +0 -0
- {fastpluggy_cli-0.1.1 → fastpluggy_cli-0.1.2}/fastpluggy_cli/scaffold_templates/plugin/models/report.py.j2 +0 -0
- {fastpluggy_cli-0.1.1 → fastpluggy_cli-0.1.2}/fastpluggy_cli/scaffold_templates/plugin/models/scheduled.py.j2 +0 -0
- {fastpluggy_cli-0.1.1 → fastpluggy_cli-0.1.2}/fastpluggy_cli/scaffold_templates/plugin/plugin.py.j2 +0 -0
- {fastpluggy_cli-0.1.1 → fastpluggy_cli-0.1.2}/fastpluggy_cli/scaffold_templates/plugin/pyproject.toml.j2 +0 -0
- {fastpluggy_cli-0.1.1 → fastpluggy_cli-0.1.2}/fastpluggy_cli/scaffold_templates/plugin/router.py.j2 +0 -0
- {fastpluggy_cli-0.1.1 → fastpluggy_cli-0.1.2}/fastpluggy_cli/scaffold_templates/plugin/runner.py.j2 +0 -0
- {fastpluggy_cli-0.1.1 → fastpluggy_cli-0.1.2}/fastpluggy_cli/scaffold_templates/plugin/tasks/__init__.py.j2 +0 -0
- {fastpluggy_cli-0.1.1 → fastpluggy_cli-0.1.2}/fastpluggy_cli/scaffold_templates/plugin/tasks/maintenance.py.j2 +0 -0
- {fastpluggy_cli-0.1.1 → fastpluggy_cli-0.1.2}/fastpluggy_cli/scaffold_templates/plugin/tasks/plugin_update.py.j2 +0 -0
- {fastpluggy_cli-0.1.1 → fastpluggy_cli-0.1.2}/fastpluggy_cli/scaffold_templates/plugin/tasks/scheduler.py.j2 +0 -0
- {fastpluggy_cli-0.1.1 → fastpluggy_cli-0.1.2}/fastpluggy_cli.egg-info/dependency_links.txt +0 -0
- {fastpluggy_cli-0.1.1 → fastpluggy_cli-0.1.2}/fastpluggy_cli.egg-info/entry_points.txt +0 -0
- {fastpluggy_cli-0.1.1 → fastpluggy_cli-0.1.2}/fastpluggy_cli.egg-info/top_level.txt +0 -0
- {fastpluggy_cli-0.1.1 → fastpluggy_cli-0.1.2}/setup.cfg +0 -0
- {fastpluggy_cli-0.1.1 → fastpluggy_cli-0.1.2}/tests/test_cli.py +0 -0
- {fastpluggy_cli-0.1.1 → fastpluggy_cli-0.1.2}/tests/test_cli_commands.py +0 -0
- {fastpluggy_cli-0.1.1 → fastpluggy_cli-0.1.2}/tests/test_fix.py +0 -0
- {fastpluggy_cli-0.1.1 → fastpluggy_cli-0.1.2}/tests/test_new_plugin.py +0 -0
- {fastpluggy_cli-0.1.1 → fastpluggy_cli-0.1.2}/tests/test_plugin_commands.py +0 -0
- {fastpluggy_cli-0.1.1 → fastpluggy_cli-0.1.2}/tests/test_validate.py +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: fastpluggy-cli
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.2
|
|
4
4
|
Summary: A CLI tool to scaffold FastPluggy projects
|
|
5
5
|
Author: Jerome Vaillant
|
|
6
6
|
License-Expression: MIT
|
|
7
|
-
Requires-Dist: click==8.
|
|
7
|
+
Requires-Dist: click==8.4.2
|
|
8
8
|
Requires-Dist: jinja2
|
|
9
9
|
Requires-Dist: requests
|
|
10
10
|
Requires-Dist: questionary
|
|
@@ -14,7 +14,7 @@ Requires-Dist: fastapi
|
|
|
14
14
|
Provides-Extra: e2e
|
|
15
15
|
Requires-Dist: playwright; extra == "e2e"
|
|
16
16
|
Provides-Extra: dev
|
|
17
|
-
Requires-Dist: pytest==9.
|
|
18
|
-
Requires-Dist: pytest-cov==7.
|
|
17
|
+
Requires-Dist: pytest==9.1.1; extra == "dev"
|
|
18
|
+
Requires-Dist: pytest-cov==7.1.0; extra == "dev"
|
|
19
19
|
Provides-Extra: ssl
|
|
20
|
-
Requires-Dist: cryptography==
|
|
20
|
+
Requires-Dist: cryptography==49.0.0; extra == "ssl"
|
|
@@ -514,9 +514,17 @@ def _get_local_ips():
|
|
|
514
514
|
@click.option("--port", default=8000, show_default=True, help="Port to listen on")
|
|
515
515
|
@click.option("--host", default="127.0.0.1", show_default=True, help="Host to bind to")
|
|
516
516
|
@click.option("--reload", is_flag=True, default=False, help="Enable hot-reload (local dev only)")
|
|
517
|
+
@click.option(
|
|
518
|
+
"--reload-dir",
|
|
519
|
+
"reload_dirs",
|
|
520
|
+
multiple=True,
|
|
521
|
+
type=click.Path(exists=True, file_okay=False),
|
|
522
|
+
help="Directory to watch when --reload is set. Repeatable. Without it uvicorn "
|
|
523
|
+
"falls back to watching the current working directory.",
|
|
524
|
+
)
|
|
517
525
|
@click.option("--verbose", "-v", is_flag=True, default=False, help="Enable verbose/debug logging")
|
|
518
526
|
@click.option("--ssl", "use_ssl", is_flag=True, default=False, help="Enable HTTPS with auto-generated self-signed certificate")
|
|
519
|
-
def start_dev_server(port, host, reload, verbose, use_ssl):
|
|
527
|
+
def start_dev_server(port, host, reload, reload_dirs, verbose, use_ssl):
|
|
520
528
|
"""Start a FastPluggy development server.
|
|
521
529
|
|
|
522
530
|
Auto-discovers all installed FastPluggy plugins via the
|
|
@@ -563,6 +571,20 @@ def start_dev_server(port, host, reload, verbose, use_ssl):
|
|
|
563
571
|
cert_file, key_file = _generate_self_signed_cert(cert_dir)
|
|
564
572
|
ssl_kwargs = {"ssl_certfile": cert_file, "ssl_keyfile": key_file}
|
|
565
573
|
|
|
574
|
+
# Scope the reload watcher. Without this uvicorn watches the CURRENT WORKING
|
|
575
|
+
# DIRECTORY, which is fine for a single-package project and wrong for a repo
|
|
576
|
+
# whose plugin is a subdirectory: run from the root and it watches .git/ and
|
|
577
|
+
# node_modules/ too, which presents as "the dev server is slow", not as an
|
|
578
|
+
# error. Omitting the key entirely keeps uvicorn's own default, so callers
|
|
579
|
+
# that do not ask for this see no change.
|
|
580
|
+
reload_kwargs = {}
|
|
581
|
+
if reload_dirs:
|
|
582
|
+
if not reload:
|
|
583
|
+
click.echo("⚠️ --reload-dir has no effect without --reload; ignoring it.")
|
|
584
|
+
else:
|
|
585
|
+
reload_kwargs["reload_dirs"] = [str(Path(d).resolve()) for d in reload_dirs]
|
|
586
|
+
click.echo(f"👀 Watching: {', '.join(reload_kwargs['reload_dirs'])}")
|
|
587
|
+
|
|
566
588
|
protocol = "https" if use_ssl else "http"
|
|
567
589
|
click.echo(f"🚀 Starting FastPluggy dev server on {protocol}://{host}:{port} ...")
|
|
568
590
|
|
|
@@ -573,6 +595,7 @@ def start_dev_server(port, host, reload, verbose, use_ssl):
|
|
|
573
595
|
reload=reload,
|
|
574
596
|
factory=True,
|
|
575
597
|
log_level=log_level,
|
|
598
|
+
**reload_kwargs,
|
|
576
599
|
**ssl_kwargs,
|
|
577
600
|
)
|
|
578
601
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: fastpluggy-cli
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.2
|
|
4
4
|
Summary: A CLI tool to scaffold FastPluggy projects
|
|
5
5
|
Author: Jerome Vaillant
|
|
6
6
|
License-Expression: MIT
|
|
7
|
-
Requires-Dist: click==8.
|
|
7
|
+
Requires-Dist: click==8.4.2
|
|
8
8
|
Requires-Dist: jinja2
|
|
9
9
|
Requires-Dist: requests
|
|
10
10
|
Requires-Dist: questionary
|
|
@@ -14,7 +14,7 @@ Requires-Dist: fastapi
|
|
|
14
14
|
Provides-Extra: e2e
|
|
15
15
|
Requires-Dist: playwright; extra == "e2e"
|
|
16
16
|
Provides-Extra: dev
|
|
17
|
-
Requires-Dist: pytest==9.
|
|
18
|
-
Requires-Dist: pytest-cov==7.
|
|
17
|
+
Requires-Dist: pytest==9.1.1; extra == "dev"
|
|
18
|
+
Requires-Dist: pytest-cov==7.1.0; extra == "dev"
|
|
19
19
|
Provides-Extra: ssl
|
|
20
|
-
Requires-Dist: cryptography==
|
|
20
|
+
Requires-Dist: cryptography==49.0.0; extra == "ssl"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
click==8.
|
|
1
|
+
click==8.4.2
|
|
2
2
|
jinja2
|
|
3
3
|
requests
|
|
4
4
|
questionary
|
|
@@ -7,11 +7,11 @@ fastpluggy>=0.4.15
|
|
|
7
7
|
fastapi
|
|
8
8
|
|
|
9
9
|
[dev]
|
|
10
|
-
pytest==9.
|
|
11
|
-
pytest-cov==7.
|
|
10
|
+
pytest==9.1.1
|
|
11
|
+
pytest-cov==7.1.0
|
|
12
12
|
|
|
13
13
|
[e2e]
|
|
14
14
|
playwright
|
|
15
15
|
|
|
16
16
|
[ssl]
|
|
17
|
-
cryptography==
|
|
17
|
+
cryptography==49.0.0
|
|
@@ -4,14 +4,14 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "fastpluggy-cli"
|
|
7
|
-
version = "0.1.
|
|
7
|
+
version = "0.1.2"
|
|
8
8
|
description = "A CLI tool to scaffold FastPluggy projects"
|
|
9
9
|
authors = [
|
|
10
10
|
{ name="Jerome Vaillant" }
|
|
11
11
|
]
|
|
12
12
|
license = "MIT"
|
|
13
13
|
dependencies = [
|
|
14
|
-
"click==8.
|
|
14
|
+
"click==8.4.2",
|
|
15
15
|
"jinja2",
|
|
16
16
|
"requests",
|
|
17
17
|
"questionary",
|
|
@@ -26,11 +26,11 @@ e2e = [
|
|
|
26
26
|
]
|
|
27
27
|
|
|
28
28
|
dev = [
|
|
29
|
-
"pytest==9.
|
|
30
|
-
"pytest-cov==7.
|
|
29
|
+
"pytest==9.1.1",
|
|
30
|
+
"pytest-cov==7.1.0"
|
|
31
31
|
]
|
|
32
32
|
ssl = [
|
|
33
|
-
"cryptography==
|
|
33
|
+
"cryptography==49.0.0"
|
|
34
34
|
]
|
|
35
35
|
|
|
36
36
|
[tool.setuptools]
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"""`start-dev-server --reload-dir` (cli#3).
|
|
2
|
+
|
|
3
|
+
These assert on what reaches `uvicorn.run`, because that is where the bug lived:
|
|
4
|
+
without an explicit `reload_dirs`, uvicorn silently watches the current working
|
|
5
|
+
directory. For a repo whose plugin is a subdirectory that means watching `.git/`
|
|
6
|
+
and `node_modules/` — which presents as a slow dev server, never as an error.
|
|
7
|
+
"""
|
|
8
|
+
import pytest
|
|
9
|
+
from unittest.mock import patch
|
|
10
|
+
from click.testing import CliRunner
|
|
11
|
+
|
|
12
|
+
from fastpluggy_cli.cli import cli
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
@pytest.fixture
|
|
16
|
+
def runner():
|
|
17
|
+
return CliRunner()
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
@pytest.fixture
|
|
21
|
+
def fake_uvicorn():
|
|
22
|
+
"""Patch uvicorn so the server is never actually started."""
|
|
23
|
+
with patch("uvicorn.run") as run:
|
|
24
|
+
yield run
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def _kwargs(fake_uvicorn):
|
|
28
|
+
assert fake_uvicorn.called, "uvicorn.run was never reached"
|
|
29
|
+
return fake_uvicorn.call_args.kwargs
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def test_reload_dir_is_passed_through_resolved(runner, fake_uvicorn, tmp_path):
|
|
33
|
+
watched = tmp_path / "plugins" / "demo"
|
|
34
|
+
watched.mkdir(parents=True)
|
|
35
|
+
|
|
36
|
+
result = runner.invoke(cli, ["start-dev-server", "--reload", "--reload-dir", str(watched)])
|
|
37
|
+
assert result.exit_code == 0, result.output
|
|
38
|
+
|
|
39
|
+
kwargs = _kwargs(fake_uvicorn)
|
|
40
|
+
assert kwargs["reload"] is True
|
|
41
|
+
# Resolved, so a relative path on the command line still watches the right tree.
|
|
42
|
+
assert kwargs["reload_dirs"] == [str(watched.resolve())]
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def test_reload_dir_is_repeatable(runner, fake_uvicorn, tmp_path):
|
|
46
|
+
a = tmp_path / "a"; a.mkdir()
|
|
47
|
+
b = tmp_path / "b"; b.mkdir()
|
|
48
|
+
|
|
49
|
+
result = runner.invoke(
|
|
50
|
+
cli, ["start-dev-server", "--reload", "--reload-dir", str(a), "--reload-dir", str(b)]
|
|
51
|
+
)
|
|
52
|
+
assert result.exit_code == 0, result.output
|
|
53
|
+
assert _kwargs(fake_uvicorn)["reload_dirs"] == [str(a.resolve()), str(b.resolve())]
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def test_without_the_flag_uvicorn_keeps_its_own_default(runner, fake_uvicorn):
|
|
57
|
+
"""The regression guard: existing callers must be untouched.
|
|
58
|
+
|
|
59
|
+
`reload_dirs` must be ABSENT, not an empty list — an empty list would make
|
|
60
|
+
uvicorn watch nothing at all, which is a different bug from the one fixed.
|
|
61
|
+
"""
|
|
62
|
+
result = runner.invoke(cli, ["start-dev-server", "--reload"])
|
|
63
|
+
assert result.exit_code == 0, result.output
|
|
64
|
+
|
|
65
|
+
kwargs = _kwargs(fake_uvicorn)
|
|
66
|
+
assert kwargs["reload"] is True
|
|
67
|
+
assert "reload_dirs" not in kwargs
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def test_reload_dir_without_reload_warns_and_is_not_passed(runner, fake_uvicorn, tmp_path):
|
|
71
|
+
watched = tmp_path / "plugins"
|
|
72
|
+
watched.mkdir()
|
|
73
|
+
|
|
74
|
+
result = runner.invoke(cli, ["start-dev-server", "--reload-dir", str(watched)])
|
|
75
|
+
assert result.exit_code == 0, result.output
|
|
76
|
+
assert "no effect without --reload" in result.output
|
|
77
|
+
|
|
78
|
+
kwargs = _kwargs(fake_uvicorn)
|
|
79
|
+
assert kwargs["reload"] is False
|
|
80
|
+
assert "reload_dirs" not in kwargs
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
def test_a_missing_directory_is_rejected_by_click(runner, fake_uvicorn, tmp_path):
|
|
84
|
+
"""Fail fast on a typo rather than silently watching nothing."""
|
|
85
|
+
result = runner.invoke(
|
|
86
|
+
cli, ["start-dev-server", "--reload", "--reload-dir", str(tmp_path / "nope")]
|
|
87
|
+
)
|
|
88
|
+
assert result.exit_code != 0
|
|
89
|
+
assert not fake_uvicorn.called
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def test_a_file_is_rejected_by_click(runner, fake_uvicorn, tmp_path):
|
|
93
|
+
f = tmp_path / "run_local.py"
|
|
94
|
+
f.write_text("")
|
|
95
|
+
|
|
96
|
+
result = runner.invoke(cli, ["start-dev-server", "--reload", "--reload-dir", str(f)])
|
|
97
|
+
assert result.exit_code != 0
|
|
98
|
+
assert not fake_uvicorn.called
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fastpluggy_cli-0.1.1 → fastpluggy_cli-0.1.2}/fastpluggy_cli/scaffold_templates/plugin/config.py.j2
RENAMED
|
File without changes
|
{fastpluggy_cli-0.1.1 → fastpluggy_cli-0.1.2}/fastpluggy_cli/scaffold_templates/plugin/index.html.j2
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fastpluggy_cli-0.1.1 → fastpluggy_cli-0.1.2}/fastpluggy_cli/scaffold_templates/plugin/plugin.py.j2
RENAMED
|
File without changes
|
|
File without changes
|
{fastpluggy_cli-0.1.1 → fastpluggy_cli-0.1.2}/fastpluggy_cli/scaffold_templates/plugin/router.py.j2
RENAMED
|
File without changes
|
{fastpluggy_cli-0.1.1 → fastpluggy_cli-0.1.2}/fastpluggy_cli/scaffold_templates/plugin/runner.py.j2
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|