fast-dev-cli 0.24.3__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.3 → 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.3 → fast_dev_cli-0.25.0}/fast_dev_cli/cli.py +63 -43
- {fast_dev_cli-0.24.3 → fast_dev_cli-0.25.0}/pyproject.toml +1 -1
- fast_dev_cli-0.24.3/fast_dev_cli/__init__.py +0 -1
- {fast_dev_cli-0.24.3 → fast_dev_cli-0.25.0}/LICENSE +0 -0
- {fast_dev_cli-0.24.3 → fast_dev_cli-0.25.0}/README.md +0 -0
- {fast_dev_cli-0.24.3 → fast_dev_cli-0.25.0}/fast_dev_cli/__main__.py +0 -0
- {fast_dev_cli-0.24.3 → fast_dev_cli-0.25.0}/fast_dev_cli/py.typed +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.25.0"
|
|
@@ -1230,50 +1230,54 @@ class LintCode(DryRun):
|
|
|
1230
1230
|
should_run_by_tool = with_prefix
|
|
1231
1231
|
requires_mypy = any(tool.startswith("mypy") for tool in tools)
|
|
1232
1232
|
global_mypy = False
|
|
1233
|
-
if requires_mypy
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
if
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
elif global_mypy:
|
|
1258
|
-
should_run_by_tool = True
|
|
1259
|
-
elif cls.missing_mypy_exec():
|
|
1260
|
-
should_run_by_tool = True
|
|
1261
|
-
if check_call('python -c "import fast_dev_cli"'):
|
|
1262
|
-
command = "python -m pip install -U mypy"
|
|
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"
|
|
1263
1257
|
yellow_warn(
|
|
1264
1258
|
"You may need to run the following command"
|
|
1265
|
-
f" to install
|
|
1259
|
+
f" to install ruff:\n\n {command}\n"
|
|
1266
1260
|
)
|
|
1267
|
-
|
|
1268
|
-
root = Project.get_work_dir(allow_cwd=True)
|
|
1269
|
-
if py := shutil.which("python"):
|
|
1270
|
-
try:
|
|
1271
|
-
Path(py).relative_to(root)
|
|
1272
|
-
except ValueError:
|
|
1273
|
-
# Virtual environment not activated
|
|
1261
|
+
elif global_mypy:
|
|
1274
1262
|
should_run_by_tool = True
|
|
1275
|
-
|
|
1276
|
-
|
|
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
|
|
1277
1281
|
if should_run_by_tool and tool:
|
|
1278
1282
|
if tool == ToolOption.default:
|
|
1279
1283
|
tool = Project.get_manage_tool() or ""
|
|
@@ -1581,18 +1585,34 @@ class Publish:
|
|
|
1581
1585
|
twine = "python -m build && twine upload"
|
|
1582
1586
|
|
|
1583
1587
|
@classmethod
|
|
1584
|
-
def gen(cls) -> str:
|
|
1585
|
-
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"
|
|
1586
1604
|
return cls.CommandEnum[tool]
|
|
1587
1605
|
return cls.CommandEnum.twine
|
|
1588
1606
|
|
|
1589
1607
|
|
|
1590
1608
|
@cli.command()
|
|
1591
1609
|
def upload(
|
|
1610
|
+
verbose: bool = False,
|
|
1611
|
+
tool: str = ToolOption,
|
|
1592
1612
|
dry: bool = DryOption,
|
|
1593
1613
|
) -> None:
|
|
1594
1614
|
"""Shortcut for package publish"""
|
|
1595
|
-
cmd = Publish.gen()
|
|
1615
|
+
cmd = Publish.gen(tool, verbose)
|
|
1596
1616
|
exit_if_run_failed(cmd, dry=dry)
|
|
1597
1617
|
|
|
1598
1618
|
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.24.3"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|