fast-dev-cli 0.19.4__tar.gz → 0.19.6__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 (35) hide show
  1. {fast_dev_cli-0.19.4 → fast_dev_cli-0.19.6}/PKG-INFO +1 -1
  2. fast_dev_cli-0.19.6/fast_dev_cli/__init__.py +1 -0
  3. {fast_dev_cli-0.19.4 → fast_dev_cli-0.19.6}/fast_dev_cli/cli.py +41 -15
  4. {fast_dev_cli-0.19.4 → fast_dev_cli-0.19.6}/pyproject.toml +1 -1
  5. fast_dev_cli-0.19.6/tests/assets/uv-upload-time.lock +1658 -0
  6. {fast_dev_cli-0.19.4 → fast_dev_cli-0.19.6}/tests/conftest.py +2 -5
  7. {fast_dev_cli-0.19.4 → fast_dev_cli-0.19.6}/tests/test_lint.py +4 -1
  8. {fast_dev_cli-0.19.4 → fast_dev_cli-0.19.6}/tests/test_pypi.py +25 -0
  9. {fast_dev_cli-0.19.4 → fast_dev_cli-0.19.6}/tests/test_upgrade.py +20 -16
  10. {fast_dev_cli-0.19.4 → fast_dev_cli-0.19.6}/tests/utils.py +18 -13
  11. fast_dev_cli-0.19.4/fast_dev_cli/__init__.py +0 -1
  12. {fast_dev_cli-0.19.4 → fast_dev_cli-0.19.6}/LICENSE +0 -0
  13. {fast_dev_cli-0.19.4 → fast_dev_cli-0.19.6}/README.md +0 -0
  14. {fast_dev_cli-0.19.4 → fast_dev_cli-0.19.6}/fast_dev_cli/__main__.py +0 -0
  15. {fast_dev_cli-0.19.4 → fast_dev_cli-0.19.6}/fast_dev_cli/py.typed +0 -0
  16. {fast_dev_cli-0.19.4 → fast_dev_cli-0.19.6}/pdm_build.py +0 -0
  17. {fast_dev_cli-0.19.4 → fast_dev_cli-0.19.6}/scripts/check.py +0 -0
  18. {fast_dev_cli-0.19.4 → fast_dev_cli-0.19.6}/scripts/deps.py +0 -0
  19. {fast_dev_cli-0.19.4 → fast_dev_cli-0.19.6}/scripts/format.py +0 -0
  20. {fast_dev_cli-0.19.4 → fast_dev_cli-0.19.6}/scripts/test.py +0 -0
  21. {fast_dev_cli-0.19.4 → fast_dev_cli-0.19.6}/tests/__init__.py +0 -0
  22. {fast_dev_cli-0.19.4 → fast_dev_cli-0.19.6}/tests/assets/uv-tx.lock +0 -0
  23. {fast_dev_cli-0.19.4 → fast_dev_cli-0.19.6}/tests/assets/uv.lock +0 -0
  24. {fast_dev_cli-0.19.4 → fast_dev_cli-0.19.6}/tests/test_bump.py +0 -0
  25. {fast_dev_cli-0.19.4 → fast_dev_cli-0.19.6}/tests/test_deps.py +0 -0
  26. {fast_dev_cli-0.19.4 → fast_dev_cli-0.19.6}/tests/test_exec.py +0 -0
  27. {fast_dev_cli-0.19.4 → fast_dev_cli-0.19.6}/tests/test_fast_test.py +0 -0
  28. {fast_dev_cli-0.19.4 → fast_dev_cli-0.19.6}/tests/test_functions.py +0 -0
  29. {fast_dev_cli-0.19.4 → fast_dev_cli-0.19.6}/tests/test_help.py +0 -0
  30. {fast_dev_cli-0.19.4 → fast_dev_cli-0.19.6}/tests/test_poetry_version_plugin.py +0 -0
  31. {fast_dev_cli-0.19.4 → fast_dev_cli-0.19.6}/tests/test_runserver.py +0 -0
  32. {fast_dev_cli-0.19.4 → fast_dev_cli-0.19.6}/tests/test_sync.py +0 -0
  33. {fast_dev_cli-0.19.4 → fast_dev_cli-0.19.6}/tests/test_tag.py +0 -0
  34. {fast_dev_cli-0.19.4 → fast_dev_cli-0.19.6}/tests/test_upload.py +0 -0
  35. {fast_dev_cli-0.19.4 → fast_dev_cli-0.19.6}/tests/test_version.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: fast-dev-cli
3
- Version: 0.19.4
3
+ Version: 0.19.6
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.19.6"
@@ -170,7 +170,10 @@ class Shell:
170
170
 
171
171
  def check_call(self) -> bool:
172
172
  self._kw.update(stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
173
- return self.run() == 0
173
+ try:
174
+ return self.run() == 0
175
+ except FileNotFoundError:
176
+ return False
174
177
 
175
178
  def capture_output(self, raises: bool = False) -> str:
176
179
  self._kw.update(capture_output=True, encoding="utf-8")
@@ -180,7 +183,7 @@ class Shell:
180
183
  return (r.stdout or r.stderr or "").strip()
181
184
 
182
185
  def finish(
183
- self, env: dict[str, str] | None = None, _exit: bool = False, dry=False
186
+ self, env: dict[str, str] | None = None, _exit: bool = False, dry: bool = False
184
187
  ) -> subprocess.CompletedProcess[str]:
185
188
  self.run(verbose=True, dry=True)
186
189
  if _ensure_bool(dry):
@@ -395,7 +398,7 @@ class BumpUp(DryRun):
395
398
  @staticmethod
396
399
  def parse_dynamic_version(
397
400
  toml_text: str,
398
- context: dict,
401
+ context: dict[str, Any],
399
402
  work_dir: Path | None = None,
400
403
  ) -> str | None:
401
404
  if work_dir is None:
@@ -457,7 +460,7 @@ class BumpUp(DryRun):
457
460
  return TOML_FILE
458
461
 
459
462
  @staticmethod
460
- def parse_plugin_version(context: dict, package_name: str | None) -> str:
463
+ def parse_plugin_version(context: dict[str, Any], package_name: str | None) -> str:
461
464
  try:
462
465
  package_item = context["tool"]["poetry"]["packages"]
463
466
  except KeyError:
@@ -761,7 +764,7 @@ class Project:
761
764
 
762
765
  @classmethod
763
766
  def get_sync_command(
764
- cls, prod: bool = True, doc: dict | None = None, only_me: bool = False
767
+ cls, prod: bool = True, doc: dict[str, Any] | None = None, only_me: bool = False
765
768
  ) -> str:
766
769
  pdm_i = "pdm install --frozen" + " --prod" * prod
767
770
  if cls.is_pdm_project():
@@ -1060,6 +1063,7 @@ class LintCode(DryRun):
1060
1063
  prefix: bool = False,
1061
1064
  up: bool = False,
1062
1065
  sim: bool = True,
1066
+ strict: bool = False,
1063
1067
  ) -> None:
1064
1068
  self.args = args
1065
1069
  self.check_only = check_only
@@ -1070,6 +1074,7 @@ class LintCode(DryRun):
1070
1074
  self._prefix = prefix
1071
1075
  self._up = up
1072
1076
  self._sim = sim
1077
+ self._strict = strict
1073
1078
  super().__init__(_exit, dry)
1074
1079
 
1075
1080
  @staticmethod
@@ -1114,6 +1119,7 @@ class LintCode(DryRun):
1114
1119
  with_prefix: bool = False,
1115
1120
  ruff_check_up: bool = False,
1116
1121
  ruff_check_sim: bool = True,
1122
+ mypy_strict: bool = False,
1117
1123
  ) -> str:
1118
1124
  if paths != "." and all(i.endswith(".html") for i in paths.split()):
1119
1125
  return f"prettier -w {paths}"
@@ -1130,8 +1136,11 @@ class LintCode(DryRun):
1130
1136
  if skip_mypy or load_bool("SKIP_MYPY") or load_bool("FASTDEVCLI_NO_MYPY"):
1131
1137
  # Sometimes mypy is too slow
1132
1138
  tools = tools[:-1]
1133
- elif load_bool("IGNORE_MISSING_IMPORTS"):
1134
- tools[-1] += " --ignore-missing-imports"
1139
+ else:
1140
+ if load_bool("IGNORE_MISSING_IMPORTS"):
1141
+ tools[-1] += " --ignore-missing-imports"
1142
+ if mypy_strict or load_bool("FASTDEVCLI_STRICT"):
1143
+ tools[-1] += " --strict"
1135
1144
  lint_them = " && ".join(
1136
1145
  "{0}{" + str(i) + "} {1}" for i in range(2, len(tools) + 2)
1137
1146
  )
@@ -1239,6 +1248,7 @@ class LintCode(DryRun):
1239
1248
  with_prefix=self._prefix,
1240
1249
  ruff_check_up=self._up,
1241
1250
  ruff_check_sim=self._sim,
1251
+ mypy_strict=self._strict,
1242
1252
  )
1243
1253
 
1244
1254
 
@@ -1256,6 +1266,7 @@ def lint(
1256
1266
  prefix: bool = False,
1257
1267
  up: bool = False,
1258
1268
  sim: bool = True,
1269
+ strict: bool = False,
1259
1270
  ) -> None:
1260
1271
  if files is None:
1261
1272
  files = parse_files(sys.argv[1:])
@@ -1271,6 +1282,7 @@ def lint(
1271
1282
  prefix=prefix,
1272
1283
  up=up,
1273
1284
  sim=sim,
1285
+ strict=strict,
1274
1286
  ).run()
1275
1287
 
1276
1288
 
@@ -1283,6 +1295,7 @@ def check(
1283
1295
  tool: str = ToolOption.default,
1284
1296
  up: bool = False,
1285
1297
  sim: bool = True,
1298
+ strict: bool = False,
1286
1299
  ) -> None:
1287
1300
  LintCode(
1288
1301
  files,
@@ -1295,6 +1308,7 @@ def check(
1295
1308
  tool=tool,
1296
1309
  up=up,
1297
1310
  sim=sim,
1311
+ strict=strict,
1298
1312
  ).run()
1299
1313
 
1300
1314
 
@@ -1316,6 +1330,7 @@ def make_style(
1316
1330
  dry: bool = DryOption,
1317
1331
  up: bool = Option(False, help="Whether ruff check with --extend-select=UP"),
1318
1332
  sim: bool = Option(True, help="Whether ruff check with --extend-select=SIM"),
1333
+ strict: bool = Option(False, help="Whether run mypy with --strict"),
1319
1334
  ) -> None:
1320
1335
  """Run: ruff check/format to reformat code and then mypy to check"""
1321
1336
  if getattr(files, "default", files) is None:
@@ -1329,11 +1344,10 @@ def make_style(
1329
1344
  tool = _ensure_str(tool)
1330
1345
  up = _ensure_bool(up)
1331
1346
  sim = _ensure_bool(sim)
1347
+ strict = _ensure_bool(strict)
1332
1348
  kwargs = {"dry": dry, "skip_mypy": skip, "dmypy": dmypy, "bandit": bandit}
1333
- if _ensure_bool(check_only):
1334
- check(files, tool=tool, up=up, sim=sim, **kwargs)
1335
- else:
1336
- lint(files, prefix=prefix, tool=tool, up=up, sim=sim, **kwargs)
1349
+ run = check if _ensure_bool(check_only) else functools.partial(lint, prefix=prefix)
1350
+ run(files, tool=tool, up=up, sim=sim, strict=strict, **kwargs)
1337
1351
 
1338
1352
 
1339
1353
  @cli.command(name="check")
@@ -1343,6 +1357,7 @@ def only_check(
1343
1357
  dry: bool = DryOption,
1344
1358
  up: bool = Option(False, help="Whether ruff check with --extend-select=UP"),
1345
1359
  sim: bool = Option(True, help="Whether ruff check with --extend-select=SIM"),
1360
+ strict: bool = Option(False, help="Whether run mypy with --strict"),
1346
1361
  ) -> None:
1347
1362
  """Check code style without reformat"""
1348
1363
  bandit = _ensure_bool(bandit)
@@ -1612,15 +1627,20 @@ class UvPypi(DryRun):
1612
1627
  PYPI = "https://pypi.org/simple"
1613
1628
  HOST = "https://files.pythonhosted.org"
1614
1629
 
1615
- def __init__(self, lock_file: Path, dry: bool, verbose: bool, quiet: bool) -> None:
1630
+ def __init__(
1631
+ self, lock_file: Path, dry: bool, verbose: bool, quiet: bool, slim: bool = False
1632
+ ) -> None:
1616
1633
  super().__init__(dry=dry)
1617
1634
  self.lock_file = lock_file
1618
1635
  self._verbose = _ensure_bool(verbose)
1619
1636
  self._quiet = _ensure_bool(quiet)
1637
+ self._slim = _ensure_bool(slim)
1620
1638
 
1621
1639
  def run(self) -> None:
1622
1640
  try:
1623
- rc = self.update_lock(self.lock_file, self._verbose, self._quiet)
1641
+ rc = self.update_lock(
1642
+ self.lock_file, self._verbose, self._quiet, self._slim
1643
+ )
1624
1644
  except ValueError as e:
1625
1645
  secho(str(e), fg=typer.colors.RED)
1626
1646
  raise Exit(1) from e
@@ -1629,7 +1649,9 @@ class UvPypi(DryRun):
1629
1649
  raise Exit(rc)
1630
1650
 
1631
1651
  @classmethod
1632
- def update_lock(cls, p: Path, verbose: bool, quiet: bool) -> int:
1652
+ def update_lock(
1653
+ cls, p: Path, verbose: bool, quiet: bool, slim: bool = False
1654
+ ) -> int:
1633
1655
  text = p.read_text("utf-8")
1634
1656
  registry_pattern = r'(registry = ")(.*?)"'
1635
1657
  replace_registry = functools.partial(
@@ -1672,6 +1694,9 @@ class UvPypi(DryRun):
1672
1694
  if verbose:
1673
1695
  for current_host in sorted(download_hosts):
1674
1696
  echo(f"{current_host} --> {cls.HOST}")
1697
+ if slim:
1698
+ pattern = r', size = \d+, upload-time = ".*?"'
1699
+ text = re.sub(pattern, "", text)
1675
1700
  size = p.write_text(text, encoding="utf-8")
1676
1701
  if verbose:
1677
1702
  echo(f"Updated {p} with {size} bytes.")
@@ -1686,6 +1711,7 @@ def pypi(
1686
1711
  dry: bool = DryOption,
1687
1712
  verbose: bool = False,
1688
1713
  quiet: bool = False,
1714
+ slim: bool = False,
1689
1715
  ) -> None:
1690
1716
  """Change registry of uv.lock to be pypi.org"""
1691
1717
  if not (p := Path(_ensure_str(file) or "uv.lock")).exists() and not (
@@ -1693,7 +1719,7 @@ def pypi(
1693
1719
  ):
1694
1720
  yellow_warn(f"{p.name!r} not found!")
1695
1721
  return
1696
- UvPypi(p, dry, verbose, quiet).run()
1722
+ UvPypi(p, dry, verbose, quiet, slim).run()
1697
1723
 
1698
1724
 
1699
1725
  def version_callback(value: bool) -> None:
@@ -41,7 +41,7 @@ dependencies = [
41
41
  "bumpversion2 >=1.4.3",
42
42
  "pytest >=8.2.0",
43
43
  ]
44
- version = "0.19.4"
44
+ version = "0.19.6"
45
45
 
46
46
  [project.urls]
47
47
  Homepage = "https://github.com/waketzheng/fast-dev-cli"