fast-dev-cli 0.24.1__tar.gz → 0.24.2__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.1 → fast_dev_cli-0.24.2}/PKG-INFO +1 -1
- fast_dev_cli-0.24.2/fast_dev_cli/__init__.py +1 -0
- {fast_dev_cli-0.24.1 → fast_dev_cli-0.24.2}/fast_dev_cli/cli.py +26 -5
- {fast_dev_cli-0.24.1 → fast_dev_cli-0.24.2}/pyproject.toml +1 -1
- fast_dev_cli-0.24.1/fast_dev_cli/__init__.py +0 -1
- {fast_dev_cli-0.24.1 → fast_dev_cli-0.24.2}/LICENSE +0 -0
- {fast_dev_cli-0.24.1 → fast_dev_cli-0.24.2}/README.md +0 -0
- {fast_dev_cli-0.24.1 → fast_dev_cli-0.24.2}/fast_dev_cli/__main__.py +0 -0
- {fast_dev_cli-0.24.1 → fast_dev_cli-0.24.2}/fast_dev_cli/py.typed +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.24.2"
|
|
@@ -111,14 +111,15 @@ def yellow_warn(msg: str) -> None:
|
|
|
111
111
|
secho(msg, fg="yellow")
|
|
112
112
|
|
|
113
113
|
|
|
114
|
-
def load_bool(name: str, default: bool = False) -> bool:
|
|
114
|
+
def load_bool(name: str, default: bool = False, *, verbose: bool = True) -> bool:
|
|
115
115
|
if not (v := os.getenv(name)):
|
|
116
116
|
return default
|
|
117
117
|
if (lower := v.lower()) in ("0", "false", "f", "off", "no", "n"):
|
|
118
118
|
return False
|
|
119
119
|
elif lower in ("1", "true", "t", "on", "yes", "y"):
|
|
120
120
|
return True
|
|
121
|
-
|
|
121
|
+
if verbose:
|
|
122
|
+
secho(f"WARNING: can not convert value({v!r}) of {name} to bool!")
|
|
122
123
|
return default
|
|
123
124
|
|
|
124
125
|
|
|
@@ -1581,19 +1582,39 @@ def upload(
|
|
|
1581
1582
|
|
|
1582
1583
|
|
|
1583
1584
|
def should_use_just() -> bool:
|
|
1584
|
-
if shutil.which("just") is None:
|
|
1585
|
+
if shutil.which("just") is None or load_bool("FASTDEVCLI_IGNORE_JUST_DEV"):
|
|
1585
1586
|
return False
|
|
1586
1587
|
d = Path.cwd()
|
|
1587
1588
|
for _ in range(5):
|
|
1588
1589
|
f = d / "justfile"
|
|
1589
1590
|
if f.exists():
|
|
1590
|
-
|
|
1591
|
-
return any(i.startswith("dev *args:") for i in text.splitlines())
|
|
1591
|
+
return _prefer_just_dev(f)
|
|
1592
1592
|
if d.joinpath("pyproject.toml").exists():
|
|
1593
1593
|
break
|
|
1594
1594
|
return False
|
|
1595
1595
|
|
|
1596
1596
|
|
|
1597
|
+
def _prefer_just_dev(f: Path) -> bool:
|
|
1598
|
+
text = f.read_text(encoding="utf-8")
|
|
1599
|
+
lines = text.splitlines()
|
|
1600
|
+
dev_recipe = "dev *args:"
|
|
1601
|
+
re_import = re.compile(r"import[?]? ")
|
|
1602
|
+
has_import = False
|
|
1603
|
+
for i, line in enumerate(lines):
|
|
1604
|
+
if line.startswith(dev_recipe):
|
|
1605
|
+
# Avoid cycle callback
|
|
1606
|
+
return "fast dev" not in lines[i + 1]
|
|
1607
|
+
elif not has_import and re_import.match(line):
|
|
1608
|
+
has_import = True
|
|
1609
|
+
if has_import:
|
|
1610
|
+
recipes = capture_cmd_output("just --list").splitlines()
|
|
1611
|
+
for recipe in recipes:
|
|
1612
|
+
recipe = recipe.strip()
|
|
1613
|
+
if recipe.startswith(dev_recipe):
|
|
1614
|
+
return "fast dev" not in recipe
|
|
1615
|
+
return False
|
|
1616
|
+
|
|
1617
|
+
|
|
1597
1618
|
def _parse_serve_file(uvicorn, filename: str, cmd: str, args: list) -> str:
|
|
1598
1619
|
if m := re.search(r"(.*):(\d+)$", filename):
|
|
1599
1620
|
h, p = m.group(1), m.group(2)
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.24.1"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|