fast-dev-cli 0.18.3__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.3 → fast_dev_cli-0.18.4}/PKG-INFO +1 -1
  2. fast_dev_cli-0.18.4/fast_dev_cli/__init__.py +1 -0
  3. {fast_dev_cli-0.18.3 → fast_dev_cli-0.18.4}/fast_dev_cli/cli.py +38 -10
  4. {fast_dev_cli-0.18.3 → fast_dev_cli-0.18.4}/pyproject.toml +1 -1
  5. {fast_dev_cli-0.18.3 → fast_dev_cli-0.18.4}/tests/test_deps.py +17 -0
  6. fast_dev_cli-0.18.3/fast_dev_cli/__init__.py +0 -1
  7. {fast_dev_cli-0.18.3 → fast_dev_cli-0.18.4}/LICENSE +0 -0
  8. {fast_dev_cli-0.18.3 → fast_dev_cli-0.18.4}/README.md +0 -0
  9. {fast_dev_cli-0.18.3 → fast_dev_cli-0.18.4}/fast_dev_cli/__main__.py +0 -0
  10. {fast_dev_cli-0.18.3 → fast_dev_cli-0.18.4}/fast_dev_cli/py.typed +0 -0
  11. {fast_dev_cli-0.18.3 → fast_dev_cli-0.18.4}/pdm_build.py +0 -0
  12. {fast_dev_cli-0.18.3 → fast_dev_cli-0.18.4}/scripts/check.py +0 -0
  13. {fast_dev_cli-0.18.3 → fast_dev_cli-0.18.4}/scripts/deps.py +0 -0
  14. {fast_dev_cli-0.18.3 → fast_dev_cli-0.18.4}/scripts/format.py +0 -0
  15. {fast_dev_cli-0.18.3 → fast_dev_cli-0.18.4}/scripts/test.py +0 -0
  16. {fast_dev_cli-0.18.3 → fast_dev_cli-0.18.4}/tests/__init__.py +0 -0
  17. {fast_dev_cli-0.18.3 → fast_dev_cli-0.18.4}/tests/assets/uv-tx.lock +0 -0
  18. {fast_dev_cli-0.18.3 → fast_dev_cli-0.18.4}/tests/assets/uv.lock +0 -0
  19. {fast_dev_cli-0.18.3 → fast_dev_cli-0.18.4}/tests/conftest.py +0 -0
  20. {fast_dev_cli-0.18.3 → fast_dev_cli-0.18.4}/tests/test_bump.py +0 -0
  21. {fast_dev_cli-0.18.3 → fast_dev_cli-0.18.4}/tests/test_exec.py +0 -0
  22. {fast_dev_cli-0.18.3 → fast_dev_cli-0.18.4}/tests/test_fast_test.py +0 -0
  23. {fast_dev_cli-0.18.3 → fast_dev_cli-0.18.4}/tests/test_functions.py +0 -0
  24. {fast_dev_cli-0.18.3 → fast_dev_cli-0.18.4}/tests/test_help.py +0 -0
  25. {fast_dev_cli-0.18.3 → fast_dev_cli-0.18.4}/tests/test_lint.py +0 -0
  26. {fast_dev_cli-0.18.3 → fast_dev_cli-0.18.4}/tests/test_poetry_version_plugin.py +0 -0
  27. {fast_dev_cli-0.18.3 → fast_dev_cli-0.18.4}/tests/test_pypi.py +0 -0
  28. {fast_dev_cli-0.18.3 → fast_dev_cli-0.18.4}/tests/test_runserver.py +0 -0
  29. {fast_dev_cli-0.18.3 → fast_dev_cli-0.18.4}/tests/test_sync.py +0 -0
  30. {fast_dev_cli-0.18.3 → fast_dev_cli-0.18.4}/tests/test_tag.py +0 -0
  31. {fast_dev_cli-0.18.3 → fast_dev_cli-0.18.4}/tests/test_upgrade.py +0 -0
  32. {fast_dev_cli-0.18.3 → fast_dev_cli-0.18.4}/tests/test_upload.py +0 -0
  33. {fast_dev_cli-0.18.3 → fast_dev_cli-0.18.4}/tests/test_version.py +0 -0
  34. {fast_dev_cli-0.18.3 → 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.3
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
@@ -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__"
@@ -1063,11 +1070,16 @@ class LintCode(DryRun):
1063
1070
  ps = args.split() if isinstance(args, str) else [str(i) for i in args]
1064
1071
  if len(ps) == 1:
1065
1072
  paths = ps[0]
1066
- if paths != "." and paths.endswith(".") and not Path(paths).exists():
1067
- for ft in ("py", "html"):
1068
- name = paths + ft
1069
- if Path(name).exists():
1070
- paths = name
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
1071
1083
  break
1072
1084
  else:
1073
1085
  paths = " ".join(ps)
@@ -1341,9 +1353,18 @@ def run_by_subprocess(cmd: str, dry: bool = DryOption) -> None:
1341
1353
 
1342
1354
 
1343
1355
  class MakeDeps(DryRun):
1344
- 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:
1345
1364
  self._tool = tool
1346
1365
  self._prod = prod
1366
+ self._active = active
1367
+ self._inexact = inexact
1347
1368
  super().__init__(dry=dry)
1348
1369
 
1349
1370
  def should_ensure_pip(self) -> bool:
@@ -1361,9 +1382,10 @@ class MakeDeps(DryRun):
1361
1382
  if self._tool == "pdm":
1362
1383
  return "pdm sync " + ("--prod" if self._prod else "-G :all")
1363
1384
  elif self._tool == "uv":
1364
- return "uv sync --inexact --active" + (
1365
- "" if self._prod else " --all-extras --all-groups"
1366
- )
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")
1367
1389
  elif self._tool == "poetry":
1368
1390
  return "poetry install " + (
1369
1391
  "--only=main" if self._prod else "--all-extras --all-groups"
@@ -1392,6 +1414,12 @@ def make_deps(
1392
1414
  use_pdm: bool = Option(False, "--pdm", help="Use `pdm` to install deps"),
1393
1415
  use_pip: bool = Option(False, "--pip", help="Use `pip` to install deps"),
1394
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
+ ),
1395
1423
  dry: bool = DryOption,
1396
1424
  ) -> None:
1397
1425
  """Run: ruff check/format to reformat code and then mypy to check"""
@@ -1407,7 +1435,7 @@ def make_deps(
1407
1435
  tool = "poetry"
1408
1436
  elif tool == ToolOption.default:
1409
1437
  tool = Project.get_manage_tool(cache=True) or "pip"
1410
- MakeDeps(tool, prod, dry=dry).run()
1438
+ MakeDeps(tool, prod, active=active, inexact=inexact, dry=dry).run()
1411
1439
 
1412
1440
 
1413
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.3"
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"
@@ -1 +0,0 @@
1
- __version__ = "0.18.3"
File without changes
File without changes