fast-dev-cli 0.25.7__tar.gz → 0.25.9__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: fast-dev-cli
3
- Version: 0.25.7
3
+ Version: 0.25.9
4
4
  Summary: Python project development tool.
5
5
  Author-Email: Waket Zheng <waketzheng@gmail.com>>
6
6
  Classifier: Development Status :: 4 - Beta
@@ -0,0 +1 @@
1
+ __version__ = "0.25.9"
@@ -1269,7 +1269,11 @@ class LintCode(DryRun):
1269
1269
  path_args = ["."]
1270
1270
  quoted_paths = _join_shell_args(path_args)
1271
1271
  if path_args != ["."] and all(i.endswith(".html") for i in path_args):
1272
- return f"prettier -w {quoted_paths}"
1272
+ prettier = "prettier"
1273
+ if is_windows() and (abspath := shutil.which(prettier)):
1274
+ # If prettier is installed by `npm i -g`
1275
+ prettier = Path(abspath).name # prettier.CMD
1276
+ return f"{prettier} -w {quoted_paths}"
1273
1277
  ruff_rules = ["I", "B"]
1274
1278
  if ruff_check_sim and not load_bool("FASTDEVCLI_NO_SIM"):
1275
1279
  ruff_rules.append("SIM")
@@ -1654,7 +1658,9 @@ def _should_run_test_script(path: Path = Path("scripts")) -> Path | None:
1654
1658
  return None
1655
1659
 
1656
1660
 
1657
- def test(dry: bool, ignore_script: bool = False) -> None:
1661
+ def test(
1662
+ dry: bool, ignore_script: bool = False, files: list[Path] | None = None
1663
+ ) -> None:
1658
1664
  cwd = Path.cwd()
1659
1665
  root = Project.get_work_dir(cwd=cwd, allow_cwd=True)
1660
1666
  script_dir = root / "scripts"
@@ -1668,6 +1674,8 @@ def test(dry: bool, ignore_script: bool = False) -> None:
1668
1674
  cmd = f"cd {_quote_shell_arg(root)} && " + cmd
1669
1675
  else:
1670
1676
  cmd = 'coverage run -m pytest -s && coverage report --omit="tests/*" -m'
1677
+ if files:
1678
+ cmd = "pytest -s " + " ".join(i.as_posix() for i in files)
1671
1679
  if not is_venv() or not check_call("coverage --version"):
1672
1680
  sep = " && "
1673
1681
  prefix = f"{tool} run " if (tool := Project.get_manage_tool()) else ""
@@ -1677,11 +1685,12 @@ def test(dry: bool, ignore_script: bool = False) -> None:
1677
1685
 
1678
1686
  @cli.command(name="test")
1679
1687
  def coverage_test(
1688
+ files: Annotated[list[Path] | None, typer.Argument()] = None,
1680
1689
  dry: bool = DryOption,
1681
1690
  ignore_script: bool = Option(False, "--ignore-script", "-i"),
1682
1691
  ) -> None:
1683
1692
  """Run unittest by pytest and report coverage"""
1684
- return test(dry, ignore_script)
1693
+ return test(dry, ignore_script, files=files)
1685
1694
 
1686
1695
 
1687
1696
  def _not_a_distribution() -> bool:
@@ -2225,7 +2234,7 @@ class UvPypi(DryRun):
2225
2234
 
2226
2235
  @cli.command()
2227
2236
  def pypi(
2228
- file: str | None = typer.Argument(default=None),
2237
+ file: Annotated[str | None, typer.Argument()] = None,
2229
2238
  dry: bool = DryOption,
2230
2239
  verbose: bool = False,
2231
2240
  quiet: bool = False,
@@ -2242,7 +2251,7 @@ def pypi(
2242
2251
 
2243
2252
 
2244
2253
  class SuffixParser:
2245
- usually = ("py", "md", "json", "txt", "proto")
2254
+ usually = ("py", "md", "json", "txt", "proto", "toml")
2246
2255
 
2247
2256
  @classmethod
2248
2257
  def fill(cls, files: list[str]) -> list[str]:
@@ -2282,8 +2291,8 @@ def vi(
2282
2291
  dry: Annotated[
2283
2292
  bool, Option(help="Only print, not really run shell command")
2284
2293
  ] = False,
2285
- vertical: bool | None = Option(None, "-O", help="Open vertically"),
2286
- horizon: bool | None = Option(None, "-o", help="Open horizontally"),
2294
+ vertical: Annotated[bool | None, Option(..., "-O", help="Open vertically")] = None,
2295
+ horizon: Annotated[bool | None, Option(..., "-o", help="Open horizontally")] = None,
2287
2296
  guess: Annotated[
2288
2297
  bool, Option(help="Whether guess file suffix if not exist")
2289
2298
  ] = True,
@@ -2308,14 +2317,16 @@ def version_callback(value: bool) -> None:
2308
2317
 
2309
2318
  @cli.callback()
2310
2319
  def common(
2311
- version: bool = Option(
2312
- None,
2313
- "--version",
2314
- "-V",
2315
- callback=version_callback,
2316
- is_eager=True,
2317
- help="Show the version of this tool",
2318
- ),
2320
+ version: Annotated[
2321
+ bool | None,
2322
+ Option(
2323
+ ...,
2324
+ *("--version", "-V"),
2325
+ callback=version_callback,
2326
+ is_eager=True,
2327
+ help="Show the version of this tool",
2328
+ ),
2329
+ ] = None,
2319
2330
  ) -> None: ...
2320
2331
 
2321
2332
 
@@ -29,7 +29,7 @@ dependencies = [
29
29
  "typer>=0.24.0,<1",
30
30
  "tomli >=2.0.1,<3; python_version < '3.11'",
31
31
  ]
32
- version = "0.25.7"
32
+ version = "0.25.9"
33
33
 
34
34
  [project.urls]
35
35
  Homepage = "https://github.com/waketzheng/fast-dev-cli"
@@ -1 +0,0 @@
1
- __version__ = "0.25.7"
File without changes
File without changes