fast-dev-cli 0.19.5__tar.gz → 0.19.7__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.19.5 → fast_dev_cli-0.19.7}/PKG-INFO +1 -1
- fast_dev_cli-0.19.7/fast_dev_cli/__init__.py +1 -0
- {fast_dev_cli-0.19.5 → fast_dev_cli-0.19.7}/fast_dev_cli/cli.py +46 -12
- {fast_dev_cli-0.19.5 → fast_dev_cli-0.19.7}/pyproject.toml +4 -1
- fast_dev_cli-0.19.7/tests/assets/uv-upload-time.lock +1658 -0
- {fast_dev_cli-0.19.5 → fast_dev_cli-0.19.7}/tests/test_lint.py +17 -0
- {fast_dev_cli-0.19.5 → fast_dev_cli-0.19.7}/tests/test_pypi.py +25 -0
- {fast_dev_cli-0.19.5 → fast_dev_cli-0.19.7}/tests/test_upgrade.py +2 -1
- fast_dev_cli-0.19.5/fast_dev_cli/__init__.py +0 -1
- {fast_dev_cli-0.19.5 → fast_dev_cli-0.19.7}/LICENSE +0 -0
- {fast_dev_cli-0.19.5 → fast_dev_cli-0.19.7}/README.md +0 -0
- {fast_dev_cli-0.19.5 → fast_dev_cli-0.19.7}/fast_dev_cli/__main__.py +0 -0
- {fast_dev_cli-0.19.5 → fast_dev_cli-0.19.7}/fast_dev_cli/py.typed +0 -0
- {fast_dev_cli-0.19.5 → fast_dev_cli-0.19.7}/pdm_build.py +0 -0
- {fast_dev_cli-0.19.5 → fast_dev_cli-0.19.7}/scripts/check.py +0 -0
- {fast_dev_cli-0.19.5 → fast_dev_cli-0.19.7}/scripts/deps.py +0 -0
- {fast_dev_cli-0.19.5 → fast_dev_cli-0.19.7}/scripts/format.py +0 -0
- {fast_dev_cli-0.19.5 → fast_dev_cli-0.19.7}/scripts/test.py +0 -0
- {fast_dev_cli-0.19.5 → fast_dev_cli-0.19.7}/tests/__init__.py +0 -0
- {fast_dev_cli-0.19.5 → fast_dev_cli-0.19.7}/tests/assets/uv-tx.lock +0 -0
- {fast_dev_cli-0.19.5 → fast_dev_cli-0.19.7}/tests/assets/uv.lock +0 -0
- {fast_dev_cli-0.19.5 → fast_dev_cli-0.19.7}/tests/conftest.py +0 -0
- {fast_dev_cli-0.19.5 → fast_dev_cli-0.19.7}/tests/test_bump.py +0 -0
- {fast_dev_cli-0.19.5 → fast_dev_cli-0.19.7}/tests/test_deps.py +0 -0
- {fast_dev_cli-0.19.5 → fast_dev_cli-0.19.7}/tests/test_exec.py +0 -0
- {fast_dev_cli-0.19.5 → fast_dev_cli-0.19.7}/tests/test_fast_test.py +0 -0
- {fast_dev_cli-0.19.5 → fast_dev_cli-0.19.7}/tests/test_functions.py +0 -0
- {fast_dev_cli-0.19.5 → fast_dev_cli-0.19.7}/tests/test_help.py +0 -0
- {fast_dev_cli-0.19.5 → fast_dev_cli-0.19.7}/tests/test_poetry_version_plugin.py +0 -0
- {fast_dev_cli-0.19.5 → fast_dev_cli-0.19.7}/tests/test_runserver.py +0 -0
- {fast_dev_cli-0.19.5 → fast_dev_cli-0.19.7}/tests/test_sync.py +0 -0
- {fast_dev_cli-0.19.5 → fast_dev_cli-0.19.7}/tests/test_tag.py +0 -0
- {fast_dev_cli-0.19.5 → fast_dev_cli-0.19.7}/tests/test_upload.py +0 -0
- {fast_dev_cli-0.19.5 → fast_dev_cli-0.19.7}/tests/test_version.py +0 -0
- {fast_dev_cli-0.19.5 → fast_dev_cli-0.19.7}/tests/utils.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.19.7"
|
|
@@ -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
|
-
|
|
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")
|
|
@@ -561,7 +564,7 @@ def version() -> None:
|
|
|
561
564
|
echo(f"Got Version from {TOML_FILE}: " + styled)
|
|
562
565
|
return
|
|
563
566
|
version_file = doc["tool"]["pdm"]["version"]["path"]
|
|
564
|
-
text = Project.get_work_dir().joinpath(version_file).read_text()
|
|
567
|
+
text = Project.get_work_dir().joinpath(version_file).read_text(encoding="utf-8")
|
|
565
568
|
varname = "__version__"
|
|
566
569
|
for line in text.splitlines():
|
|
567
570
|
if line.strip().startswith(varname):
|
|
@@ -1061,6 +1064,7 @@ class LintCode(DryRun):
|
|
|
1061
1064
|
up: bool = False,
|
|
1062
1065
|
sim: bool = True,
|
|
1063
1066
|
strict: bool = False,
|
|
1067
|
+
ty: bool = False,
|
|
1064
1068
|
) -> None:
|
|
1065
1069
|
self.args = args
|
|
1066
1070
|
self.check_only = check_only
|
|
@@ -1072,6 +1076,7 @@ class LintCode(DryRun):
|
|
|
1072
1076
|
self._up = up
|
|
1073
1077
|
self._sim = sim
|
|
1074
1078
|
self._strict = strict
|
|
1079
|
+
self._ty = _ensure_bool(ty)
|
|
1075
1080
|
super().__init__(_exit, dry)
|
|
1076
1081
|
|
|
1077
1082
|
@staticmethod
|
|
@@ -1117,6 +1122,7 @@ class LintCode(DryRun):
|
|
|
1117
1122
|
ruff_check_up: bool = False,
|
|
1118
1123
|
ruff_check_sim: bool = True,
|
|
1119
1124
|
mypy_strict: bool = False,
|
|
1125
|
+
prefer_ty: bool = False,
|
|
1120
1126
|
) -> str:
|
|
1121
1127
|
if paths != "." and all(i.endswith(".html") for i in paths.split()):
|
|
1122
1128
|
return f"prettier -w {paths}"
|
|
@@ -1134,10 +1140,13 @@ class LintCode(DryRun):
|
|
|
1134
1140
|
# Sometimes mypy is too slow
|
|
1135
1141
|
tools = tools[:-1]
|
|
1136
1142
|
else:
|
|
1137
|
-
if load_bool("
|
|
1138
|
-
tools[-1]
|
|
1139
|
-
|
|
1140
|
-
|
|
1143
|
+
if prefer_ty or load_bool("FASTDEVCLI_TY"):
|
|
1144
|
+
tools[-1] = "ty check"
|
|
1145
|
+
else:
|
|
1146
|
+
if load_bool("IGNORE_MISSING_IMPORTS"):
|
|
1147
|
+
tools[-1] += " --ignore-missing-imports"
|
|
1148
|
+
if mypy_strict or load_bool("FASTDEVCLI_STRICT"):
|
|
1149
|
+
tools[-1] += " --strict"
|
|
1141
1150
|
lint_them = " && ".join(
|
|
1142
1151
|
"{0}{" + str(i) + "} {1}" for i in range(2, len(tools) + 2)
|
|
1143
1152
|
)
|
|
@@ -1246,6 +1255,7 @@ class LintCode(DryRun):
|
|
|
1246
1255
|
ruff_check_up=self._up,
|
|
1247
1256
|
ruff_check_sim=self._sim,
|
|
1248
1257
|
mypy_strict=self._strict,
|
|
1258
|
+
prefer_ty=self._ty,
|
|
1249
1259
|
)
|
|
1250
1260
|
|
|
1251
1261
|
|
|
@@ -1264,6 +1274,7 @@ def lint(
|
|
|
1264
1274
|
up: bool = False,
|
|
1265
1275
|
sim: bool = True,
|
|
1266
1276
|
strict: bool = False,
|
|
1277
|
+
ty: bool = False,
|
|
1267
1278
|
) -> None:
|
|
1268
1279
|
if files is None:
|
|
1269
1280
|
files = parse_files(sys.argv[1:])
|
|
@@ -1280,6 +1291,7 @@ def lint(
|
|
|
1280
1291
|
up=up,
|
|
1281
1292
|
sim=sim,
|
|
1282
1293
|
strict=strict,
|
|
1294
|
+
ty=ty,
|
|
1283
1295
|
).run()
|
|
1284
1296
|
|
|
1285
1297
|
|
|
@@ -1293,6 +1305,7 @@ def check(
|
|
|
1293
1305
|
up: bool = False,
|
|
1294
1306
|
sim: bool = True,
|
|
1295
1307
|
strict: bool = False,
|
|
1308
|
+
ty: bool = False,
|
|
1296
1309
|
) -> None:
|
|
1297
1310
|
LintCode(
|
|
1298
1311
|
files,
|
|
@@ -1306,6 +1319,7 @@ def check(
|
|
|
1306
1319
|
up=up,
|
|
1307
1320
|
sim=sim,
|
|
1308
1321
|
strict=strict,
|
|
1322
|
+
ty=ty,
|
|
1309
1323
|
).run()
|
|
1310
1324
|
|
|
1311
1325
|
|
|
@@ -1328,6 +1342,7 @@ def make_style(
|
|
|
1328
1342
|
up: bool = Option(False, help="Whether ruff check with --extend-select=UP"),
|
|
1329
1343
|
sim: bool = Option(True, help="Whether ruff check with --extend-select=SIM"),
|
|
1330
1344
|
strict: bool = Option(False, help="Whether run mypy with --strict"),
|
|
1345
|
+
ty: bool = Option(False, help="Whether use ty instead of mypy"),
|
|
1331
1346
|
) -> None:
|
|
1332
1347
|
"""Run: ruff check/format to reformat code and then mypy to check"""
|
|
1333
1348
|
if getattr(files, "default", files) is None:
|
|
@@ -1344,7 +1359,7 @@ def make_style(
|
|
|
1344
1359
|
strict = _ensure_bool(strict)
|
|
1345
1360
|
kwargs = {"dry": dry, "skip_mypy": skip, "dmypy": dmypy, "bandit": bandit}
|
|
1346
1361
|
run = check if _ensure_bool(check_only) else functools.partial(lint, prefix=prefix)
|
|
1347
|
-
run(files, tool=tool, up=up, sim=sim, strict=strict, **kwargs)
|
|
1362
|
+
run(files, tool=tool, up=up, sim=sim, strict=strict, ty=ty, **kwargs)
|
|
1348
1363
|
|
|
1349
1364
|
|
|
1350
1365
|
@cli.command(name="check")
|
|
@@ -1355,12 +1370,14 @@ def only_check(
|
|
|
1355
1370
|
up: bool = Option(False, help="Whether ruff check with --extend-select=UP"),
|
|
1356
1371
|
sim: bool = Option(True, help="Whether ruff check with --extend-select=SIM"),
|
|
1357
1372
|
strict: bool = Option(False, help="Whether run mypy with --strict"),
|
|
1373
|
+
ty: bool = Option(False, help="Whether use ty instead of mypy"),
|
|
1358
1374
|
) -> None:
|
|
1359
1375
|
"""Check code style without reformat"""
|
|
1360
1376
|
bandit = _ensure_bool(bandit)
|
|
1361
1377
|
up = _ensure_bool(up)
|
|
1362
1378
|
sim = _ensure_bool(sim)
|
|
1363
|
-
|
|
1379
|
+
skip_mypy = _ensure_bool(skip_mypy)
|
|
1380
|
+
check(dry=dry, bandit=bandit, skip_mypy=skip_mypy, up=up, sim=sim, ty=ty)
|
|
1364
1381
|
|
|
1365
1382
|
|
|
1366
1383
|
class Sync(DryRun):
|
|
@@ -1624,15 +1641,20 @@ class UvPypi(DryRun):
|
|
|
1624
1641
|
PYPI = "https://pypi.org/simple"
|
|
1625
1642
|
HOST = "https://files.pythonhosted.org"
|
|
1626
1643
|
|
|
1627
|
-
def __init__(
|
|
1644
|
+
def __init__(
|
|
1645
|
+
self, lock_file: Path, dry: bool, verbose: bool, quiet: bool, slim: bool = False
|
|
1646
|
+
) -> None:
|
|
1628
1647
|
super().__init__(dry=dry)
|
|
1629
1648
|
self.lock_file = lock_file
|
|
1630
1649
|
self._verbose = _ensure_bool(verbose)
|
|
1631
1650
|
self._quiet = _ensure_bool(quiet)
|
|
1651
|
+
self._slim = _ensure_bool(slim)
|
|
1632
1652
|
|
|
1633
1653
|
def run(self) -> None:
|
|
1634
1654
|
try:
|
|
1635
|
-
rc = self.update_lock(
|
|
1655
|
+
rc = self.update_lock(
|
|
1656
|
+
self.lock_file, self._verbose, self._quiet, self._slim
|
|
1657
|
+
)
|
|
1636
1658
|
except ValueError as e:
|
|
1637
1659
|
secho(str(e), fg=typer.colors.RED)
|
|
1638
1660
|
raise Exit(1) from e
|
|
@@ -1641,7 +1663,9 @@ class UvPypi(DryRun):
|
|
|
1641
1663
|
raise Exit(rc)
|
|
1642
1664
|
|
|
1643
1665
|
@classmethod
|
|
1644
|
-
def update_lock(
|
|
1666
|
+
def update_lock(
|
|
1667
|
+
cls, p: Path, verbose: bool, quiet: bool, slim: bool = False
|
|
1668
|
+
) -> int:
|
|
1645
1669
|
text = p.read_text("utf-8")
|
|
1646
1670
|
registry_pattern = r'(registry = ")(.*?)"'
|
|
1647
1671
|
replace_registry = functools.partial(
|
|
@@ -1684,6 +1708,15 @@ class UvPypi(DryRun):
|
|
|
1684
1708
|
if verbose:
|
|
1685
1709
|
for current_host in sorted(download_hosts):
|
|
1686
1710
|
echo(f"{current_host} --> {cls.HOST}")
|
|
1711
|
+
return cls.slim_and_write(cast(str, text), slim, p, verbose, quiet)
|
|
1712
|
+
|
|
1713
|
+
@staticmethod
|
|
1714
|
+
def slim_and_write(
|
|
1715
|
+
text: str, slim: bool, p: Path, verbose: bool, quiet: bool
|
|
1716
|
+
) -> int:
|
|
1717
|
+
if slim:
|
|
1718
|
+
pattern = r', size = \d+, upload-time = ".*?"'
|
|
1719
|
+
text = re.sub(pattern, "", text)
|
|
1687
1720
|
size = p.write_text(text, encoding="utf-8")
|
|
1688
1721
|
if verbose:
|
|
1689
1722
|
echo(f"Updated {p} with {size} bytes.")
|
|
@@ -1698,6 +1731,7 @@ def pypi(
|
|
|
1698
1731
|
dry: bool = DryOption,
|
|
1699
1732
|
verbose: bool = False,
|
|
1700
1733
|
quiet: bool = False,
|
|
1734
|
+
slim: bool = False,
|
|
1701
1735
|
) -> None:
|
|
1702
1736
|
"""Change registry of uv.lock to be pypi.org"""
|
|
1703
1737
|
if not (p := Path(_ensure_str(file) or "uv.lock")).exists() and not (
|
|
@@ -1705,7 +1739,7 @@ def pypi(
|
|
|
1705
1739
|
):
|
|
1706
1740
|
yellow_warn(f"{p.name!r} not found!")
|
|
1707
1741
|
return
|
|
1708
|
-
UvPypi(p, dry, verbose, quiet).run()
|
|
1742
|
+
UvPypi(p, dry, verbose, quiet, slim).run()
|
|
1709
1743
|
|
|
1710
1744
|
|
|
1711
1745
|
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.
|
|
44
|
+
version = "0.19.7"
|
|
45
45
|
|
|
46
46
|
[project.urls]
|
|
47
47
|
Homepage = "https://github.com/waketzheng/fast-dev-cli"
|
|
@@ -161,6 +161,9 @@ omit = [
|
|
|
161
161
|
"fast_dev_cli/__main__.py",
|
|
162
162
|
]
|
|
163
163
|
|
|
164
|
+
[tool.ty.rules]
|
|
165
|
+
unresolved-import = "ignore"
|
|
166
|
+
|
|
164
167
|
[tool.mypy]
|
|
165
168
|
pretty = true
|
|
166
169
|
python_version = "3.10"
|