fast-dev-cli 0.7.2__tar.gz → 0.7.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.
- {fast_dev_cli-0.7.2 → fast_dev_cli-0.7.3}/PKG-INFO +6 -2
- {fast_dev_cli-0.7.2 → fast_dev_cli-0.7.3}/README.md +5 -1
- {fast_dev_cli-0.7.2 → fast_dev_cli-0.7.3}/fast_dev_cli/cli.py +21 -19
- {fast_dev_cli-0.7.2 → fast_dev_cli-0.7.3}/pyproject.toml +1 -1
- {fast_dev_cli-0.7.2 → fast_dev_cli-0.7.3}/LICENSE +0 -0
- {fast_dev_cli-0.7.2 → fast_dev_cli-0.7.3}/fast_dev_cli/__init__.py +0 -0
- {fast_dev_cli-0.7.2 → fast_dev_cli-0.7.3}/fast_dev_cli/__main__.py +0 -0
- {fast_dev_cli-0.7.2 → fast_dev_cli-0.7.3}/fast_dev_cli/py.typed +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: fast-dev-cli
|
|
3
|
-
Version: 0.7.
|
|
3
|
+
Version: 0.7.3
|
|
4
4
|
Summary:
|
|
5
5
|
Author: Waket Zheng
|
|
6
6
|
Author-email: waketzheng@gmail.com
|
|
@@ -54,7 +54,7 @@ Description-Content-Type: text/markdown
|
|
|
54
54
|
|
|
55
55
|
## Requirements
|
|
56
56
|
|
|
57
|
-
Python 3.
|
|
57
|
+
Python 3.10+
|
|
58
58
|
|
|
59
59
|
## Installation
|
|
60
60
|
|
|
@@ -94,4 +94,8 @@ fast sync
|
|
|
94
94
|
```bash
|
|
95
95
|
fast upgrade
|
|
96
96
|
```
|
|
97
|
+
- Start a fastapi server in development mode
|
|
98
|
+
```
|
|
99
|
+
fast dev
|
|
100
|
+
```
|
|
97
101
|
|
|
@@ -17,7 +17,7 @@ else: # pragma: no cover
|
|
|
17
17
|
from strenum import StrEnum # type:ignore[no-redef,assignment]
|
|
18
18
|
from typing_extensions import Self
|
|
19
19
|
|
|
20
|
-
if TYPE_CHECKING:
|
|
20
|
+
if TYPE_CHECKING: # pragma: no cover
|
|
21
21
|
from typer.models import OptionInfo
|
|
22
22
|
|
|
23
23
|
|
|
@@ -42,7 +42,7 @@ except ModuleNotFoundError:
|
|
|
42
42
|
from click.core import Group as _Group
|
|
43
43
|
from click.exceptions import Exit
|
|
44
44
|
|
|
45
|
-
def Option(default, *shortcuts,
|
|
45
|
+
def Option(default, *shortcuts, **kw): # type:ignore[no-redef]
|
|
46
46
|
return default
|
|
47
47
|
|
|
48
48
|
def _command(self, *args, **kwargs):
|
|
@@ -98,6 +98,7 @@ def _run_shell(cmd: str, **kw) -> CompletedProcess:
|
|
|
98
98
|
|
|
99
99
|
|
|
100
100
|
def run_and_echo(cmd: str, *, dry=False, verbose=True, **kw) -> int:
|
|
101
|
+
"""Run shell command with subprocess and print it"""
|
|
101
102
|
if verbose:
|
|
102
103
|
echo(f"--> {cmd}")
|
|
103
104
|
if dry:
|
|
@@ -120,8 +121,7 @@ def capture_cmd_output(command: list[str] | str, **kw) -> str:
|
|
|
120
121
|
def get_current_version(verbose=False) -> str:
|
|
121
122
|
cmd = ["poetry", "version", "-s"]
|
|
122
123
|
if verbose:
|
|
123
|
-
|
|
124
|
-
echo(f"--> {command}")
|
|
124
|
+
echo(f"--> {' '.join(cmd)}")
|
|
125
125
|
return capture_cmd_output(cmd)
|
|
126
126
|
|
|
127
127
|
|
|
@@ -231,7 +231,7 @@ def bump_version(
|
|
|
231
231
|
dry: bool = Option(False, "--dry", help="Only print, not really run shell command"),
|
|
232
232
|
) -> None:
|
|
233
233
|
"""Bump up version string in pyproject.toml"""
|
|
234
|
-
return BumpUp(_ensure_bool(commit), part
|
|
234
|
+
return BumpUp(_ensure_bool(commit), getattr(part, "value", part), dry=dry).run()
|
|
235
235
|
|
|
236
236
|
|
|
237
237
|
def bump() -> None:
|
|
@@ -246,7 +246,8 @@ def bump() -> None:
|
|
|
246
246
|
return BumpUp(commit, part, dry="--dry" in args).run()
|
|
247
247
|
|
|
248
248
|
|
|
249
|
-
class EnvError(Exception):
|
|
249
|
+
class EnvError(Exception):
|
|
250
|
+
"""Raise this when the project is expected to be managed by poetry, but toml file not found."""
|
|
250
251
|
|
|
251
252
|
|
|
252
253
|
class Project:
|
|
@@ -458,7 +459,8 @@ class GitTag(DryRun):
|
|
|
458
459
|
self.message = message
|
|
459
460
|
super().__init__(dry=dry)
|
|
460
461
|
|
|
461
|
-
|
|
462
|
+
@staticmethod
|
|
463
|
+
def has_v_prefix() -> bool:
|
|
462
464
|
return "v" in capture_cmd_output("git tag")
|
|
463
465
|
|
|
464
466
|
def should_push(self: Self) -> bool:
|
|
@@ -614,15 +616,6 @@ def _should_run_test_script(path: Path) -> bool:
|
|
|
614
616
|
return path.exists()
|
|
615
617
|
|
|
616
618
|
|
|
617
|
-
@cli.command(name="test")
|
|
618
|
-
def coverage_test(
|
|
619
|
-
dry: bool = Option(False, "--dry", help="Only print, not really run shell command"),
|
|
620
|
-
ignore_script: bool = Option(False, "--ignore-script", "-i"),
|
|
621
|
-
) -> None:
|
|
622
|
-
"""Run unittest by pytest and report coverage"""
|
|
623
|
-
return test(dry, ignore_script)
|
|
624
|
-
|
|
625
|
-
|
|
626
619
|
def test(dry: bool, ignore_script=False) -> None:
|
|
627
620
|
cwd = Path.cwd()
|
|
628
621
|
root = Project.get_work_dir(cwd=cwd, allow_cwd=True)
|
|
@@ -639,6 +632,15 @@ def test(dry: bool, ignore_script=False) -> None:
|
|
|
639
632
|
exit_if_run_failed(cmd, dry=dry)
|
|
640
633
|
|
|
641
634
|
|
|
635
|
+
@cli.command(name="test")
|
|
636
|
+
def coverage_test(
|
|
637
|
+
dry: bool = Option(False, "--dry", help="Only print, not really run shell command"),
|
|
638
|
+
ignore_script: bool = Option(False, "--ignore-script", "-i"),
|
|
639
|
+
) -> None:
|
|
640
|
+
"""Run unittest by pytest and report coverage"""
|
|
641
|
+
return test(dry, ignore_script)
|
|
642
|
+
|
|
643
|
+
|
|
642
644
|
@cli.command()
|
|
643
645
|
def upload(
|
|
644
646
|
dry: bool = Option(False, "--dry", help="Only print, not really run shell command"),
|
|
@@ -668,9 +670,9 @@ def runserver(
|
|
|
668
670
|
host: Optional[str] = Option(None, "-h", "--host"),
|
|
669
671
|
dry: bool = Option(False, "--dry", help="Only print, not really run shell command"),
|
|
670
672
|
) -> None:
|
|
671
|
-
"""
|
|
673
|
+
"""Start a fastapi server(only for fastapi>=0.111.0)"""
|
|
672
674
|
dev(port, host, dry=dry)
|
|
673
675
|
|
|
674
676
|
|
|
675
|
-
if __name__ == "__main__":
|
|
676
|
-
cli()
|
|
677
|
+
if __name__ == "__main__": # pragma: no cover
|
|
678
|
+
cli()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|