fast-dev-cli 0.13.0__tar.gz → 0.14.1__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.13.0 → fast_dev_cli-0.14.1}/PKG-INFO +1 -2
- fast_dev_cli-0.14.1/fast_dev_cli/__init__.py +1 -0
- {fast_dev_cli-0.13.0 → fast_dev_cli-0.14.1}/fast_dev_cli/cli.py +28 -16
- {fast_dev_cli-0.13.0 → fast_dev_cli-0.14.1}/pyproject.toml +9 -2
- {fast_dev_cli-0.13.0 → fast_dev_cli-0.14.1}/scripts/test.py +1 -1
- {fast_dev_cli-0.13.0 → fast_dev_cli-0.14.1}/tests/test_lint.py +9 -1
- fast_dev_cli-0.13.0/fast_dev_cli/__init__.py +0 -1
- {fast_dev_cli-0.13.0 → fast_dev_cli-0.14.1}/LICENSE +0 -0
- {fast_dev_cli-0.13.0 → fast_dev_cli-0.14.1}/README.md +0 -0
- {fast_dev_cli-0.13.0 → fast_dev_cli-0.14.1}/fast_dev_cli/__main__.py +0 -0
- {fast_dev_cli-0.13.0 → fast_dev_cli-0.14.1}/fast_dev_cli/py.typed +0 -0
- {fast_dev_cli-0.13.0 → fast_dev_cli-0.14.1}/pdm_build.py +0 -0
- {fast_dev_cli-0.13.0 → fast_dev_cli-0.14.1}/scripts/check.py +0 -0
- {fast_dev_cli-0.13.0 → fast_dev_cli-0.14.1}/scripts/format.py +0 -0
- {fast_dev_cli-0.13.0 → fast_dev_cli-0.14.1}/tests/__init__.py +0 -0
- {fast_dev_cli-0.13.0 → fast_dev_cli-0.14.1}/tests/conftest.py +0 -0
- {fast_dev_cli-0.13.0 → fast_dev_cli-0.14.1}/tests/test_bump.py +0 -0
- {fast_dev_cli-0.13.0 → fast_dev_cli-0.14.1}/tests/test_fast_test.py +0 -0
- {fast_dev_cli-0.13.0 → fast_dev_cli-0.14.1}/tests/test_functions.py +0 -0
- {fast_dev_cli-0.13.0 → fast_dev_cli-0.14.1}/tests/test_poetry_version_plugin.py +0 -0
- {fast_dev_cli-0.13.0 → fast_dev_cli-0.14.1}/tests/test_runserver.py +0 -0
- {fast_dev_cli-0.13.0 → fast_dev_cli-0.14.1}/tests/test_sync.py +0 -0
- {fast_dev_cli-0.13.0 → fast_dev_cli-0.14.1}/tests/test_tag.py +0 -0
- {fast_dev_cli-0.13.0 → fast_dev_cli-0.14.1}/tests/test_upgrade.py +0 -0
- {fast_dev_cli-0.13.0 → fast_dev_cli-0.14.1}/tests/test_upload.py +0 -0
- {fast_dev_cli-0.13.0 → fast_dev_cli-0.14.1}/tests/test_version.py +0 -0
- {fast_dev_cli-0.13.0 → fast_dev_cli-0.14.1}/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.14.1
|
|
4
4
|
Summary: Python project development tool.
|
|
5
5
|
Author-Email: Waket Zheng <waketzheng@gmail.com>>
|
|
6
6
|
Classifier: Development Status :: 4 - Beta
|
|
@@ -25,7 +25,6 @@ Requires-Dist: typer<1,>=0.12.3
|
|
|
25
25
|
Requires-Dist: emoji<3,>=2.12.1
|
|
26
26
|
Requires-Dist: tomli<3,>=2.0.1; python_version < "3.11"
|
|
27
27
|
Requires-Dist: coverage<8,>=7.5.1
|
|
28
|
-
Requires-Dist: ruff<1,>=0.6.0
|
|
29
28
|
Requires-Dist: mypy<2,>=1.15.0
|
|
30
29
|
Requires-Dist: bumpversion2<2,>=1.4.3
|
|
31
30
|
Requires-Dist: pytest<9,>=8.2.0
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.14.1"
|
|
@@ -258,7 +258,12 @@ class BumpUp(DryRun):
|
|
|
258
258
|
try:
|
|
259
259
|
package_item = context["tool"]["poetry"]["packages"]
|
|
260
260
|
except KeyError:
|
|
261
|
-
|
|
261
|
+
try:
|
|
262
|
+
project_name = context["project"]["name"]
|
|
263
|
+
except KeyError:
|
|
264
|
+
packages = []
|
|
265
|
+
else:
|
|
266
|
+
packages = [(poetry_module_name(project_name), "")]
|
|
262
267
|
else:
|
|
263
268
|
packages = [
|
|
264
269
|
(j, i.get("from", ""))
|
|
@@ -709,11 +714,11 @@ class LintCode(DryRun):
|
|
|
709
714
|
@classmethod
|
|
710
715
|
def to_cmd(
|
|
711
716
|
cls: type[Self],
|
|
712
|
-
paths=".",
|
|
713
|
-
check_only=False,
|
|
714
|
-
bandit=False,
|
|
715
|
-
skip_mypy=False,
|
|
716
|
-
use_dmypy=False,
|
|
717
|
+
paths: str = ".",
|
|
718
|
+
check_only: bool = False,
|
|
719
|
+
bandit: bool = False,
|
|
720
|
+
skip_mypy: bool = False,
|
|
721
|
+
use_dmypy: bool = False,
|
|
717
722
|
) -> str:
|
|
718
723
|
cmd = ""
|
|
719
724
|
tools = ["ruff format", "ruff check --extend-select=I,B,SIM --fix", "mypy"]
|
|
@@ -721,7 +726,7 @@ class LintCode(DryRun):
|
|
|
721
726
|
tools[0] += " --check"
|
|
722
727
|
if check_only or load_bool("NO_FIX"):
|
|
723
728
|
tools[1] = tools[1].replace(" --fix", "")
|
|
724
|
-
if skip_mypy or load_bool("SKIP_MYPY"):
|
|
729
|
+
if skip_mypy or load_bool("SKIP_MYPY") or load_bool("FASTDEVCLI_NO_MYPY"):
|
|
725
730
|
# Sometimes mypy is too slow
|
|
726
731
|
tools = tools[:-1]
|
|
727
732
|
elif load_bool("IGNORE_MISSING_IMPORTS"):
|
|
@@ -731,11 +736,11 @@ class LintCode(DryRun):
|
|
|
731
736
|
)
|
|
732
737
|
prefix = ""
|
|
733
738
|
should_run_by_tool = False
|
|
734
|
-
if is_venv():
|
|
739
|
+
if is_venv() and Path(sys.argv[0]).parent != Path.home().joinpath(".local/bin"):
|
|
735
740
|
if not cls.check_lint_tool_installed():
|
|
736
741
|
should_run_by_tool = True
|
|
737
742
|
if check_call('python -c "import fast_dev_cli"'):
|
|
738
|
-
command = 'python -m pip install -U "
|
|
743
|
+
command = 'python -m pip install -U "fast-dev-cli"'
|
|
739
744
|
tip = "You may need to run following command to install lint tools:"
|
|
740
745
|
secho(f"{tip}\n\n {command}\n", fg="yellow")
|
|
741
746
|
else:
|
|
@@ -747,9 +752,14 @@ class LintCode(DryRun):
|
|
|
747
752
|
cmd += lint_them.format(prefix, paths, *tools)
|
|
748
753
|
if bandit or load_bool("FASTDEVCLI_BANDIT"):
|
|
749
754
|
command = prefix + "bandit"
|
|
750
|
-
if
|
|
751
|
-
|
|
752
|
-
|
|
755
|
+
if Path("pyproject.toml").exists():
|
|
756
|
+
toml_text = Project.load_toml_text()
|
|
757
|
+
if "[tool.bandit" in toml_text:
|
|
758
|
+
command += " -c pyproject.toml"
|
|
759
|
+
if paths == "." and " -c " not in command:
|
|
760
|
+
paths = cls.get_package_name()
|
|
761
|
+
command += f" -r {paths}"
|
|
762
|
+
cmd += " && " + command
|
|
753
763
|
return cmd
|
|
754
764
|
|
|
755
765
|
def gen(self: Self) -> str:
|
|
@@ -763,12 +773,12 @@ def parse_files(args: list[str] | tuple[str, ...]) -> list[str]:
|
|
|
763
773
|
return [i for i in args if not i.startswith("-")]
|
|
764
774
|
|
|
765
775
|
|
|
766
|
-
def lint(files=None, dry=False, skip_mypy=False, dmypy=False) -> None:
|
|
776
|
+
def lint(files=None, dry=False, bandit=False, skip_mypy=False, dmypy=False) -> None:
|
|
767
777
|
if files is None:
|
|
768
778
|
files = parse_files(sys.argv[1:])
|
|
769
779
|
if files and files[0] == "lint":
|
|
770
780
|
files = files[1:]
|
|
771
|
-
LintCode(files, dry=dry, skip_mypy=skip_mypy, dmypy=dmypy).run()
|
|
781
|
+
LintCode(files, dry=dry, skip_mypy=skip_mypy, bandit=bandit, dmypy=dmypy).run()
|
|
772
782
|
|
|
773
783
|
|
|
774
784
|
def check(files=None, dry=False, bandit=False, skip_mypy=False, dmypy=False) -> None:
|
|
@@ -787,6 +797,7 @@ def check(files=None, dry=False, bandit=False, skip_mypy=False, dmypy=False) ->
|
|
|
787
797
|
def make_style(
|
|
788
798
|
files: Optional[list[Path]] = typer.Argument(default=None), # noqa:B008
|
|
789
799
|
check_only: bool = Option(False, "--check-only", "-c"),
|
|
800
|
+
bandit: bool = Option(False, "--bandit", help="Run `bandit -r <package_dir>`"),
|
|
790
801
|
skip_mypy: bool = Option(False, "--skip-mypy"),
|
|
791
802
|
use_dmypy: bool = Option(
|
|
792
803
|
False, "--dmypy", help="Use `dmypy run` instead of `mypy`"
|
|
@@ -800,10 +811,11 @@ def make_style(
|
|
|
800
811
|
files = [files]
|
|
801
812
|
skip = _ensure_bool(skip_mypy)
|
|
802
813
|
dmypy = _ensure_bool(use_dmypy)
|
|
814
|
+
bandit = _ensure_bool(bandit)
|
|
803
815
|
if _ensure_bool(check_only):
|
|
804
|
-
check(files, dry=dry, skip_mypy=skip, dmypy=dmypy)
|
|
816
|
+
check(files, dry=dry, skip_mypy=skip, dmypy=dmypy, bandit=bandit)
|
|
805
817
|
else:
|
|
806
|
-
lint(files, dry=dry, skip_mypy=skip, dmypy=dmypy)
|
|
818
|
+
lint(files, dry=dry, skip_mypy=skip, dmypy=dmypy, bandit=bandit)
|
|
807
819
|
|
|
808
820
|
|
|
809
821
|
@cli.command(name="check")
|
|
@@ -36,13 +36,12 @@ dependencies = [
|
|
|
36
36
|
"emoji >=2.12.1,<3",
|
|
37
37
|
"tomli>=2.0.1,<3; python_version < '3.11'",
|
|
38
38
|
"coverage >=7.5.1,<8",
|
|
39
|
-
"ruff >=0.6.0,<1",
|
|
40
39
|
"mypy >=1.15.0,<2",
|
|
41
40
|
"bumpversion2 >=1.4.3,<2",
|
|
42
41
|
"pytest >=8.2.0,<9",
|
|
43
42
|
"packaging>=20.5",
|
|
44
43
|
]
|
|
45
|
-
version = "0.
|
|
44
|
+
version = "0.14.1"
|
|
46
45
|
|
|
47
46
|
[project.urls]
|
|
48
47
|
Homepage = "https://github.com/waketzheng/fast-dev-cli"
|
|
@@ -155,3 +154,11 @@ extend-select = [
|
|
|
155
154
|
"fast_dev_cli/cli.py" = [
|
|
156
155
|
"UP007",
|
|
157
156
|
]
|
|
157
|
+
|
|
158
|
+
[tool.bandit]
|
|
159
|
+
exclude_dirs = [
|
|
160
|
+
"tests",
|
|
161
|
+
"scripts",
|
|
162
|
+
"examples",
|
|
163
|
+
".venv",
|
|
164
|
+
]
|
|
@@ -132,6 +132,14 @@ def test_lint_cmd(mock_no_dmypy):
|
|
|
132
132
|
)
|
|
133
133
|
|
|
134
134
|
|
|
135
|
+
def test_lint_by_global_fast():
|
|
136
|
+
run = "pdm run "
|
|
137
|
+
fast = Path.home() / ".local" / "bin" / "fast"
|
|
138
|
+
command = capture_cmd_output(f"{fast} lint --dry")
|
|
139
|
+
for cmd in command.split(SEP):
|
|
140
|
+
assert run in cmd
|
|
141
|
+
|
|
142
|
+
|
|
135
143
|
def test_with_dmypy():
|
|
136
144
|
command = capture_cmd_output("fast lint --dmypy --dry .")
|
|
137
145
|
assert "dmypy run ." in command
|
|
@@ -200,7 +208,7 @@ def test_lint_without_ruff_installed(mocker, mock_no_dmypy):
|
|
|
200
208
|
with capture_stdout() as stream:
|
|
201
209
|
lint(".", dry=True)
|
|
202
210
|
output = stream.getvalue()
|
|
203
|
-
cmd = 'python -m pip install -U "
|
|
211
|
+
cmd = 'python -m pip install -U "fast-dev-cli"'
|
|
204
212
|
assert cmd in output
|
|
205
213
|
tip = "You may need to run following command to install lint tools"
|
|
206
214
|
assert tip in output
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.13.0"
|
|
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
|
|
File without changes
|
|
File without changes
|