fast-dev-cli 0.8.3__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.3 → fast_dev_cli-0.9.0}/PKG-INFO +8 -2
- {fast_dev_cli-0.8.3 → 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.8.3 → fast_dev_cli-0.9.0}/fast_dev_cli/cli.py +16 -17
- {fast_dev_cli-0.8.3 → fast_dev_cli-0.9.0}/pyproject.toml +6 -2
- {fast_dev_cli-0.8.3 → fast_dev_cli-0.9.0}/scripts/check.sh +2 -0
- {fast_dev_cli-0.8.3 → fast_dev_cli-0.9.0}/tests/test_lint.py +3 -3
- fast_dev_cli-0.8.3/fast_dev_cli/__init__.py +0 -1
- fast_dev_cli-0.8.3/tests/test_import.py +0 -12
- {fast_dev_cli-0.8.3 → fast_dev_cli-0.9.0}/LICENSE +0 -0
- {fast_dev_cli-0.8.3 → fast_dev_cli-0.9.0}/fast_dev_cli/__main__.py +0 -0
- {fast_dev_cli-0.8.3 → fast_dev_cli-0.9.0}/fast_dev_cli/py.typed +0 -0
- {fast_dev_cli-0.8.3 → fast_dev_cli-0.9.0}/pdm_build.py +0 -0
- {fast_dev_cli-0.8.3 → fast_dev_cli-0.9.0}/scripts/format.sh +0 -0
- {fast_dev_cli-0.8.3 → fast_dev_cli-0.9.0}/scripts/test.sh +0 -0
- {fast_dev_cli-0.8.3 → fast_dev_cli-0.9.0}/tests/__init__.py +0 -0
- {fast_dev_cli-0.8.3 → fast_dev_cli-0.9.0}/tests/conftest.py +0 -0
- {fast_dev_cli-0.8.3 → fast_dev_cli-0.9.0}/tests/test_bump.py +0 -0
- {fast_dev_cli-0.8.3 → fast_dev_cli-0.9.0}/tests/test_fast_test.py +0 -0
- {fast_dev_cli-0.8.3 → fast_dev_cli-0.9.0}/tests/test_functions.py +0 -0
- {fast_dev_cli-0.8.3 → fast_dev_cli-0.9.0}/tests/test_runserver.py +0 -0
- {fast_dev_cli-0.8.3 → fast_dev_cli-0.9.0}/tests/test_sync.py +0 -0
- {fast_dev_cli-0.8.3 → fast_dev_cli-0.9.0}/tests/test_tag.py +0 -0
- {fast_dev_cli-0.8.3 → fast_dev_cli-0.9.0}/tests/test_upgrade.py +0 -0
- {fast_dev_cli-0.8.3 → fast_dev_cli-0.9.0}/tests/test_upload.py +0 -0
- {fast_dev_cli-0.8.3 → fast_dev_cli-0.9.0}/tests/test_version.py +0 -0
- {fast_dev_cli-0.8.3 → 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,6 +12,7 @@ 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
|
|
@@ -21,7 +22,7 @@ Project-URL: Homepage, https://github.com/waketzheng/fast-dev-cli
|
|
|
21
22
|
Requires-Python: <4,>=3.10
|
|
22
23
|
Requires-Dist: typer<0.13,>=0.12.3
|
|
23
24
|
Requires-Dist: coverage<8,>=7.5.1
|
|
24
|
-
Requires-Dist: ruff<0.
|
|
25
|
+
Requires-Dist: ruff<0.6,>=0.4.4
|
|
25
26
|
Requires-Dist: mypy<2,>=1.10.0
|
|
26
27
|
Requires-Dist: bumpversion<0.7,>=0.6.0
|
|
27
28
|
Requires-Dist: pytest<9,>=8.2.0
|
|
@@ -55,12 +56,17 @@ Description-Content-Type: text/markdown
|
|
|
55
56
|
<a href="https://github.com/python/mypy" target="_blank">
|
|
56
57
|
<img src="https://img.shields.io/badge/mypy-100%25-green.svg" alt="Mypy Coverage">
|
|
57
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>
|
|
58
62
|
</p>
|
|
59
63
|
|
|
60
64
|
---
|
|
61
65
|
|
|
62
66
|
**Source Code**: <a href="https://github.com/waketzheng/fast-dev-cli" target="_blank">https://github.com/waketzheng/fast-dev-cli</a>
|
|
63
67
|
|
|
68
|
+
**English** | [中文](./README.zh.md)
|
|
69
|
+
|
|
64
70
|
## Requirements
|
|
65
71
|
|
|
66
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,11 +3,10 @@ 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 subprocess import CompletedProcess
|
|
11
10
|
from typing import Literal, Optional, Type
|
|
12
11
|
|
|
13
12
|
import typer
|
|
@@ -17,7 +16,9 @@ from typer.models import OptionInfo
|
|
|
17
16
|
try:
|
|
18
17
|
from . import __version__
|
|
19
18
|
except ImportError: # pragma: no cover
|
|
20
|
-
from
|
|
19
|
+
from importlib import import_module as _import # For local unittest
|
|
20
|
+
|
|
21
|
+
__version__ = _import(Path(__file__).parent.name).__version__
|
|
21
22
|
|
|
22
23
|
if sys.version_info >= (3, 11):
|
|
23
24
|
from enum import StrEnum
|
|
@@ -31,15 +32,10 @@ else: # pragma: no cover
|
|
|
31
32
|
__str__ = str.__str__
|
|
32
33
|
|
|
33
34
|
|
|
34
|
-
# TODO: use Optional Argument instead
|
|
35
35
|
def parse_files(args: list[str] | tuple[str, ...]) -> list[str]:
|
|
36
36
|
return [i for i in args if not i.startswith("-")]
|
|
37
37
|
|
|
38
38
|
|
|
39
|
-
if len(sys.argv) >= 2 and sys.argv[1] == "lint":
|
|
40
|
-
if not parse_files(sys.argv[2:]):
|
|
41
|
-
sys.argv.append(".")
|
|
42
|
-
|
|
43
39
|
TOML_FILE = "pyproject.toml"
|
|
44
40
|
cli = typer.Typer()
|
|
45
41
|
|
|
@@ -57,9 +53,10 @@ def is_venv() -> bool:
|
|
|
57
53
|
)
|
|
58
54
|
|
|
59
55
|
|
|
60
|
-
def _run_shell(cmd: str, **kw) -> CompletedProcess:
|
|
61
|
-
|
|
62
|
-
|
|
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
|
|
63
60
|
|
|
64
61
|
|
|
65
62
|
def run_and_echo(cmd: str, *, dry=False, verbose=True, **kw) -> int:
|
|
@@ -79,7 +76,7 @@ def check_call(cmd: str) -> bool:
|
|
|
79
76
|
def capture_cmd_output(command: list[str] | str, **kw) -> str:
|
|
80
77
|
if isinstance(command, str) and not kw.get("shell"):
|
|
81
78
|
command = command.split()
|
|
82
|
-
r =
|
|
79
|
+
r = _run_shell(command, capture_output=True, **kw)
|
|
83
80
|
return r.stdout.strip().decode()
|
|
84
81
|
|
|
85
82
|
|
|
@@ -106,10 +103,10 @@ def _ensure_bool(value: bool | OptionInfo) -> bool:
|
|
|
106
103
|
|
|
107
104
|
def exit_if_run_failed(
|
|
108
105
|
cmd: str, env=None, _exit=False, dry=False, **kw
|
|
109
|
-
) -> CompletedProcess:
|
|
106
|
+
) -> subprocess.CompletedProcess:
|
|
110
107
|
run_and_echo(cmd, dry=True)
|
|
111
108
|
if _ensure_bool(dry):
|
|
112
|
-
return CompletedProcess("", 0)
|
|
109
|
+
return subprocess.CompletedProcess("", 0)
|
|
113
110
|
if env is not None:
|
|
114
111
|
env = {**os.environ, **env}
|
|
115
112
|
r = _run_shell(cmd, env=env, **kw)
|
|
@@ -552,7 +549,7 @@ class LintCode(DryRun):
|
|
|
552
549
|
return cmd
|
|
553
550
|
|
|
554
551
|
def gen(self: Self) -> str:
|
|
555
|
-
paths = " ".join(self.args) if self.args else "."
|
|
552
|
+
paths = " ".join(map(str, self.args)) if self.args else "."
|
|
556
553
|
return self.to_cmd(paths, self.check_only)
|
|
557
554
|
|
|
558
555
|
|
|
@@ -570,12 +567,14 @@ def check(files=None, dry=False) -> None:
|
|
|
570
567
|
|
|
571
568
|
@cli.command(name="lint")
|
|
572
569
|
def make_style(
|
|
573
|
-
files: list[
|
|
570
|
+
files: Annotated[Optional[list[Path]], typer.Argument()] = None,
|
|
574
571
|
check_only: bool = Option(False, "--check-only", "-c"),
|
|
575
572
|
dry: bool = Option(False, "--dry", help="Only print, not really run shell command"),
|
|
576
573
|
) -> None:
|
|
577
574
|
"""Run: ruff check/format to reformat code and then mypy to check"""
|
|
578
|
-
if
|
|
575
|
+
if files is None:
|
|
576
|
+
files = [Path(".")]
|
|
577
|
+
elif isinstance(files, str):
|
|
579
578
|
files = [files]
|
|
580
579
|
if _ensure_bool(check_only):
|
|
581
580
|
check(files, dry=dry)
|
|
@@ -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",
|
|
@@ -32,12 +33,12 @@ classifiers = [
|
|
|
32
33
|
dependencies = [
|
|
33
34
|
"typer>=0.12.3,<0.13",
|
|
34
35
|
"coverage >=7.5.1,<8",
|
|
35
|
-
"ruff >=0.4.4,<0.
|
|
36
|
+
"ruff >=0.4.4,<0.6",
|
|
36
37
|
"mypy >=1.10.0,<2",
|
|
37
38
|
"bumpversion >=0.6.0,<0.7",
|
|
38
39
|
"pytest >=8.2.0,<9",
|
|
39
40
|
]
|
|
40
|
-
version = "0.
|
|
41
|
+
version = "0.9.0"
|
|
41
42
|
|
|
42
43
|
[project.urls]
|
|
43
44
|
Homepage = "https://github.com/waketzheng/fast-dev-cli"
|
|
@@ -71,6 +72,9 @@ dev = [
|
|
|
71
72
|
[tool.waketzheng._internal-slim-build.packages.fastdevcli-slim.project]
|
|
72
73
|
name = "fastdevcli-slim"
|
|
73
74
|
|
|
75
|
+
[tool.waketzheng._internal-slim-build.packages.fastdevcli-slim.project.scripts]
|
|
76
|
+
fast = "fast_dev_cli:cli.main"
|
|
77
|
+
|
|
74
78
|
[tool.waketzheng._internal-slim-build.packages.fast-dev-cli]
|
|
75
79
|
include-optional-dependencies = [
|
|
76
80
|
"standard",
|
|
@@ -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 +0,0 @@
|
|
|
1
|
-
__version__ = "0.8.3"
|
|
@@ -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
|
|
File without changes
|
|
File without changes
|