fast-dev-cli 0.18.2__tar.gz → 0.18.4__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.
Files changed (34) hide show
  1. {fast_dev_cli-0.18.2 → fast_dev_cli-0.18.4}/PKG-INFO +16 -1
  2. {fast_dev_cli-0.18.2 → fast_dev_cli-0.18.4}/README.md +15 -0
  3. fast_dev_cli-0.18.4/fast_dev_cli/__init__.py +1 -0
  4. {fast_dev_cli-0.18.2 → fast_dev_cli-0.18.4}/fast_dev_cli/cli.py +46 -8
  5. {fast_dev_cli-0.18.2 → fast_dev_cli-0.18.4}/pyproject.toml +1 -1
  6. {fast_dev_cli-0.18.2 → fast_dev_cli-0.18.4}/tests/test_deps.py +17 -0
  7. {fast_dev_cli-0.18.2 → fast_dev_cli-0.18.4}/tests/test_lint.py +8 -0
  8. fast_dev_cli-0.18.2/fast_dev_cli/__init__.py +0 -1
  9. {fast_dev_cli-0.18.2 → fast_dev_cli-0.18.4}/LICENSE +0 -0
  10. {fast_dev_cli-0.18.2 → fast_dev_cli-0.18.4}/fast_dev_cli/__main__.py +0 -0
  11. {fast_dev_cli-0.18.2 → fast_dev_cli-0.18.4}/fast_dev_cli/py.typed +0 -0
  12. {fast_dev_cli-0.18.2 → fast_dev_cli-0.18.4}/pdm_build.py +0 -0
  13. {fast_dev_cli-0.18.2 → fast_dev_cli-0.18.4}/scripts/check.py +0 -0
  14. {fast_dev_cli-0.18.2 → fast_dev_cli-0.18.4}/scripts/deps.py +0 -0
  15. {fast_dev_cli-0.18.2 → fast_dev_cli-0.18.4}/scripts/format.py +0 -0
  16. {fast_dev_cli-0.18.2 → fast_dev_cli-0.18.4}/scripts/test.py +0 -0
  17. {fast_dev_cli-0.18.2 → fast_dev_cli-0.18.4}/tests/__init__.py +0 -0
  18. {fast_dev_cli-0.18.2 → fast_dev_cli-0.18.4}/tests/assets/uv-tx.lock +0 -0
  19. {fast_dev_cli-0.18.2 → fast_dev_cli-0.18.4}/tests/assets/uv.lock +0 -0
  20. {fast_dev_cli-0.18.2 → fast_dev_cli-0.18.4}/tests/conftest.py +0 -0
  21. {fast_dev_cli-0.18.2 → fast_dev_cli-0.18.4}/tests/test_bump.py +0 -0
  22. {fast_dev_cli-0.18.2 → fast_dev_cli-0.18.4}/tests/test_exec.py +0 -0
  23. {fast_dev_cli-0.18.2 → fast_dev_cli-0.18.4}/tests/test_fast_test.py +0 -0
  24. {fast_dev_cli-0.18.2 → fast_dev_cli-0.18.4}/tests/test_functions.py +0 -0
  25. {fast_dev_cli-0.18.2 → fast_dev_cli-0.18.4}/tests/test_help.py +0 -0
  26. {fast_dev_cli-0.18.2 → fast_dev_cli-0.18.4}/tests/test_poetry_version_plugin.py +0 -0
  27. {fast_dev_cli-0.18.2 → fast_dev_cli-0.18.4}/tests/test_pypi.py +0 -0
  28. {fast_dev_cli-0.18.2 → fast_dev_cli-0.18.4}/tests/test_runserver.py +0 -0
  29. {fast_dev_cli-0.18.2 → fast_dev_cli-0.18.4}/tests/test_sync.py +0 -0
  30. {fast_dev_cli-0.18.2 → fast_dev_cli-0.18.4}/tests/test_tag.py +0 -0
  31. {fast_dev_cli-0.18.2 → fast_dev_cli-0.18.4}/tests/test_upgrade.py +0 -0
  32. {fast_dev_cli-0.18.2 → fast_dev_cli-0.18.4}/tests/test_upload.py +0 -0
  33. {fast_dev_cli-0.18.2 → fast_dev_cli-0.18.4}/tests/test_version.py +0 -0
  34. {fast_dev_cli-0.18.2 → fast_dev_cli-0.18.4}/tests/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: fast-dev-cli
3
- Version: 0.18.2
3
+ Version: 0.18.4
4
4
  Summary: Python project development tool.
5
5
  Author-Email: Waket Zheng <waketzheng@gmail.com>>
6
6
  Classifier: Development Status :: 4 - Beta
@@ -131,3 +131,18 @@ fast dev
131
131
  fast upload
132
132
  ```
133
133
  *Note: all command support the `--dry` option*
134
+
135
+ ## Use it without installed
136
+
137
+ ```bash
138
+ uvx --from fastdevcli-slim fast
139
+ ```
140
+
141
+ ## Install global
142
+ ```bash
143
+ pipx install fastdevcli-slim
144
+ ```
145
+ Or:
146
+ ```bash
147
+ uv tool install fastdevcli-slim
148
+ ```
@@ -95,3 +95,18 @@ fast dev
95
95
  fast upload
96
96
  ```
97
97
  *Note: all command support the `--dry` option*
98
+
99
+ ## Use it without installed
100
+
101
+ ```bash
102
+ uvx --from fastdevcli-slim fast
103
+ ```
104
+
105
+ ## Install global
106
+ ```bash
107
+ pipx install fastdevcli-slim
108
+ ```
109
+ Or:
110
+ ```bash
111
+ uv tool install fastdevcli-slim
112
+ ```
@@ -0,0 +1 @@
1
+ __version__ = "0.18.4"
@@ -497,6 +497,13 @@ def version() -> None:
497
497
  with contextlib.suppress(FileNotFoundError, KeyError):
498
498
  toml_text = Project.load_toml_text()
499
499
  doc = tomllib.loads(toml_text)
500
+ if value := doc.get("project", {}).get("version", ""):
501
+ styled = typer.style(value, bold=True, fg=typer.colors.CYAN)
502
+ if project_name := doc["project"].get("name", ""):
503
+ echo(f"{project_name} version: " + styled)
504
+ else:
505
+ echo(f"Got Version from {TOML_FILE}: " + styled)
506
+ return
500
507
  version_file = doc["tool"]["pdm"]["version"]["path"]
501
508
  text = Project.get_work_dir().joinpath(version_file).read_text()
502
509
  varname = "__version__"
@@ -1058,9 +1065,24 @@ class LintCode(DryRun):
1058
1065
  return cmd
1059
1066
 
1060
1067
  def gen(self) -> str:
1061
- if isinstance(args := self.args, str):
1062
- args = args.split()
1063
- paths = " ".join(map(str, args)) if args else "."
1068
+ paths = "."
1069
+ if args := self.args:
1070
+ ps = args.split() if isinstance(args, str) else [str(i) for i in args]
1071
+ if len(ps) == 1:
1072
+ paths = ps[0]
1073
+ if paths != "." and not (p := Path(paths)).suffix and not p.exists():
1074
+ # e.g.:
1075
+ # stem -> stem.py
1076
+ # me. -> me.py
1077
+ if paths.endswith("."):
1078
+ p = p.with_name(paths[:-1])
1079
+ for suffix in (".py", ".html"):
1080
+ p = p.with_suffix(suffix)
1081
+ if p.exists():
1082
+ paths = p.name
1083
+ break
1084
+ else:
1085
+ paths = " ".join(ps)
1064
1086
  return self.to_cmd(
1065
1087
  paths,
1066
1088
  self.check_only,
@@ -1331,9 +1353,18 @@ def run_by_subprocess(cmd: str, dry: bool = DryOption) -> None:
1331
1353
 
1332
1354
 
1333
1355
  class MakeDeps(DryRun):
1334
- def __init__(self, tool: str, prod: bool = False, dry: bool = False) -> None:
1356
+ def __init__(
1357
+ self,
1358
+ tool: str,
1359
+ prod: bool = False,
1360
+ dry: bool = False,
1361
+ active: bool = True,
1362
+ inexact: bool = True,
1363
+ ) -> None:
1335
1364
  self._tool = tool
1336
1365
  self._prod = prod
1366
+ self._active = active
1367
+ self._inexact = inexact
1337
1368
  super().__init__(dry=dry)
1338
1369
 
1339
1370
  def should_ensure_pip(self) -> bool:
@@ -1351,9 +1382,10 @@ class MakeDeps(DryRun):
1351
1382
  if self._tool == "pdm":
1352
1383
  return "pdm sync " + ("--prod" if self._prod else "-G :all")
1353
1384
  elif self._tool == "uv":
1354
- return "uv sync --inexact --active" + (
1355
- "" if self._prod else " --all-extras --all-groups"
1356
- )
1385
+ uv_sync = "uv sync" + " --inexact" * self._inexact
1386
+ if self._active:
1387
+ uv_sync += " --active"
1388
+ return uv_sync + ("" if self._prod else " --all-extras --all-groups")
1357
1389
  elif self._tool == "poetry":
1358
1390
  return "poetry install " + (
1359
1391
  "--only=main" if self._prod else "--all-extras --all-groups"
@@ -1382,6 +1414,12 @@ def make_deps(
1382
1414
  use_pdm: bool = Option(False, "--pdm", help="Use `pdm` to install deps"),
1383
1415
  use_pip: bool = Option(False, "--pip", help="Use `pip` to install deps"),
1384
1416
  use_poetry: bool = Option(False, "--poetry", help="Use `poetry` to install deps"),
1417
+ active: bool = Option(
1418
+ True, help="Add `--active` to uv sync command(Only work for uv project)"
1419
+ ),
1420
+ inexact: bool = Option(
1421
+ True, help="Add `--inexact` to uv sync command(Only work for uv project)"
1422
+ ),
1385
1423
  dry: bool = DryOption,
1386
1424
  ) -> None:
1387
1425
  """Run: ruff check/format to reformat code and then mypy to check"""
@@ -1397,7 +1435,7 @@ def make_deps(
1397
1435
  tool = "poetry"
1398
1436
  elif tool == ToolOption.default:
1399
1437
  tool = Project.get_manage_tool(cache=True) or "pip"
1400
- MakeDeps(tool, prod, dry=dry).run()
1438
+ MakeDeps(tool, prod, active=active, inexact=inexact, dry=dry).run()
1401
1439
 
1402
1440
 
1403
1441
  class UvPypi(DryRun):
@@ -42,7 +42,7 @@ dependencies = [
42
42
  "bumpversion2 >=1.4.3",
43
43
  "pytest >=8.2.0",
44
44
  ]
45
- version = "0.18.2"
45
+ version = "0.18.4"
46
46
 
47
47
  [project.urls]
48
48
  Homepage = "https://github.com/waketzheng/fast-dev-cli"
@@ -6,7 +6,12 @@ def test_make_deps_class():
6
6
  MakeDeps("uv", prod=False).gen()
7
7
  == "uv sync --inexact --active --all-extras --all-groups"
8
8
  )
9
+ assert (
10
+ MakeDeps("uv", prod=False, active=False).gen()
11
+ == "uv sync --inexact --all-extras --all-groups"
12
+ )
9
13
  assert MakeDeps("uv", prod=True).gen() == "uv sync --inexact --active"
14
+ assert MakeDeps("uv", prod=True, active=False).gen() == "uv sync --inexact"
10
15
  assert MakeDeps("pdm", prod=False).gen() == "pdm sync -G :all"
11
16
  assert MakeDeps("pdm", prod=True).gen() == "pdm sync --prod"
12
17
  assert (
@@ -29,5 +34,17 @@ def test_fast_deps():
29
34
  assert out == "--> pdm sync -G :all"
30
35
  out = capture_cmd_output("fast deps --uv --prod --dry")
31
36
  assert out == "--> uv sync --inexact --active"
37
+ out = capture_cmd_output("fast deps --uv --prod --dry --no-active")
38
+ assert out == "--> uv sync --inexact"
39
+ out = capture_cmd_output("fast deps --uv --prod --dry --no-inexact")
40
+ assert out == "--> uv sync --active"
41
+ out = capture_cmd_output("fast deps --uv --prod --dry --no-active --no-inexact")
42
+ assert out == "--> uv sync"
32
43
  out = capture_cmd_output("fast deps --uv --dry")
33
44
  assert out == "--> uv sync --inexact --active --all-extras --all-groups"
45
+ out = capture_cmd_output("fast deps --uv --dry --no-active")
46
+ assert out == "--> uv sync --inexact --all-extras --all-groups"
47
+ out = capture_cmd_output("fast deps --uv --dry --no-inexact")
48
+ assert out == "--> uv sync --active --all-extras --all-groups"
49
+ out = capture_cmd_output("fast deps --uv --dry --no-active --no-inexact")
50
+ assert out == "--> uv sync --all-extras --all-groups"
@@ -187,6 +187,14 @@ def test_lint_with_prefix(mocker):
187
187
  assert "pdm run" in stream.getvalue()
188
188
 
189
189
 
190
+ def test_lint_auto_suffix(tmp_work_dir):
191
+ Path("main.py").touch()
192
+ cmd = "fast lint --dry main."
193
+ assert "main.py" in capture_cmd_output(cmd)
194
+ shutil.move("main.py", "main.html")
195
+ assert "main.html" in capture_cmd_output(cmd)
196
+
197
+
190
198
  def test_fast_lint_with_uv():
191
199
  command = capture_cmd_output("fast lint --tool=uv --prefix --dry")
192
200
  assert (
@@ -1 +0,0 @@
1
- __version__ = "0.18.2"
File without changes