fast-dev-cli 0.8.2__tar.gz → 0.9.0__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.8.2 → fast_dev_cli-0.9.0}/PKG-INFO +9 -4
- {fast_dev_cli-0.8.2 → fast_dev_cli-0.9.0}/README.md +5 -0
- fast_dev_cli-0.9.0/fast_dev_cli/__init__.py +1 -0
- fast_dev_cli-0.9.0/fast_dev_cli/__main__.py +3 -0
- {fast_dev_cli-0.8.2 → fast_dev_cli-0.9.0}/fast_dev_cli/cli.py +34 -29
- {fast_dev_cli-0.8.2 → fast_dev_cli-0.9.0}/pyproject.toml +11 -7
- {fast_dev_cli-0.8.2 → fast_dev_cli-0.9.0}/scripts/check.sh +2 -0
- {fast_dev_cli-0.8.2 → fast_dev_cli-0.9.0}/tests/test_bump.py +1 -1
- {fast_dev_cli-0.8.2 → fast_dev_cli-0.9.0}/tests/test_lint.py +3 -3
- fast_dev_cli-0.8.2/fast_dev_cli/__init__.py +0 -31
- fast_dev_cli-0.8.2/fast_dev_cli/__main__.py +0 -3
- fast_dev_cli-0.8.2/tests/test_import.py +0 -12
- {fast_dev_cli-0.8.2 → fast_dev_cli-0.9.0}/LICENSE +0 -0
- {fast_dev_cli-0.8.2 → fast_dev_cli-0.9.0}/fast_dev_cli/py.typed +0 -0
- {fast_dev_cli-0.8.2 → fast_dev_cli-0.9.0}/pdm_build.py +0 -0
- {fast_dev_cli-0.8.2 → fast_dev_cli-0.9.0}/scripts/format.sh +0 -0
- {fast_dev_cli-0.8.2 → fast_dev_cli-0.9.0}/scripts/test.sh +0 -0
- {fast_dev_cli-0.8.2 → fast_dev_cli-0.9.0}/tests/__init__.py +0 -0
- {fast_dev_cli-0.8.2 → fast_dev_cli-0.9.0}/tests/conftest.py +0 -0
- {fast_dev_cli-0.8.2 → fast_dev_cli-0.9.0}/tests/test_fast_test.py +0 -0
- {fast_dev_cli-0.8.2 → fast_dev_cli-0.9.0}/tests/test_functions.py +0 -0
- {fast_dev_cli-0.8.2 → fast_dev_cli-0.9.0}/tests/test_runserver.py +0 -0
- {fast_dev_cli-0.8.2 → fast_dev_cli-0.9.0}/tests/test_sync.py +0 -0
- {fast_dev_cli-0.8.2 → fast_dev_cli-0.9.0}/tests/test_tag.py +0 -0
- {fast_dev_cli-0.8.2 → fast_dev_cli-0.9.0}/tests/test_upgrade.py +0 -0
- {fast_dev_cli-0.8.2 → fast_dev_cli-0.9.0}/tests/test_upload.py +0 -0
- {fast_dev_cli-0.8.2 → fast_dev_cli-0.9.0}/tests/test_version.py +0 -0
- {fast_dev_cli-0.8.2 → fast_dev_cli-0.9.0}/tests/utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: fast-dev-cli
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.9.0
|
|
4
4
|
Summary: Python project development tool.
|
|
5
5
|
Author-Email: Waket Zheng <waketzheng@gmail.com>>
|
|
6
6
|
Classifier: Development Status :: 4 - Beta
|
|
@@ -12,17 +12,17 @@ Classifier: Programming Language :: Python :: 3 :: Only
|
|
|
12
12
|
Classifier: Programming Language :: Python :: 3.10
|
|
13
13
|
Classifier: Programming Language :: Python :: 3.11
|
|
14
14
|
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
15
16
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
16
17
|
Classifier: Topic :: Software Development :: Libraries
|
|
17
18
|
Classifier: Topic :: Software Development
|
|
18
19
|
Classifier: Typing :: Typed
|
|
19
20
|
Classifier: License :: OSI Approved :: MIT License
|
|
20
21
|
Project-URL: Homepage, https://github.com/waketzheng/fast-dev-cli
|
|
21
|
-
Requires-Python: <
|
|
22
|
+
Requires-Python: <4,>=3.10
|
|
22
23
|
Requires-Dist: typer<0.13,>=0.12.3
|
|
23
|
-
Requires-Dist: typing-extensions>=4.8.0
|
|
24
24
|
Requires-Dist: coverage<8,>=7.5.1
|
|
25
|
-
Requires-Dist: ruff<0.
|
|
25
|
+
Requires-Dist: ruff<0.6,>=0.4.4
|
|
26
26
|
Requires-Dist: mypy<2,>=1.10.0
|
|
27
27
|
Requires-Dist: bumpversion<0.7,>=0.6.0
|
|
28
28
|
Requires-Dist: pytest<9,>=8.2.0
|
|
@@ -56,12 +56,17 @@ Description-Content-Type: text/markdown
|
|
|
56
56
|
<a href="https://github.com/python/mypy" target="_blank">
|
|
57
57
|
<img src="https://img.shields.io/badge/mypy-100%25-green.svg" alt="Mypy Coverage">
|
|
58
58
|
</a>
|
|
59
|
+
<a href="https://github.com/PyCQA/bandit" target="_blank">
|
|
60
|
+
<img src="https://img.shields.io/badge/security-bandit-yellow.svg" alt="security: bandit">
|
|
61
|
+
</a>
|
|
59
62
|
</p>
|
|
60
63
|
|
|
61
64
|
---
|
|
62
65
|
|
|
63
66
|
**Source Code**: <a href="https://github.com/waketzheng/fast-dev-cli" target="_blank">https://github.com/waketzheng/fast-dev-cli</a>
|
|
64
67
|
|
|
68
|
+
**English** | [中文](./README.zh.md)
|
|
69
|
+
|
|
65
70
|
## Requirements
|
|
66
71
|
|
|
67
72
|
Python 3.10+
|
|
@@ -23,12 +23,17 @@
|
|
|
23
23
|
<a href="https://github.com/python/mypy" target="_blank">
|
|
24
24
|
<img src="https://img.shields.io/badge/mypy-100%25-green.svg" alt="Mypy Coverage">
|
|
25
25
|
</a>
|
|
26
|
+
<a href="https://github.com/PyCQA/bandit" target="_blank">
|
|
27
|
+
<img src="https://img.shields.io/badge/security-bandit-yellow.svg" alt="security: bandit">
|
|
28
|
+
</a>
|
|
26
29
|
</p>
|
|
27
30
|
|
|
28
31
|
---
|
|
29
32
|
|
|
30
33
|
**Source Code**: <a href="https://github.com/waketzheng/fast-dev-cli" target="_blank">https://github.com/waketzheng/fast-dev-cli</a>
|
|
31
34
|
|
|
35
|
+
**English** | [中文](./README.zh.md)
|
|
36
|
+
|
|
32
37
|
## Requirements
|
|
33
38
|
|
|
34
39
|
Python 3.10+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.9.0"
|
|
@@ -3,41 +3,39 @@ from __future__ import annotations
|
|
|
3
3
|
import importlib.metadata as importlib_metadata
|
|
4
4
|
import os
|
|
5
5
|
import re
|
|
6
|
-
import subprocess
|
|
6
|
+
import subprocess # nosec:B404
|
|
7
7
|
import sys
|
|
8
8
|
from functools import cached_property
|
|
9
9
|
from pathlib import Path
|
|
10
|
-
from
|
|
11
|
-
from typing import TYPE_CHECKING, Literal, Optional, Type
|
|
10
|
+
from typing import Literal, Optional, Type
|
|
12
11
|
|
|
13
12
|
import typer
|
|
14
13
|
from typer import Exit, Option, echo, secho
|
|
15
|
-
from
|
|
14
|
+
from typer.models import OptionInfo
|
|
15
|
+
|
|
16
|
+
try:
|
|
17
|
+
from . import __version__
|
|
18
|
+
except ImportError: # pragma: no cover
|
|
19
|
+
from importlib import import_module as _import # For local unittest
|
|
20
|
+
|
|
21
|
+
__version__ = _import(Path(__file__).parent.name).__version__
|
|
16
22
|
|
|
17
23
|
if sys.version_info >= (3, 11):
|
|
18
24
|
from enum import StrEnum
|
|
25
|
+
from typing import Annotated, Self
|
|
19
26
|
else: # pragma: no cover
|
|
20
27
|
from enum import Enum
|
|
21
28
|
|
|
29
|
+
from typing_extensions import Annotated, Self
|
|
30
|
+
|
|
22
31
|
class StrEnum(str, Enum):
|
|
23
32
|
__str__ = str.__str__
|
|
24
33
|
|
|
25
34
|
|
|
26
|
-
if TYPE_CHECKING: # pragma: no cover
|
|
27
|
-
from typer.models import OptionInfo
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
__version__ = "0.8.2"
|
|
31
|
-
|
|
32
|
-
|
|
33
35
|
def parse_files(args: list[str] | tuple[str, ...]) -> list[str]:
|
|
34
36
|
return [i for i in args if not i.startswith("-")]
|
|
35
37
|
|
|
36
38
|
|
|
37
|
-
if len(sys.argv) >= 2 and sys.argv[1] == "lint":
|
|
38
|
-
if not parse_files(sys.argv[2:]):
|
|
39
|
-
sys.argv.append(".")
|
|
40
|
-
|
|
41
39
|
TOML_FILE = "pyproject.toml"
|
|
42
40
|
cli = typer.Typer()
|
|
43
41
|
|
|
@@ -55,9 +53,10 @@ def is_venv() -> bool:
|
|
|
55
53
|
)
|
|
56
54
|
|
|
57
55
|
|
|
58
|
-
def _run_shell(cmd: str, **kw) -> CompletedProcess:
|
|
59
|
-
|
|
60
|
-
|
|
56
|
+
def _run_shell(cmd: list[str] | str, **kw) -> subprocess.CompletedProcess:
|
|
57
|
+
if isinstance(cmd, str):
|
|
58
|
+
kw.setdefault("shell", True)
|
|
59
|
+
return subprocess.run(cmd, **kw) # nosec:B603
|
|
61
60
|
|
|
62
61
|
|
|
63
62
|
def run_and_echo(cmd: str, *, dry=False, verbose=True, **kw) -> int:
|
|
@@ -77,7 +76,7 @@ def check_call(cmd: str) -> bool:
|
|
|
77
76
|
def capture_cmd_output(command: list[str] | str, **kw) -> str:
|
|
78
77
|
if isinstance(command, str) and not kw.get("shell"):
|
|
79
78
|
command = command.split()
|
|
80
|
-
r =
|
|
79
|
+
r = _run_shell(command, capture_output=True, **kw)
|
|
81
80
|
return r.stdout.strip().decode()
|
|
82
81
|
|
|
83
82
|
|
|
@@ -96,7 +95,7 @@ def get_current_version(
|
|
|
96
95
|
return capture_cmd_output(cmd)
|
|
97
96
|
|
|
98
97
|
|
|
99
|
-
def _ensure_bool(value: bool |
|
|
98
|
+
def _ensure_bool(value: bool | OptionInfo) -> bool:
|
|
100
99
|
if not isinstance(value, bool):
|
|
101
100
|
value = getattr(value, "default", False)
|
|
102
101
|
return value
|
|
@@ -104,10 +103,10 @@ def _ensure_bool(value: bool | "OptionInfo") -> bool:
|
|
|
104
103
|
|
|
105
104
|
def exit_if_run_failed(
|
|
106
105
|
cmd: str, env=None, _exit=False, dry=False, **kw
|
|
107
|
-
) -> CompletedProcess:
|
|
106
|
+
) -> subprocess.CompletedProcess:
|
|
108
107
|
run_and_echo(cmd, dry=True)
|
|
109
108
|
if _ensure_bool(dry):
|
|
110
|
-
return CompletedProcess("", 0)
|
|
109
|
+
return subprocess.CompletedProcess("", 0)
|
|
111
110
|
if env is not None:
|
|
112
111
|
env = {**os.environ, **env}
|
|
113
112
|
r = _run_shell(cmd, env=env, **kw)
|
|
@@ -202,7 +201,7 @@ class BumpUp(DryRun):
|
|
|
202
201
|
@cli.command()
|
|
203
202
|
def version() -> None:
|
|
204
203
|
"""Show the version of this tool"""
|
|
205
|
-
echo(__version__)
|
|
204
|
+
echo(f"Fast Dev Cli version: {__version__}")
|
|
206
205
|
|
|
207
206
|
|
|
208
207
|
@cli.command(name="bump")
|
|
@@ -550,7 +549,7 @@ class LintCode(DryRun):
|
|
|
550
549
|
return cmd
|
|
551
550
|
|
|
552
551
|
def gen(self: Self) -> str:
|
|
553
|
-
paths = " ".join(self.args) if self.args else "."
|
|
552
|
+
paths = " ".join(map(str, self.args)) if self.args else "."
|
|
554
553
|
return self.to_cmd(paths, self.check_only)
|
|
555
554
|
|
|
556
555
|
|
|
@@ -568,12 +567,14 @@ def check(files=None, dry=False) -> None:
|
|
|
568
567
|
|
|
569
568
|
@cli.command(name="lint")
|
|
570
569
|
def make_style(
|
|
571
|
-
files: list[
|
|
570
|
+
files: Annotated[Optional[list[Path]], typer.Argument()] = None,
|
|
572
571
|
check_only: bool = Option(False, "--check-only", "-c"),
|
|
573
572
|
dry: bool = Option(False, "--dry", help="Only print, not really run shell command"),
|
|
574
573
|
) -> None:
|
|
575
574
|
"""Run: ruff check/format to reformat code and then mypy to check"""
|
|
576
|
-
if
|
|
575
|
+
if files is None:
|
|
576
|
+
files = [Path(".")]
|
|
577
|
+
elif isinstance(files, str):
|
|
577
578
|
files = [files]
|
|
578
579
|
if _ensure_bool(check_only):
|
|
579
580
|
check(files, dry=dry)
|
|
@@ -666,8 +667,8 @@ def upload(
|
|
|
666
667
|
|
|
667
668
|
|
|
668
669
|
def dev(
|
|
669
|
-
port: int | None |
|
|
670
|
-
host: str | None |
|
|
670
|
+
port: int | None | OptionInfo,
|
|
671
|
+
host: str | None | OptionInfo,
|
|
671
672
|
file: Optional[str] = None,
|
|
672
673
|
dry=False,
|
|
673
674
|
) -> None:
|
|
@@ -706,5 +707,9 @@ def runserver(
|
|
|
706
707
|
dev(port, host, dry=dry)
|
|
707
708
|
|
|
708
709
|
|
|
709
|
-
|
|
710
|
+
def main() -> None:
|
|
710
711
|
cli()
|
|
712
|
+
|
|
713
|
+
|
|
714
|
+
if __name__ == "__main__": # pragma: no cover
|
|
715
|
+
main()
|
|
@@ -12,7 +12,7 @@ authors = [
|
|
|
12
12
|
{ name = "Waket Zheng", email = "waketzheng@gmail.com>" },
|
|
13
13
|
]
|
|
14
14
|
readme = "README.md"
|
|
15
|
-
requires-python = ">=3.10,<
|
|
15
|
+
requires-python = ">=3.10,<4"
|
|
16
16
|
classifiers = [
|
|
17
17
|
"Development Status :: 4 - Beta",
|
|
18
18
|
"Intended Audience :: Developers",
|
|
@@ -23,6 +23,7 @@ classifiers = [
|
|
|
23
23
|
"Programming Language :: Python :: 3.10",
|
|
24
24
|
"Programming Language :: Python :: 3.11",
|
|
25
25
|
"Programming Language :: Python :: 3.12",
|
|
26
|
+
"Programming Language :: Python :: 3.13",
|
|
26
27
|
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
27
28
|
"Topic :: Software Development :: Libraries",
|
|
28
29
|
"Topic :: Software Development",
|
|
@@ -31,14 +32,13 @@ classifiers = [
|
|
|
31
32
|
]
|
|
32
33
|
dependencies = [
|
|
33
34
|
"typer>=0.12.3,<0.13",
|
|
34
|
-
"typing-extensions>=4.8.0",
|
|
35
35
|
"coverage >=7.5.1,<8",
|
|
36
|
-
"ruff >=0.4.4,<0.
|
|
36
|
+
"ruff >=0.4.4,<0.6",
|
|
37
37
|
"mypy >=1.10.0,<2",
|
|
38
38
|
"bumpversion >=0.6.0,<0.7",
|
|
39
39
|
"pytest >=8.2.0,<9",
|
|
40
40
|
]
|
|
41
|
-
version = "0.
|
|
41
|
+
version = "0.9.0"
|
|
42
42
|
|
|
43
43
|
[project.urls]
|
|
44
44
|
Homepage = "https://github.com/waketzheng/fast-dev-cli"
|
|
@@ -50,14 +50,14 @@ all = [
|
|
|
50
50
|
]
|
|
51
51
|
|
|
52
52
|
[project.scripts]
|
|
53
|
-
fast = "fast_dev_cli:cli.
|
|
53
|
+
fast = "fast_dev_cli:cli.main"
|
|
54
54
|
|
|
55
55
|
[tool.pdm]
|
|
56
56
|
distribution = true
|
|
57
57
|
|
|
58
58
|
[tool.pdm.version]
|
|
59
59
|
source = "file"
|
|
60
|
-
path = "fast_dev_cli/
|
|
60
|
+
path = "fast_dev_cli/__init__.py"
|
|
61
61
|
|
|
62
62
|
[tool.pdm.build]
|
|
63
63
|
source-includes = [
|
|
@@ -72,6 +72,9 @@ dev = [
|
|
|
72
72
|
[tool.waketzheng._internal-slim-build.packages.fastdevcli-slim.project]
|
|
73
73
|
name = "fastdevcli-slim"
|
|
74
74
|
|
|
75
|
+
[tool.waketzheng._internal-slim-build.packages.fastdevcli-slim.project.scripts]
|
|
76
|
+
fast = "fast_dev_cli:cli.main"
|
|
77
|
+
|
|
75
78
|
[tool.waketzheng._internal-slim-build.packages.fast-dev-cli]
|
|
76
79
|
include-optional-dependencies = [
|
|
77
80
|
"standard",
|
|
@@ -84,7 +87,7 @@ all = [
|
|
|
84
87
|
]
|
|
85
88
|
|
|
86
89
|
[tool.waketzheng._internal-slim-build.packages.fast-dev-cli.project.scripts]
|
|
87
|
-
fast = "fast_dev_cli:cli.
|
|
90
|
+
fast = "fast_dev_cli:cli.main"
|
|
88
91
|
|
|
89
92
|
[tool.pytest.ini_options]
|
|
90
93
|
testpaths = [
|
|
@@ -112,6 +115,7 @@ exclude_lines = [
|
|
|
112
115
|
]
|
|
113
116
|
omit = [
|
|
114
117
|
"tests/*",
|
|
118
|
+
"fast_dev_cli/__main__.py",
|
|
115
119
|
]
|
|
116
120
|
|
|
117
121
|
[tool.mypy]
|
|
@@ -62,7 +62,7 @@ def test_bump(
|
|
|
62
62
|
):
|
|
63
63
|
version = get_current_version()
|
|
64
64
|
patch_without_commit, patch_with_commit, minor_with_commit = _bump_commands(
|
|
65
|
-
version, "fast_dev_cli/
|
|
65
|
+
version, "fast_dev_cli/__init__.py"
|
|
66
66
|
)
|
|
67
67
|
stream = StringIO()
|
|
68
68
|
with redirect_stdout(stream):
|
|
@@ -49,7 +49,7 @@ def test_lint_cmd():
|
|
|
49
49
|
)
|
|
50
50
|
assert (
|
|
51
51
|
capture_cmd_output(f"{lint_cmd} .")
|
|
52
|
-
== capture_cmd_output(f"{lint_cmd}
|
|
52
|
+
== capture_cmd_output(f"{lint_cmd}")
|
|
53
53
|
== capture_cmd_output(f"{run}fast lint")
|
|
54
54
|
)
|
|
55
55
|
|
|
@@ -57,10 +57,10 @@ def test_lint_cmd():
|
|
|
57
57
|
def test_make_style(mocker):
|
|
58
58
|
mocker.patch("fast_dev_cli.cli.is_venv", return_value=True)
|
|
59
59
|
with capture_stdout() as stream:
|
|
60
|
-
make_style(["."], check_only=False, dry=True)
|
|
60
|
+
make_style([Path(".")], check_only=False, dry=True)
|
|
61
61
|
assert LINT_CMD in stream.getvalue()
|
|
62
62
|
with capture_stdout() as stream:
|
|
63
|
-
make_style(["."], check_only=True, dry=True)
|
|
63
|
+
make_style([Path(".")], check_only=True, dry=True)
|
|
64
64
|
assert CHECK_CMD in stream.getvalue()
|
|
65
65
|
with capture_stdout() as stream:
|
|
66
66
|
only_check(dry=True)
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
from .cli import (
|
|
2
|
-
__version__,
|
|
3
|
-
bump,
|
|
4
|
-
bump_version,
|
|
5
|
-
check,
|
|
6
|
-
lint,
|
|
7
|
-
make_style,
|
|
8
|
-
only_check,
|
|
9
|
-
sync,
|
|
10
|
-
tag,
|
|
11
|
-
test,
|
|
12
|
-
upgrade,
|
|
13
|
-
upload,
|
|
14
|
-
version,
|
|
15
|
-
)
|
|
16
|
-
|
|
17
|
-
__all__ = (
|
|
18
|
-
"__version__",
|
|
19
|
-
"version",
|
|
20
|
-
"bump_version",
|
|
21
|
-
"bump",
|
|
22
|
-
"lint",
|
|
23
|
-
"check",
|
|
24
|
-
"upload",
|
|
25
|
-
"test",
|
|
26
|
-
"sync",
|
|
27
|
-
"tag",
|
|
28
|
-
"upgrade",
|
|
29
|
-
"make_style",
|
|
30
|
-
"only_check",
|
|
31
|
-
)
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import importlib
|
|
2
|
-
import sys
|
|
3
|
-
|
|
4
|
-
from tests.utils import mock_sys_argv
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
def test_pad_dot():
|
|
8
|
-
with mock_sys_argv(["lint"]):
|
|
9
|
-
cli = importlib.import_module("fast_dev_cli.cli")
|
|
10
|
-
assert callable(cli.cli)
|
|
11
|
-
importlib.reload(cli)
|
|
12
|
-
assert sys.argv[1:] == ["lint", "."]
|
|
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
|