fast-dev-cli 0.24.2__tar.gz → 0.25.0__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.24.2 → fast_dev_cli-0.25.0}/PKG-INFO +1 -1
- fast_dev_cli-0.25.0/fast_dev_cli/__init__.py +1 -0
- {fast_dev_cli-0.24.2 → fast_dev_cli-0.25.0}/fast_dev_cli/cli.py +69 -34
- {fast_dev_cli-0.24.2 → fast_dev_cli-0.25.0}/pyproject.toml +1 -1
- fast_dev_cli-0.24.2/fast_dev_cli/__init__.py +0 -1
- {fast_dev_cli-0.24.2 → fast_dev_cli-0.25.0}/LICENSE +0 -0
- {fast_dev_cli-0.24.2 → fast_dev_cli-0.25.0}/README.md +0 -0
- {fast_dev_cli-0.24.2 → fast_dev_cli-0.25.0}/fast_dev_cli/__main__.py +0 -0
- {fast_dev_cli-0.24.2 → fast_dev_cli-0.25.0}/fast_dev_cli/py.typed +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.25.0"
|
|
@@ -1229,40 +1229,55 @@ class LintCode(DryRun):
|
|
|
1229
1229
|
prefix = ""
|
|
1230
1230
|
should_run_by_tool = with_prefix
|
|
1231
1231
|
requires_mypy = any(tool.startswith("mypy") for tool in tools)
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1232
|
+
global_mypy = False
|
|
1233
|
+
if requires_mypy:
|
|
1234
|
+
# TODO: move this long logic to a single function
|
|
1235
|
+
local_bin = Path.home().joinpath(".local/bin")
|
|
1236
|
+
if local_bin.joinpath("mypy").exists():
|
|
1237
|
+
global_mypy = True
|
|
1238
|
+
mypy_opt = "--python-executable=.venv/bin/python"
|
|
1239
|
+
for i, t in enumerate(tools):
|
|
1240
|
+
if t.startswith("mypy"):
|
|
1241
|
+
if mypy_opt not in t:
|
|
1242
|
+
tools[i] = t + " " + mypy_opt
|
|
1243
|
+
break
|
|
1244
|
+
if not should_run_by_tool:
|
|
1245
|
+
if is_venv() and Path(sys.argv[0]).parent != local_bin:
|
|
1246
|
+
# Virtual environment activated and fast-dev-cli is installed in it
|
|
1247
|
+
if not ruff_exists:
|
|
1248
|
+
should_run_by_tool = True
|
|
1249
|
+
command = "pipx install ruff"
|
|
1250
|
+
if shutil.which("pipx") is None:
|
|
1251
|
+
ensure_pipx = (
|
|
1252
|
+
"pip install --user pipx\n pipx ensurepath\n "
|
|
1253
|
+
)
|
|
1254
|
+
command = ensure_pipx + command
|
|
1255
|
+
elif prefer_uv_tool():
|
|
1256
|
+
command = "uv tool install ruff"
|
|
1252
1257
|
yellow_warn(
|
|
1253
1258
|
"You may need to run the following command"
|
|
1254
|
-
f" to install
|
|
1259
|
+
f" to install ruff:\n\n {command}\n"
|
|
1255
1260
|
)
|
|
1256
|
-
|
|
1257
|
-
root = Project.get_work_dir(allow_cwd=True)
|
|
1258
|
-
if py := shutil.which("python"):
|
|
1259
|
-
try:
|
|
1260
|
-
Path(py).relative_to(root)
|
|
1261
|
-
except ValueError:
|
|
1262
|
-
# Virtual environment not activated
|
|
1261
|
+
elif global_mypy:
|
|
1263
1262
|
should_run_by_tool = True
|
|
1264
|
-
|
|
1265
|
-
|
|
1263
|
+
elif cls.missing_mypy_exec():
|
|
1264
|
+
should_run_by_tool = True
|
|
1265
|
+
if check_call('python -c "import fast_dev_cli"'):
|
|
1266
|
+
command = "python -m pip install -U mypy"
|
|
1267
|
+
yellow_warn(
|
|
1268
|
+
"You may need to run the following command"
|
|
1269
|
+
f" to install lint tools:\n\n {command}\n"
|
|
1270
|
+
)
|
|
1271
|
+
elif tool == ToolOption.default:
|
|
1272
|
+
root = Project.get_work_dir(allow_cwd=True)
|
|
1273
|
+
if py := shutil.which("python"):
|
|
1274
|
+
try:
|
|
1275
|
+
Path(py).relative_to(root)
|
|
1276
|
+
except ValueError:
|
|
1277
|
+
# Virtual environment not activated
|
|
1278
|
+
should_run_by_tool = True
|
|
1279
|
+
else:
|
|
1280
|
+
should_run_by_tool = True
|
|
1266
1281
|
if should_run_by_tool and tool:
|
|
1267
1282
|
if tool == ToolOption.default:
|
|
1268
1283
|
tool = Project.get_manage_tool() or ""
|
|
@@ -1280,7 +1295,11 @@ class LintCode(DryRun):
|
|
|
1280
1295
|
tool
|
|
1281
1296
|
# `ruff <command>` get the same result with `pdm run ruff <command>`.
|
|
1282
1297
|
# Other tools should run inside the selected environment.
|
|
1283
|
-
if
|
|
1298
|
+
if (
|
|
1299
|
+
ruff_exists
|
|
1300
|
+
and tool.startswith("ruff")
|
|
1301
|
+
or (global_mypy and tool.startswith("mypy"))
|
|
1302
|
+
)
|
|
1284
1303
|
else prefix + tool
|
|
1285
1304
|
)
|
|
1286
1305
|
+ f" {paths}"
|
|
@@ -1566,18 +1585,34 @@ class Publish:
|
|
|
1566
1585
|
twine = "python -m build && twine upload"
|
|
1567
1586
|
|
|
1568
1587
|
@classmethod
|
|
1569
|
-
def gen(cls) -> str:
|
|
1570
|
-
if tool
|
|
1588
|
+
def gen(cls, tool: str, verbose: bool) -> str:
|
|
1589
|
+
if tool == "auto":
|
|
1590
|
+
tool = Project.get_manage_tool() or ""
|
|
1591
|
+
if tool:
|
|
1592
|
+
if tool == "uv":
|
|
1593
|
+
envs = ["UV_PUBLISH_INDEX", "UV_PUBLISH_URL", "UV_PUBLISH_TOKEN"]
|
|
1594
|
+
if not any(os.getenv(i) for i in envs):
|
|
1595
|
+
if verbose:
|
|
1596
|
+
yellow_warn(f"Skip uv publish as envs ({envs}) not set")
|
|
1597
|
+
return "uv build"
|
|
1598
|
+
elif tool == "pdm":
|
|
1599
|
+
env = "PDM_PUBLISH_REPO"
|
|
1600
|
+
if not os.getenv(env):
|
|
1601
|
+
if verbose:
|
|
1602
|
+
yellow_warn(f"Skip pdm publish as env ({env}) not set")
|
|
1603
|
+
return "pdm build"
|
|
1571
1604
|
return cls.CommandEnum[tool]
|
|
1572
1605
|
return cls.CommandEnum.twine
|
|
1573
1606
|
|
|
1574
1607
|
|
|
1575
1608
|
@cli.command()
|
|
1576
1609
|
def upload(
|
|
1610
|
+
verbose: bool = False,
|
|
1611
|
+
tool: str = ToolOption,
|
|
1577
1612
|
dry: bool = DryOption,
|
|
1578
1613
|
) -> None:
|
|
1579
1614
|
"""Shortcut for package publish"""
|
|
1580
|
-
cmd = Publish.gen()
|
|
1615
|
+
cmd = Publish.gen(tool, verbose)
|
|
1581
1616
|
exit_if_run_failed(cmd, dry=dry)
|
|
1582
1617
|
|
|
1583
1618
|
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.24.2"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|